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";
|
||||
|
@ -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))
|
||||
{
|
||||
@ -211,9 +212,18 @@ class Mapping
|
||||
*/
|
||||
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;
|
||||
@ -237,7 +247,7 @@ class Mapping
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
@ -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