forked from joomla/Component-Builder
Improved the table detection in the mapping of the extrusion class when building table/fields from mysql dump
This commit is contained in:
parent
3db9deb534
commit
0c7d7265dd
@ -125,7 +125,7 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 13th June, 2018
|
||||
+ *Last Build*: 15th June, 2018
|
||||
+ *Version*: 2.8.0
|
||||
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
|
@ -125,7 +125,7 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 13th June, 2018
|
||||
+ *Last Build*: 15th June, 2018
|
||||
+ *Version*: 2.8.0
|
||||
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
|
@ -1417,6 +1417,11 @@ class Interpretation extends Fields
|
||||
$method[] = $this->_t(3) . "'password1' => \$password, // First password field";
|
||||
$method[] = $this->_t(3) . "'password2' => \$password2, // Confirm password field";
|
||||
$method[] = $this->_t(3) . "'block' => 0 );";
|
||||
$method[] = $this->_t(2) . "// set groups if found";
|
||||
$method[] = $this->_t(2) . "if (isset(\$new['groups']) && self::checkArray(\$new['groups']))";
|
||||
$method[] = $this->_t(2) . "{";
|
||||
$method[] = $this->_t(3) . "\$data['groups'] = \$new['groups'];";
|
||||
$method[] = $this->_t(2) . "}";
|
||||
$method[] = $this->_t(2) . "// register the new user";
|
||||
$method[] = $this->_t(2) . "\$done = \$model->save(\$data);";
|
||||
$method[] = $this->_t(2) . "// if user is updated";
|
||||
|
@ -101,7 +101,7 @@ class Mapping
|
||||
{
|
||||
// set the app to insure messages can be set
|
||||
$this->app = JFactory::getApplication();
|
||||
|
||||
|
||||
if (ComponentbuilderHelper::checkArray($data))
|
||||
{
|
||||
if (isset($data['buildcomp']) && 1 == $data['buildcomp'] && isset($data['buildcompsql']))
|
||||
@ -155,7 +155,7 @@ class Mapping
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The mapping function
|
||||
* To Map the views and fields that are needed
|
||||
@ -169,7 +169,8 @@ class Mapping
|
||||
foreach ($queries as $query)
|
||||
{
|
||||
// only use create table queries
|
||||
if (strpos($query, 'CREATE TABLE IF NOT EXISTS `') !== false)
|
||||
if (strpos($query, 'CREATE TABLE IF NOT EXISTS') !== false ||
|
||||
strpos($query, 'CREATE TABLE') !== false)
|
||||
{
|
||||
if ($tableName = $this->getTableName($query))
|
||||
{
|
||||
@ -205,15 +206,24 @@ class Mapping
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the table name
|
||||
*/
|
||||
protected function getTableName(&$query)
|
||||
{
|
||||
$tableName = ComponentbuilderHelper::getBetween($query, '`#__', "`");
|
||||
if (strpos($query, '`#__') !== false)
|
||||
{
|
||||
// get table name
|
||||
$tableName = ComponentbuilderHelper::getBetween($query, '`#__', "`");
|
||||
}
|
||||
elseif (strpos($query, "'#__") !== false)
|
||||
{
|
||||
// get table name
|
||||
$tableName = ComponentbuilderHelper::getBetween($query, "'#__", "'");
|
||||
}
|
||||
// if it still was not found
|
||||
if (!ComponentbuilderHelper::checkString($tableName))
|
||||
if (!isset($tableName) || !ComponentbuilderHelper::checkString($tableName))
|
||||
{
|
||||
// skip this query
|
||||
return false;
|
||||
@ -231,13 +241,13 @@ class Mapping
|
||||
// skip this query
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the field details
|
||||
*/
|
||||
protected function getFields(&$query)
|
||||
{
|
||||
$rows = array_map('trim', explode("\n", $query));
|
||||
$rows = array_map('trim', explode(PHP_EOL, $query));
|
||||
$fields = array();
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
@ -306,7 +316,7 @@ class Mapping
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the field types
|
||||
*/
|
||||
@ -325,7 +335,7 @@ class Mapping
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the field size
|
||||
*/
|
||||
@ -337,7 +347,7 @@ class Mapping
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the field default
|
||||
*/
|
||||
@ -355,7 +365,7 @@ class Mapping
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the field Null Value
|
||||
*/
|
||||
@ -373,7 +383,7 @@ class Mapping
|
||||
}
|
||||
return 'NULL';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the field key status
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>13th June, 2018</creationDate>
|
||||
<creationDate>15th June, 2018</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||
|
Loading…
Reference in New Issue
Block a user