forked from joomla/Component-Builder
Fixed a strange mismatch issue with JCB package import with more then 10 components at a time. Also fixed the translation entranslation to source.
This commit is contained in:
parent
4b57e69edb
commit
a110ff0e35
@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 19th April, 2018
|
||||
+ *Last Build*: 20th April, 2018
|
||||
+ *Version*: 2.7.6
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
+ *Line count*: **183307**
|
||||
+ *Line count*: **183326**
|
||||
+ *Field count*: **1013**
|
||||
+ *File count*: **1200**
|
||||
+ *Folder count*: **193**
|
||||
|
@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 19th April, 2018
|
||||
+ *Last Build*: 20th April, 2018
|
||||
+ *Version*: 2.7.6
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
+ *Line count*: **183307**
|
||||
+ *Line count*: **183326**
|
||||
+ *Field count*: **1013**
|
||||
+ *File count*: **1200**
|
||||
+ *Folder count*: **193**
|
||||
|
@ -924,7 +924,7 @@ COM_COMPONENTBUILDER_BACK_TO_LIBRARIES="Back to Libraries"
|
||||
COM_COMPONENTBUILDER_BASIC_TUTORIAL_ON_GIT_BSB="Basic Tutorial on git: <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_THIS_PACKAGE_BFAILEDB_CHECKSUM_VALIDATION_THIS_COULD_BE_A_SERIOUS_SECURITY_BREACH_DO_NOT_CONTINUE="<b>Best to not continue!</b><br />This package <b>FAILED</b> checksum validation, this could be a serious security breach! DO NOT CONTINUE!!!"
|
||||
COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_WE_COULD_NOT_LOAD_THE_CHECKSUM_FOR_THIS_PACKAGE_AND_SO_NO_VALIDATION_WAS_POSSIBLE_THIS_MAY_BE_DUE_TO_YOUR_NETWORK_OR_A_CHANGE_TO_THAT_PACKAGE_NAME="<b>Best to not continue!</b><br />We could not load the checksum for this package, and so no validation was possible. This may be due to your network, or a change to that package name."
|
||||
COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVE_TO_CORRECT_LOCATION="<b>Custom files</b> not move to correct location!"
|
||||
COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVED_TO_CORRECT_LOCATION="<b>Custom files</b> not moved to correct location!"
|
||||
COM_COMPONENTBUILDER_BEHIND="Behind"
|
||||
COM_COMPONENTBUILDER_BEHIND_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BOLDER_MODIFIED_DATEB_THEN_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE="Behind means your <b>local snippet</b> (with the same name, library and type) has a <b>older modified date</b> then the community snippet (with the same name, library and type)."
|
||||
COM_COMPONENTBUILDER_BETA_RELEASE="Beta Release"
|
||||
@ -932,7 +932,7 @@ COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_
|
||||
COM_COMPONENTBUILDER_BFIELD_TYPEB_IDS_MISMATCH_IN_BSB="<b>Field type</b> id:%s mismatch in <b>%s</b>."
|
||||
COM_COMPONENTBUILDER_BFIELD_TYPEB_NOT_SET_FOR_BSB="<b>Field type</b> not set for <b>%s</b>."
|
||||
COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA="<b>Get the key from</b> <a class="btn btn-primary" href="%s" target="_blank" title="get a key from %s">%s</a>"
|
||||
COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVE_TO_CORRECT_LOCATION="<b>Images</b> not move to correct location!"
|
||||
COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVED_TO_CORRECT_LOCATION="<b>Images</b> not moved to correct location!"
|
||||
COM_COMPONENTBUILDER_BMULTIPLE_FIELD_REPEATABLE_MODEB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_EMREMOVEDEM_FROM_THE_FIELD="<b>Multiple Field (repeatable mode)</b> id:%s mismatch in <b>field:%s</b>, and was <em>removed</em> from the field."
|
||||
COM_COMPONENTBUILDER_BSBS_IN_BSB_HAS_ID_MISMATCH_SO_THE_BSB_WAS_REMOVED="<b>%s</b>->%s in <b>%s</b> has id mismatch. So the <b>%s</b> was removed!"
|
||||
COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS="<b>%s</b> could not be imported%s"
|
||||
@ -3971,12 +3971,12 @@ COM_COMPONENTBUILDER_FIELD_ZERO="0"
|
||||
COM_COMPONENTBUILDER_FILE="File"
|
||||
COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED="File <b>%s</b> could not be unlocked!"
|
||||
COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB="File <b>%s</b> was moved to <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_BSB="File <b>%s</b> was not move to <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB="File <b>%s</b> was not moved to <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED="File <b>%s</b> was successfully unlocked!"
|
||||
COM_COMPONENTBUILDER_FILTER="Filter"
|
||||
COM_COMPONENTBUILDER_FOLDER="Folder"
|
||||
COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB="Folder <b>%s</b> was moved to <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_BSB="Folder <b>%s</b> was not move to <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB="Folder <b>%s</b> was not moved to <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_FORCE_LOCAL_UPDATE="Force Local Update"
|
||||
COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab"
|
||||
COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN="Function name already taken, please try again."
|
||||
|
@ -725,7 +725,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
}
|
||||
// do a after all run on all items that need it
|
||||
$this->updateAfter();
|
||||
$this->updateAfterAll();
|
||||
// finally move the old datasets
|
||||
$this->moveDivergedData();
|
||||
// lets move all the files to its correct location
|
||||
@ -739,7 +739,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
/**
|
||||
* Save the smart items
|
||||
*
|
||||
* @param string $type The type of values
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return boolean false on failure
|
||||
*
|
||||
@ -873,7 +873,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// great we have some custom stuff lets move it
|
||||
if (!JFolder::copy($customDir, $customPath,'',true))
|
||||
{
|
||||
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVE_TO_CORRECT_LOCATION'), 'error');
|
||||
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVED_TO_CORRECT_LOCATION'), 'error');
|
||||
$success = false;
|
||||
}
|
||||
// display more import info
|
||||
@ -889,7 +889,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// great we have some images lets move them
|
||||
if (!JFolder::copy($imageDir, $imagesPath,'',true))
|
||||
{
|
||||
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVE_TO_CORRECT_LOCATION'), 'error');
|
||||
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVED_TO_CORRECT_LOCATION'), 'error');
|
||||
$success = false;
|
||||
}
|
||||
// display more import info
|
||||
@ -913,7 +913,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$fullPath = str_replace('//', '/', $dynamicDir . '/' . $folder);
|
||||
if (!JFolder::exists($fullPath) || !JFolder::copy($fullPath, $destination,'',true))
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_BSB', $folder, $destination), 'error');
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB', $folder, $destination), 'error');
|
||||
$success = false;
|
||||
}
|
||||
// display more import info
|
||||
@ -934,7 +934,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$fullPath = str_replace('//', '/', $dynamicDir . '/' . $file);
|
||||
if (!JFile::exists($fullPath) || !JFile::copy($fullPath, $destination))
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_BSB', $file, $destination), 'error');
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB', $file, $destination), 'error');
|
||||
$success = false;
|
||||
}
|
||||
// display more import info
|
||||
@ -1018,7 +1018,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
* @return void
|
||||
*
|
||||
**/
|
||||
public function updateAfter()
|
||||
public function updateAfterAll()
|
||||
{
|
||||
if (ComponentbuilderHelper::checkArray($this->updateAfter['field']))
|
||||
{
|
||||
@ -1097,7 +1097,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
if (ComponentbuilderHelper::checkJson($addlinked_views))
|
||||
{
|
||||
$addlinked_views = json_decode($addlinked_views, true);
|
||||
// convert Repetable Fields
|
||||
// convert Repeatable Fields
|
||||
if (ComponentbuilderHelper::checkArray($addlinked_views) && isset($addlinked_views['adminview']))
|
||||
{
|
||||
$addlinked_views = ComponentbuilderHelper::convertRepeatable($addlinked_views, 'addlinked_views');
|
||||
@ -1385,7 +1385,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
* object on success
|
||||
*
|
||||
**/
|
||||
protected function prepItem($item, &$type, $action, $diverged = false)
|
||||
protected function prepItem($item, $type, $action, $diverged = false)
|
||||
{
|
||||
// remove access
|
||||
if (isset($item->access))
|
||||
@ -1806,9 +1806,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
// repeatable fields to update
|
||||
$updaterR = array(
|
||||
// repeatablefield => checker
|
||||
'sql_tweak' => 'adminview'
|
||||
);
|
||||
// repeatablefield => checker
|
||||
'sql_tweak' => 'adminview'
|
||||
);
|
||||
// update the repeatable fields
|
||||
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
|
||||
// subform fields to target
|
||||
@ -2006,6 +2006,13 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
{
|
||||
unset($item->localTranslation);
|
||||
}
|
||||
// move entranslation to source
|
||||
if (isset($item->entranslation))
|
||||
{
|
||||
$item->source = $item->entranslation;
|
||||
// also remove the old field
|
||||
unset($item->entranslation);
|
||||
}
|
||||
break;
|
||||
case 'admin_fields':
|
||||
case 'admin_fields_conditions':
|
||||
@ -2217,7 +2224,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
* ID int on success
|
||||
*
|
||||
**/
|
||||
protected function updateLocalItem(&$item, &$type, &$canState)
|
||||
protected function updateLocalItem(&$item, $type, &$canState)
|
||||
{
|
||||
// prep the item
|
||||
if ($update = $this->prepItem($item, $type, 'update'))
|
||||
@ -2248,7 +2255,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
* ID int on success
|
||||
*
|
||||
**/
|
||||
protected function addLocalItem(&$item, &$type, $diverged = false)
|
||||
protected function addLocalItem(&$item, $type, $diverged = false)
|
||||
{
|
||||
// prep the item
|
||||
if ($add = $this->prepItem($item, $type, 'add', $diverged))
|
||||
@ -2279,15 +2286,26 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
* ID int on success
|
||||
*
|
||||
**/
|
||||
protected function getLocalItem(&$item, &$type, $retry = false, $get = 1, $diverged = false)
|
||||
protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverged = false)
|
||||
{
|
||||
$query = $this->_db->getQuery(true);
|
||||
$query->select('a.*');
|
||||
$query->from($this->_db->quoteName('#__componentbuilder_' . $type, 'a'));
|
||||
// only run query if where is set
|
||||
$runQuery = false;
|
||||
if ($get == 1 && isset($item->created) && isset($item->id))
|
||||
if ($get == 1 && isset($item->created) && isset($item->id) && (isset($item->name) || isset($item->system_name)))
|
||||
{
|
||||
// to prefent crazy mismatch with old IDs (I know very weired)
|
||||
if (isset($item->system_name))
|
||||
{
|
||||
$query->where($this->_db->quoteName('a.system_name') . ' = '. $this->_db->quote($item->system_name));
|
||||
}
|
||||
// to prefent crazy mismatch with old IDs (I know very weired)
|
||||
if (isset($item->name))
|
||||
{
|
||||
$query->where($this->_db->quoteName('a.name') . ' = '. $this->_db->quote($item->name));
|
||||
}
|
||||
// load the created and id
|
||||
$query->where($this->_db->quoteName('a.created') . ' = '. $this->_db->quote($item->created));
|
||||
$query->where($this->_db->quoteName('a.id') .' = '. (int) $item->id);
|
||||
$runQuery = true;
|
||||
@ -2330,19 +2348,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($item->{$get}) && componentbuilderHelper::checkString($item->{$get})) // do not allow empty strings (since it could be major mis match)
|
||||
{
|
||||
// set the value
|
||||
$value = $item->{$get};
|
||||
// check if we have special value
|
||||
if ($this->specialValue && ComponentbuilderHelper::checkArray($this->specialValue) && isset($this->specialValue[$get]))
|
||||
{
|
||||
$value = $this->specialValue[$get];
|
||||
}
|
||||
$query->where($this->_db->quoteName('a.' . $get) . ' = '. $this->_db->quote($value));
|
||||
$runQuery = true;
|
||||
}
|
||||
elseif (isset($item->{$get}) && is_numeric($item->{$get}))
|
||||
elseif (isset($item->{$get}))
|
||||
{
|
||||
// set the value
|
||||
$value = $item->{$get};
|
||||
@ -2352,14 +2358,18 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$value = $this->specialValue[$get];
|
||||
}
|
||||
// load to query
|
||||
if (is_int($value))
|
||||
if (is_numeric($value) && is_int($value))
|
||||
{
|
||||
$query->where($this->_db->quoteName('a.' . $get) . ' = '. (int) $value);
|
||||
}
|
||||
elseif (is_float($value))
|
||||
elseif (is_numeric($value) && is_float($value))
|
||||
{
|
||||
$query->where($this->_db->quoteName('a.' . $get) . ' = '. (float) $value);
|
||||
}
|
||||
elseif(componentbuilderHelper::checkString($value)) // do not allow empty strings (since it could be major mis match)
|
||||
{
|
||||
$query->where($this->_db->quoteName('a.' . $get) . ' = '. $this->_db->quote($value));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false; // really not needed but who knows for sure...
|
||||
@ -2399,6 +2409,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
{
|
||||
$this->specialValue['admin_view'] = $this->newID['admin_view'][(int) $item->admin_view];
|
||||
}
|
||||
// (TODO) I have seen this happen, seems dangerous!
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'validation_rule':
|
||||
case 'fieldtype':
|
||||
@ -2549,27 +2564,31 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
case 'component_config':
|
||||
case 'component_dashboard':
|
||||
case 'component_files_folders':
|
||||
// get by joomla_component (since there should only be one of each component)
|
||||
$getter = array('joomla_component');
|
||||
$this->specialValue = array();
|
||||
// Yet if diverged it makes sense that the ID is updated.
|
||||
if ($diverged)
|
||||
{
|
||||
$this->specialValue['joomla_component'] = (int) $item->joomla_component;
|
||||
}
|
||||
elseif (isset($this->newID['joomla_component'][(int) $item->joomla_component]))
|
||||
{
|
||||
$this->specialValue['joomla_component'] = $this->newID['joomla_component'][(int) $item->joomla_component];
|
||||
}
|
||||
// (TODO) I have seen this happen, seems dangerous!
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// get by joomla_component (since there should only be one of each component)
|
||||
$getter = array('joomla_component');
|
||||
$this->specialValue = array();
|
||||
// Yet if diverged it makes sense that the ID is updated.
|
||||
if ($diverged)
|
||||
{
|
||||
$this->specialValue['joomla_component'] = (int) $item->joomla_component;
|
||||
}
|
||||
elseif (isset($this->newID['joomla_component'][(int) $item->joomla_component]))
|
||||
{
|
||||
$this->specialValue['joomla_component'] = $this->newID['joomla_component'][(int) $item->joomla_component];
|
||||
}
|
||||
// (TODO) I have seen this happen, seems dangerous!
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'language_translation':
|
||||
// get by English translation since there should just be one
|
||||
$getter = 'entranslation';
|
||||
// get by source translation since there should just be one
|
||||
$getter = 'source';
|
||||
if (isset($item->entranslation))
|
||||
{
|
||||
$item->source = $item->entranslation;
|
||||
}
|
||||
break;
|
||||
case 'language':
|
||||
// get by language tag since there should just be one
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>19th April, 2018</creationDate>
|
||||
<creationDate>20th April, 2018</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||
<authorUrl>http://joomlacomponentbuilder.com</authorUrl>
|
||||
|
Loading…
Reference in New Issue
Block a user