Fixed GUID duplication issue.

This commit is contained in:
2020-05-25 02:38:16 +02:00
parent eda4d594d6
commit 5f1d17bfb3
23 changed files with 241 additions and 83 deletions

View File

@@ -9149,6 +9149,8 @@ class Get
// set some placeholder for this plugin
$this->placeholders[$this->bbb . 'Plugin_name' . $this->ddd]
= $plugin->official_name;
$this->placeholders[$this->hhh . 'PLUGIN_NAME' . $this->hhh]
= $plugin->official_name;
$this->placeholders[$this->bbb . 'Plugin' . $this->ddd]
= ucfirst(
$plugin->code_name
@@ -9167,11 +9169,15 @@ class Get
);
$this->placeholders[$this->bbb . 'plugin.version' . $this->ddd]
= $plugin->plugin_version;
$this->placeholders[$this->hhh . 'VERSION' . $this->hhh]
= $plugin->plugin_version;
$this->placeholders[$this->bbb . 'plugin_version' . $this->ddd]
= str_replace(
'.', '_', $plugin->plugin_version
);
// set description (TODO) add description field to plugin
// set description
$this->placeholders[$this->hhh . 'DESCRIPTION' . $this->hhh]
= '';
if (!isset($plugin->description)
|| !ComponentbuilderHelper::checkString(
$plugin->description
@@ -9189,6 +9195,9 @@ class Get
$plugin->key, $plugin->lang_prefix . '_DESCRIPTION',
$plugin->description
);
// set description
$this->placeholders[$this->hhh . 'DESCRIPTION' . $this->hhh]
= $plugin->description;
$plugin->description = '<p>' . $plugin->description
. '</p>';
}
@@ -9672,6 +9681,15 @@ class Get
$this->placeholders[$this->bbb . 'plugin_version'
. $this->ddd]
);
unset(
$this->placeholders[$this->hhh . 'VERSION'
. $this->hhh]);
unset(
$this->placeholders[$this->hhh . 'DESCRIPTION'
. $this->hhh]);
unset(
$this->placeholders[$this->hhh . 'PLUGIN_NAME'
. $this->hhh]);
$this->joomlaPlugins[$id] = $plugin;

View File

@@ -95,6 +95,13 @@ class Fields extends Structure
*/
public $dbUniqueKeys = array();
/**
* unique guid swtich
*
* @var array
*/
public $dbUniqueGuid = array();
/**
* keys for database field
*
@@ -3850,6 +3857,7 @@ class Fields extends Structure
$this->queryBuilder[$view_name_single][$name]['null_switch']
= $field['settings']->null_switch;
// set index types
$_guid = true;
if ($field['settings']->indexes == 1
&& !in_array(
$field['settings']->datatype, $textKeys
@@ -3857,6 +3865,11 @@ class Fields extends Structure
{
// build unique keys of this view for db
$this->dbUniqueKeys[$view_name_single][] = $name;
// prevent guid from being added twice
if ('guid' === $name)
{
$_guid = false;
}
}
elseif (($field['settings']->indexes == 2
|| (isset($field['alias'])
@@ -3868,6 +3881,11 @@ class Fields extends Structure
// build keys of this view for db
$this->dbKeys[$view_name_single][] = $name;
}
// special treatment for GUID
if ('guid' === $name && $_guid)
{
$this->dbUniqueGuid[$view_name_single] = true;
}
}
// set list switch
$listSwitch = (isset($field['list'])

View File

@@ -17164,9 +17164,24 @@ class Interpretation extends Fields
if (isset($this->dbUniqueKeys[$view])
&& ComponentbuilderHelper::checkArray($this->dbUniqueKeys[$view]))
{
$fields[] = $this->_t(2) . "return array('" . implode(
"','", $this->dbUniqueKeys[$view]
) . "');";
// if guid should also be added
if (isset($this->dbUniqueGuid[$view]))
{
$fields[] = $this->_t(2) . "return array('" . implode(
"','", $this->dbUniqueKeys[$view]
) . "', 'guid');";
}
else
{
$fields[] = $this->_t(2) . "return array('" . implode(
"','", $this->dbUniqueKeys[$view]
) . "');";
}
}
// if only GUID is found
elseif (isset($this->dbUniqueGuid[$view]))
{
$fields[] = $this->_t(2) . "return array('guid');";
}
else
{