1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Bugfix: prefs, links and userclasses were being overwritten or throwing errors during upgrade.

This commit is contained in:
CaMer0n
2012-11-07 20:27:41 +00:00
parent 6e5545187d
commit c892f33916

View File

@@ -679,7 +679,7 @@ class e107plugin
} }
else else
{ {
return FALSE; return NULL;
} }
} }
if ($action == 'remove') if ($action == 'remove')
@@ -739,7 +739,7 @@ class e107plugin
} }
else else
{ {
return FALSE; return ;
} }
} }
if ($action == 'remove') if ($action == 'remove')
@@ -1176,7 +1176,7 @@ class e107plugin
} }
/* /*
* NEW upgrade XML * NEW upgrade XML - Not required.
* higher priority -> from-to version upgrade XML - e.g. upgrade/upgrade_1.0-1.1.xml (v1.0 to v1.1 only) * higher priority -> from-to version upgrade XML - e.g. upgrade/upgrade_1.0-1.1.xml (v1.0 to v1.1 only)
* when above not present -> generic version upgrade XML - e.g. upgrade/upgrade_1.1.xml (all prior versions to v1.1) * when above not present -> generic version upgrade XML - e.g. upgrade/upgrade_1.1.xml (all prior versions to v1.1)
* last checked -> generic upgrade file - plugName/plugin_upgrade.xml (all version) * last checked -> generic upgrade file - plugName/plugin_upgrade.xml (all version)
@@ -1184,6 +1184,7 @@ class e107plugin
* The reason is plugin prefs will be reset to default values, user classes will be duplicated etx if plugin.xml is used * The reason is plugin prefs will be reset to default values, user classes will be duplicated etx if plugin.xml is used
* To avoid this, put upgrade XML with basic data nodes (version, description, category, author etc) * To avoid this, put upgrade XML with basic data nodes (version, description, category, author etc)
*/ */
/*
if ($canContinue && $function === 'upgrade') if ($canContinue && $function === 'upgrade')
{ {
$found = false; $found = false;
@@ -1203,6 +1204,7 @@ class e107plugin
} }
} }
} }
* */
// END upgrade XML // END upgrade XML
if (varset($plug_vars['languageFiles'])) if (varset($plug_vars['languageFiles']))
@@ -1562,14 +1564,16 @@ class e107plugin
case 'install': case 'install':
if (!$remove) // Add any non-deprecated link if (!$remove) // Add any non-deprecated link
{ {
$status = ($this->manage_link('add', $url, $linkName, $perm)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $result = $this->manage_link('add', $url, $linkName, $perm);
$mes->add("Adding Link: {$linkName} with url [{$url}] and perm {$perm} ", $status); //TODO LAN if($result !== NULL)
{
$status = ($result) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Link: {$linkName} with url [{$url}] and perm {$perm} ", $status); //TODO LAN
}
} }
if ($function == 'upgrade' && $remove) //remove inactive links on upgrade if ($function == 'upgrade' && $remove) //remove inactive links on upgrade
{ {
$status = ($this->manage_link('remove', $url, $linkName)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = ($this->manage_link('remove', $url, $linkName)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Removing Link: {$linkName} with url [{$url}]", $status); $mes->add("Removing Link: {$linkName} with url [{$url}]", $status);
@@ -1727,10 +1731,13 @@ class e107plugin
case 'refresh': case 'refresh':
if (!$remove) // Add all active userclasses (code checks for already installed) if (!$remove) // Add all active userclasses (code checks for already installed)
{ {
$status = $this->manage_userclass('add', $name, $description) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $result = $this->manage_userclass('add', $name, $description);
$mes->add('Adding Userclass: '.$name, $status); if($result !== NULL)
{
$status = ($result) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add('Adding Userclass: '.$name, $status);
}
} }
if ($function == 'upgrade' && $remove) //If upgrading, removing any inactive userclass if ($function == 'upgrade' && $remove) //If upgrading, removing any inactive userclass
@@ -1858,11 +1865,15 @@ class e107plugin
switch ($function) switch ($function)
{ {
case 'install': case 'install':
$config->add($key, $value); case 'upgrade':
$mes->add("Adding Pref: ".$key, E_MESSAGE_SUCCESS); $ret = $config->add($key, $value);
if($ret->data_has_changed == TRUE)
{
$mes->add("Adding Pref: ".$key, E_MESSAGE_SUCCESS);
}
break; break;
case 'upgrade':
case 'refresh': case 'refresh':
if ($remove) // remove active='false' prefs. if ($remove) // remove active='false' prefs.