Resolved gh-511 to ensure that all linked custom fields and rules are indeed moved to the plugins and modules related.

This commit is contained in:
Llewellyn van der Merwe 2020-02-13 14:24:13 +02:00
parent a6cdafb31f
commit 1dd9f75efc
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
4 changed files with 30 additions and 15 deletions

View File

@ -144,7 +144,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 12th February, 2020 + *Last Build*: 13th February, 2020
+ *Version*: 2.10.11 + *Version*: 2.10.11
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -144,7 +144,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 12th February, 2020 + *Last Build*: 13th February, 2020
+ *Version*: 2.10.11 + *Version*: 2.10.11
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -235,6 +235,13 @@ class Structure extends Get
*/ */
public $extentionCustomfields = array(); public $extentionCustomfields = array();
/**
* Extention Tracking Files Moved
*
* @var array
*/
public $extentionTrackingFilesMoved = array();
/** /**
* The standard folders * The standard folders
* *
@ -1808,26 +1815,34 @@ class Structure extends Get
// check if this is a custom field that should be moved // check if this is a custom field that should be moved
if (isset($this->extentionCustomfields[$field['type_name']])) if (isset($this->extentionCustomfields[$field['type_name']]))
{ {
// check files exist // lets check if we already moved this
if (JFile::exists($this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php')) if (!isset($this->extentionTrackingFilesMoved[$path . 'type' . $field['type_name']]))
{ {
// copy the custom field // check files exist
JFile::copy($this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php', $path . '/fields/' . $field['type_name'] . '.php'); if (JFile::exists($this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php'))
{
// copy the custom field
JFile::copy($this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php', $path . '/fields/' . $field['type_name'] . '.php');
}
// stop from doing this again.
$this->extentionTrackingFilesMoved[$path . 'type' . $field['type_name']] = true;
} }
// do this just once
unset($this->extentionCustomfields[$field['type_name']]);
} }
// check if this has validation that should be moved // check if this has validation that should be moved
if (isset($this->validationLinkedFields[$field['field']])) if (isset($this->validationLinkedFields[$field['field']]))
{ {
// check files exist // lets check if we already moved this
if (JFile::exists($this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php')) if (!isset($this->extentionTrackingFilesMoved[$path . 'rule' . $this->validationLinkedFields[$field['field']]]))
{ {
// copy the custom field // check files exist
JFile::copy($this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php', $path . '/rules/' . $this->validationLinkedFields[$field['field']] . '.php'); if (JFile::exists($this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php'))
{
// copy the custom field
JFile::copy($this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php', $path . '/rules/' . $this->validationLinkedFields[$field['field']] . '.php');
}
// stop from doing this again.
$this->extentionTrackingFilesMoved[$path . 'rule' . $this->validationLinkedFields[$field['field']]] = true;
} }
// do this just once
unset($this->validationLinkedFields[$field['field']]);
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>12th February, 2020</creationDate> <creationDate>13th February, 2020</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>