Fixed gh-377 to avoid mismatching on replace eding target hash. Imporved the versioning feature so that once you change the version in the update mysql area, it also updates the Joomla component.

This commit is contained in:
Llewellyn van der Merwe 2019-02-12 18:42:16 +02:00
parent 104c4e6bae
commit bebb98e915
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
5 changed files with 36 additions and 5 deletions

View File

@ -103,6 +103,7 @@ Where can you get support and help?
==================== ====================
+ [The JCB Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE) + [The JCB Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE)
+ [German Basic Introduction](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wu0tDFxJtZFwW7AxA4JHQV7)
+ [Hello World Tutorial](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) + [Hello World Tutorial](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
+ [The JCB! Wiki](https://github.com/vdm-io/Joomla-Component-Builder/wiki) + [The JCB! Wiki](https://github.com/vdm-io/Joomla-Component-Builder/wiki)
+ [JCB Google Group/forum](https://vdm.bz/jcb-forum) + [JCB Google Group/forum](https://vdm.bz/jcb-forum)
@ -144,11 +145,11 @@ 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*: 6th February, 2019 + *Last Build*: 12th February, 2019
+ *Version*: 2.9.11 + *Version*: 2.9.11
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 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
+ *Line count*: **195865** + *Line count*: **195885**
+ *Field count*: **1089** + *Field count*: **1089**
+ *File count*: **1277** + *File count*: **1277**
+ *Folder count*: **201** + *Folder count*: **201**

View File

@ -103,6 +103,7 @@ Where can you get support and help?
==================== ====================
+ [The JCB Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE) + [The JCB Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE)
+ [German Basic Introduction](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wu0tDFxJtZFwW7AxA4JHQV7)
+ [Hello World Tutorial](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) + [Hello World Tutorial](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
+ [The JCB! Wiki](https://github.com/vdm-io/Joomla-Component-Builder/wiki) + [The JCB! Wiki](https://github.com/vdm-io/Joomla-Component-Builder/wiki)
+ [JCB Google Group/forum](https://vdm.bz/jcb-forum) + [JCB Google Group/forum](https://vdm.bz/jcb-forum)
@ -144,11 +145,11 @@ 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*: 6th February, 2019 + *Last Build*: 12th February, 2019
+ *Version*: 2.9.11 + *Version*: 2.9.11
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 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
+ *Line count*: **195865** + *Line count*: **195885**
+ *Field count*: **1089** + *Field count*: **1089**
+ *File count*: **1277** + *File count*: **1277**
+ *Folder count*: **201** + *Folder count*: **201**

View File

@ -315,6 +315,24 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm
*/ */
protected function postSaveHook(JModelLegacy $model, $validData = array()) protected function postSaveHook(JModelLegacy $model, $validData = array())
{ {
// update the component version to match the updated last version
if (isset($validData['joomla_component']) && is_numeric($validData['joomla_component']) && $validData['joomla_component'] > 0)
{
$objectUpdate = new stdClass();
$objectUpdate->id = (int) $validData['joomla_component'];
if (isset($validData['version_update']) && ComponentbuilderHelper::checkArray($validData['version_update'])
&& ($component_version = end($validData['version_update'])['version'])
&& ComponentbuilderHelper::checkString($component_version))
{
$objectUpdate->component_version = $component_version;
}
// be sure to update the table if we have a value
if (isset($objectUpdate->component_version))
{
JFactory::getDbo()->updateObject('#__componentbuilder_joomla_component', $objectUpdate, 'id');
}
}
return; return;
} }

View File

@ -5513,12 +5513,23 @@ class Get
{ {
$customCode['code'] = $this->setCustomCodeData($customCode['code'], $debug, $nr); $customCode['code'] = $this->setCustomCodeData($customCode['code'], $debug, $nr);
} }
// build the hash array
if (isset($customCode['hashtarget'])) if (isset($customCode['hashtarget']))
{ {
$customCode['hashtarget'] = explode("__", $customCode['hashtarget']); $customCode['hashtarget'] = explode("__", $customCode['hashtarget']);
// is this a replace code, set end has array
if ($customCode['type'] == 1 && strpos($customCode['hashendtarget'], '__') !== false) if ($customCode['type'] == 1 && strpos($customCode['hashendtarget'], '__') !== false)
{ {
$customCode['hashendtarget'] = explode("__", $customCode['hashendtarget']); $customCode['hashendtarget'] = explode("__", $customCode['hashendtarget']);
// NOW see if this is an end of page target (TODO not sure if the string is always d41d8cd98f00b204e9800998ecf8427e)
// I know this fix is not air-tight, but it should work as the value of an empty line when md5'ed is ^^^^
// Then if the line number is only >>>one<<< it is almost always end of the page.
// So I am using those two values to detect end of page replace ending, to avoid mismatching the ending target hash.
if ($customCode['hashendtarget'][0] == 1 && 'd41d8cd98f00b204e9800998ecf8427e' === $customCode['hashendtarget'][1])
{
// unset since this will force the replacement unto end of page.
unset($customCode['hashendtarget']);
}
} }
} }
} }

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>6th February, 2019</creationDate> <creationDate>12th February, 2019</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>