1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Refine installation from plugin.xml a bit

This commit is contained in:
e107steved
2008-08-11 20:21:17 +00:00
parent 526ec11746
commit fc4f530359
3 changed files with 30 additions and 20 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
| $Revision: 1.16 $ | $Revision: 1.17 $
| $Date: 2008-05-25 09:04:16 $ | $Date: 2008-08-11 20:21:08 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -276,9 +276,16 @@ if ($action == 'uninstall')
if ($action == 'install') if ($action == 'install')
{ {
$text = $plugin->install_plugin($id); $text = $plugin->install_plugin($id);
$plugin ->save_addon_prefs(); if ($text === FALSE)
{ // Tidy this up
$ns->tablerender(LAN_INSTALL_FAIL, "Error messages above this line");
}
else
{
$plugin ->save_addon_prefs();
// if($eplug_conffile){ $text .= "&nbsp;<a href='".e_PLUGIN."$eplug_folder/$eplug_conffile'>[".LAN_CONFIGURE."]</a>"; } // if($eplug_conffile){ $text .= "&nbsp;<a href='".e_PLUGIN."$eplug_folder/$eplug_conffile'>[".LAN_CONFIGURE."]</a>"; }
$ns->tablerender(EPL_ADLAN_33, $text); $ns->tablerender(EPL_ADLAN_33, $text);
}
} }
if ($action == 'upgrade') if ($action == 'upgrade')

View File

@@ -11,12 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.41 $ | $Revision: 1.42 $
| $Date: 2008-08-10 16:06:15 $ | $Date: 2008-08-11 20:21:08 $
| $Author: e107steved $ | $Author: e107steved $
Mods for extra plugin.xml variables
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -365,13 +362,17 @@ class e107plugin
// Update prefs array according to $action // Update prefs array according to $action
// $prefType specifies the storage type - may be 'pref', 'listPref' or 'arrayPref' // $prefType specifies the storage type - may be 'pref', 'listPref' or 'arrayPref'
function manage_prefs($action, $var, $prefType = 'pref', $path = '') function manage_prefs($action, $var, $prefType = 'pref', $path = '', $unEscape = FALSE)
{ {
global $pref; global $pref;
if (!is_array($var)) return; if (!is_array($var)) return;
if (($prefType == 'arrayPref') && ($path == '')) return; if (($prefType == 'arrayPref') && ($path == '')) return;
foreach($var as $k => $v) foreach($var as $k => $v)
{ {
if ($unEscape)
{
$v = str_replace(array('\{','\}'),array('{','}'),$v);
}
switch ($prefType) switch ($prefType)
{ {
case 'pref' : case 'pref' :
@@ -714,10 +715,10 @@ class e107plugin
{ {
if (isset($dv['@attributes']) && isset($dv['@attributes']['name'])) if (isset($dv['@attributes']) && isset($dv['@attributes']['name']))
{ {
// echo "Check {$dt} dependency: {$dv['@attributes']['name']} version {$dv['@attributes']['min_version']}<br />";
switch ($dt) switch ($dt)
{ {
case 'plugin' : case 'plugin' :
// echo "Check plugin dependency: {$dv['@attributes']['name']} version {$dv['@attributes']['min_version']}<br />";
if (!isset($pref['plug_installed'][$dv['@attributes']['name']])) if (!isset($pref['plug_installed'][$dv['@attributes']['name']]))
{ // Plugin not installed { // Plugin not installed
$canContinue = FALSE; $canContinue = FALSE;
@@ -765,7 +766,7 @@ class e107plugin
// Temporary error handling - need to do something with this // Temporary error handling - need to do something with this
if (!$canContinue) if (!$canContinue)
{ {
echo implode('<br />',$error); echo '<b>'.LAN_INSTALL_FAIL.'</b><br />'.implode('<br />',$error);
return false; return false;
} }
@@ -860,21 +861,21 @@ class e107plugin
if(is_array($list['active'])) if(is_array($list['active']))
{ {
$txt .= "Adding {$prefType} prefs ".print_a($list['active'], true)."<br />"; $txt .= "Adding {$prefType} prefs ".print_a($list['active'], true)."<br />";
$this->manage_prefs('add', $list['active'], $prefType, $plug['plugin_path']); $this->manage_prefs('add', $list['active'], $prefType, $plug['plugin_path'], TRUE);
} }
break; break;
case 'upgrade': case 'upgrade':
if(is_array($list['active'])) if(is_array($list['active']))
{ {
$txt .= "Updating {$prefType} prefs ".print_a($list['active'], true)."<br />"; $txt .= "Updating {$prefType} prefs ".print_a($list['active'], true)."<br />";
$this->manage_prefs('update', $list['active'], $prefType, $plug['plugin_path']); // This only adds prefs which aren't already defined $this->manage_prefs('update', $list['active'], $prefType, $plug['plugin_path'], TRUE); // This only adds prefs which aren't already defined
} }
//If upgrading, removing any inactive pref //If upgrading, removing any inactive pref
if(is_array($list['inactive'])) if(is_array($list['inactive']))
{ {
$txt .= "Removing {$prefType} prefs ".print_a($list['inactive'], true)."<br />"; $txt .= "Removing {$prefType} prefs ".print_a($list['inactive'], true)."<br />";
$this->manage_prefs('remove', $list['inactive'], $prefType, $plug['plugin_path']); $this->manage_prefs('remove', $list['inactive'], $prefType, $plug['plugin_path'], TRUE);
} }
break; break;
@@ -883,7 +884,7 @@ class e107plugin
if(is_array($list['all'])) if(is_array($list['all']))
{ {
$txt .= "Removing {$prefType} prefs ".print_a($list['all'], true)."<br />"; $txt .= "Removing {$prefType} prefs ".print_a($list['all'], true)."<br />";
$this->manage_prefs('remove', $list['all'], $prefType, $plug['plugin_path']); $this->manage_prefs('remove', $list['all'], $prefType, $plug['plugin_path'], TRUE);
} }
break; break;
} }
@@ -949,6 +950,7 @@ class e107plugin
case 'upgrade' : case 'upgrade' :
$pref['upgradeCheck'][$plug['plugin_path']]['url'] = $tmp['@attributes']['url']; $pref['upgradeCheck'][$plug['plugin_path']]['url'] = $tmp['@attributes']['url'];
$pref['upgradeCheck'][$plug['plugin_path']]['method'] = varset($tmp['@attributes']['method'],'sf_news'); $pref['upgradeCheck'][$plug['plugin_path']]['method'] = varset($tmp['@attributes']['method'],'sf_news');
$pref['upgradeCheck'][$plug['plugin_path']]['id'] = varset($tmp['@attributes']['id'],$plug['plugin_path']);
break; break;
case 'uninstall' : case 'uninstall' :
unset($pref['upgradeCheck'][$plug['plugin_path']]); unset($pref['upgradeCheck'][$plug['plugin_path']]);

View File

@@ -4,8 +4,8 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_plugin.php,v $ | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_plugin.php,v $
| $Revision: 1.5 $ | $Revision: 1.6 $
| $Date: 2008-08-09 16:49:58 $ | $Date: 2008-08-11 20:21:17 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -99,8 +99,9 @@ define ('EPL_ADLAN_79','');
define ('EPL_ADLAN_80',''); define ('EPL_ADLAN_80','');
define("LAN_UPGRADE_SUCCESSFUL", "Upgrade Successful"); define('LAN_UPGRADE_SUCCESSFUL', 'Upgrade Successful');
define("LAN_INSTALL_SUCCESSFUL", "Installation Successful"); define('LAN_INSTALL_SUCCESSFUL', 'Installation Successful');
define('LAN_INSTALL_FAIL', 'Installation Failed');
?> ?>