1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Plugin upgrade SQL execution logic mismatch

This commit is contained in:
secretr
2010-06-23 10:21:21 +00:00
parent 1adf1d6179
commit fe0926b9cf
2 changed files with 766 additions and 804 deletions

View File

@@ -18,7 +18,7 @@
*/ */
require_once("../class2.php"); require_once("../class2.php");
if (!getperms("Z")) if (!getperms("Z"))
{ {
header("location:".e_BASE."index.php"); header("location:".e_BASE."index.php");
exit; exit;
@@ -92,7 +92,7 @@ class pluginManager{
"plugin_compliant" => array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""), "plugin_compliant" => array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""),
// "plugin_release" => array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""), // "plugin_release" => array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""),
"options" => array("title" => LAN_OPTIONS, 'forced'=>TRUE, "width" => "15%", "thclass" => "middle center last", "url" => ""), "options" => array("title" => LAN_OPTIONS, 'forced'=>TRUE, "width" => "15%", "thclass" => "middle center last", "url" => ""),
); );
@@ -120,7 +120,7 @@ class pluginManager{
function pluginObserver() function pluginObserver()
{ {
global $user_pref,$admin_log; global $user_pref,$admin_log;
if (isset($_POST['upload'])) if (isset($_POST['upload']))
{ {
@@ -179,19 +179,19 @@ class pluginManager{
} }
$this -> action = "installed"; $this -> action = "installed";
} }
if($this->action != 'avail' && varset($this->fields['plugin_checkboxes'])) if($this->action != 'avail' && varset($this->fields['plugin_checkboxes']))
{ {
$this->fields['plugin_checkboxes'] = FALSE; $this->fields['plugin_checkboxes'] = FALSE;
} }
if($this->action !='upload' && $this->action !='uninstall') if($this->action !='upload' && $this->action !='uninstall')
{ {
$this -> pluginRenderList(); $this -> pluginRenderList();
} }
} }
function pluginUninstall() function pluginUninstall()
@@ -211,10 +211,10 @@ class pluginManager{
{ {
$eplug_folder = $plug['plugin_path']; $eplug_folder = $plug['plugin_path'];
$_path = e_PLUGIN.$plug['plugin_path'].'/'; $_path = e_PLUGIN.$plug['plugin_path'].'/';
if(file_exists($_path.'plugin.xml')) if(file_exists($_path.'plugin.xml'))
{ {
unset($_POST['uninstall_confirm']); unset($_POST['uninstall_confirm']);
$text .= $plugin->install_plugin_xml($this->id, 'uninstall', $_POST); //$_POST must be used. $text .= $plugin->install_plugin_xml($this->id, 'uninstall', $_POST); //$_POST must be used.
} }
else else
@@ -288,10 +288,10 @@ class pluginManager{
} }
$admin_log->log_event('PLUGMAN_03', $plug['plugin_path'], E_LOG_INFORMATIVE, ''); $admin_log->log_event('PLUGMAN_03', $plug['plugin_path'], E_LOG_INFORMATIVE, '');
if (isset($pref['plug_installed'][$plug['plugin_path']])) if (isset($pref['plug_installed'][$plug['plugin_path']]))
{ {
unset($pref['plug_installed'][$plug['plugin_path']]); unset($pref['plug_installed'][$plug['plugin_path']]);
if(save_prefs()) if(save_prefs())
{ {
@@ -453,9 +453,9 @@ class pluginManager{
function pluginUpgrade() function pluginUpgrade()
{ {
global $plugin,$pref,$admin_log; global $plugin,$pref,$admin_log;
$sql = e107::getDb(); $sql = e107::getDb();
$emessage = eMessage::getInstance(); $emessage = eMessage::getInstance();
$plug = $plugin->getinfo($this->id); $plug = $plugin->getinfo($this->id);
@@ -478,9 +478,11 @@ class pluginManager{
if (is_array($upgrade_alter_tables)) if (is_array($upgrade_alter_tables))
{ {
$result = $plugin->manage_tables('upgrade', $upgrade_alter_tables); $result = $plugin->manage_tables('upgrade', $upgrade_alter_tables);
if (!$result) if (true !== $result)
{ {
$text .= EPL_ADLAN_9.'<br />'; //$text .= EPL_ADLAN_9.'<br />';
$emessage->addWarning(EPL_ADLAN_9)
->addDebug($result);
} }
else else
{ {
@@ -574,8 +576,8 @@ class pluginManager{
$pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version $pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version
save_prefs(); save_prefs();
} }
$emessage->add($text, E_MESSAGE_SUCCESS); $emessage->add($text, E_MESSAGE_SUCCESS);
$plugin->save_addon_prefs(); $plugin->save_addon_prefs();
@@ -669,7 +671,7 @@ class pluginManager{
global $plugin, $frm; global $plugin, $frm;
$e107 = e107::getInstance(); $e107 = e107::getInstance();
if($this->action == "" || $this->action == "installed") if($this->action == "" || $this->action == "installed")
{ {
$installed = $plugin->getall(1); $installed = $plugin->getall(1);
@@ -701,12 +703,12 @@ class pluginManager{
if($pluginRenderPlugin) if($pluginRenderPlugin)
{ {
$text .= $pluginRenderPlugin; $text .= $pluginRenderPlugin;
} }
else else
{ {
//TODO LANs //TODO LANs
$text .= "<tr><td class='center' colspan='".count($this->fields)."'>No plugins installed - <a href='".e_ADMIN."plugin.php?avail'>click here to install some</a>.</td></tr>"; $text .= "<tr><td class='center' colspan='".count($this->fields)."'>No plugins installed - <a href='".e_ADMIN."plugin.php?avail'>click here to install some</a>.</td></tr>";
} }
$text .= " $text .= "
@@ -735,18 +737,18 @@ class pluginManager{
global $plugin, $frm; global $plugin, $frm;
if (empty($pluginList)) return ''; if (empty($pluginList)) return '';
$tp = e107::getParser(); $tp = e107::getParser();
$text = ""; $text = "";
foreach($pluginList as $plug) foreach($pluginList as $plug)
{ {
e107::loadLanFiles($plug['plugin_path'],'admin'); e107::loadLanFiles($plug['plugin_path'],'admin');
$_path = e_PLUGIN.$plug['plugin_path'].'/'; $_path = e_PLUGIN.$plug['plugin_path'].'/';
$plug_vars = false; $plug_vars = false;
$plugin_config_icon = ""; $plugin_config_icon = "";
@@ -754,12 +756,12 @@ class pluginManager{
{ {
$plug_vars = $plugin->plug_vars; $plug_vars = $plugin->plug_vars;
} }
if(varset($plug['plugin_category']) == "menu") // Hide "Menu Only" plugins. if(varset($plug['plugin_category']) == "menu") // Hide "Menu Only" plugins.
{ {
continue; continue;
} }
if($plug_vars) if($plug_vars)
{ {
@@ -882,11 +884,11 @@ class pluginManager{
function pluginConfirmUninstall() function pluginConfirmUninstall()
{ {
global $plugin; global $plugin;
$frm = e107::getForm(); $frm = e107::getForm();
$tp = e107::getParser(); $tp = e107::getParser();
$mes = e107::getMessage(); $mes = e107::getMessage();
$plug = $plugin->getinfo($this->id); $plug = $plugin->getinfo($this->id);
if ($plug['plugin_installflag'] == true ) if ($plug['plugin_installflag'] == true )
@@ -960,9 +962,9 @@ class pluginManager{
<td>".EPL_ADLAN_55."</td> <td>".EPL_ADLAN_55."</td>
<td>".LAN_YES."</td> <td>".LAN_YES."</td>
</tr>"; </tr>";
$opts = array(); $opts = array();
$opts['delete_tables'] = array( $opts['delete_tables'] = array(
'label' => EPL_ADLAN_57, 'label' => EPL_ADLAN_57,
'helpText' => EPL_ADLAN_58, 'helpText' => EPL_ADLAN_58,
@@ -971,7 +973,7 @@ class pluginManager{
); );
if ($userclasses) if ($userclasses)
{ {
$opts['delete_userclasses'] = array( $opts['delete_userclasses'] = array(
'label' => EPL_ADLAN_78, 'label' => EPL_ADLAN_78,
'preview' => $userclasses, 'preview' => $userclasses,
@@ -994,14 +996,14 @@ class pluginManager{
$med = e107::getMedia(); $med = e107::getMedia();
$icons = $med->listIcons(e_PLUGIN.$plug['plugin_path']); $icons = $med->listIcons(e_PLUGIN.$plug['plugin_path']);
if(count($icons)>0) if(count($icons)>0)
{ {
foreach($icons as $key=>$val) foreach($icons as $key=>$val)
{ {
$iconText .= "<img src='".$tp->replaceConstants($val)."' alt='' />"; $iconText .= "<img src='".$tp->replaceConstants($val)."' alt='' />";
} }
$opts['delete_ipool'] = array( $opts['delete_ipool'] = array(
'label' =>'Remove icons from Media-Manager', 'label' =>'Remove icons from Media-Manager',
'preview' => $iconText, 'preview' => $iconText,
@@ -1010,16 +1012,16 @@ class pluginManager{
'itemDefault' => 1 'itemDefault' => 1
); );
} }
if(is_readable(e_PLUGIN.$plug['plugin_path']."/".$plug['plugin_path']."_setup.php")) if(is_readable(e_PLUGIN.$plug['plugin_path']."/".$plug['plugin_path']."_setup.php"))
{ {
include_once(e_PLUGIN.$plug['plugin_path']."/".$plug['plugin_path']."_setup.php"); include_once(e_PLUGIN.$plug['plugin_path']."/".$plug['plugin_path']."_setup.php");
$mes->add("Loading ".e_PLUGIN.$plug['plugin_path']."/".$plug['plugin_path']."_setup.php", E_MESSAGE_DEBUG); $mes->add("Loading ".e_PLUGIN.$plug['plugin_path']."/".$plug['plugin_path']."_setup.php", E_MESSAGE_DEBUG);
$class_name = $plug['plugin_path']."_setup"; $class_name = $plug['plugin_path']."_setup";
if(class_exists($class_name)) if(class_exists($class_name))
{ {
$obj = new $class_name; $obj = new $class_name;
@@ -1030,11 +1032,11 @@ class pluginManager{
{ {
$newkey = $plug['plugin_path']."_".$key; $newkey = $plug['plugin_path']."_".$key;
$opts[$newkey] = $val; $opts[$newkey] = $val;
} }
} }
} }
} }
foreach($opts as $key=>$val) foreach($opts as $key=>$val)
{ {
$text .= "<tr>\n<td class='top'>".$tp->toHTML($val['label'],FALSE,'TITLE'); $text .= "<tr>\n<td class='top'>".$tp->toHTML($val['label'],FALSE,'TITLE');
@@ -1043,7 +1045,7 @@ class pluginManager{
$text .= varset($val['helpText']) ? "<div class='field-help'>".$val['helpText']."</div>" : ""; $text .= varset($val['helpText']) ? "<div class='field-help'>".$val['helpText']."</div>" : "";
$text .= "</td>\n</tr>\n"; $text .= "</td>\n</tr>\n";
} }
$text .="<tr> $text .="<tr>
<td>".EPL_ADLAN_59."</td> <td>".EPL_ADLAN_59."</td>

File diff suppressed because it is too large Load Diff