1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Slight modification to the *_setup.php spec.

This commit is contained in:
CaMer0n
2009-10-21 12:53:00 +00:00
parent 8f89377fbb
commit f6b378ebd4
6 changed files with 36 additions and 60 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_handlers/plugin_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.102 $ | $Revision: 1.103 $
| $Date: 2009-10-20 03:49:12 $ | $Date: 2009-10-21 12:52:53 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -1508,12 +1508,18 @@ class e107plugin
/**
*
* @param object $path [unused]
* @param object $what install|uninstall|upgrade
* @param object $when pre|post
* @return
*/
function execute_function($path = '', $what='', $when='') function execute_function($path = '', $what='', $when='')
{ {
$emessage = eMessage::getInstance(); $emessage = eMessage::getInstance();
$class_name = $this->plugFolder."_setup"; $class_name = $this->plugFolder."_setup";
$method_name = $this->plugFolder."_".$what."_".$when; $method_name = $what."_".$when;
if(varset($this->plug_vars['@attributes']['setupFile'])) if(varset($this->plug_vars['@attributes']['setupFile']))
{ {
@@ -1555,36 +1561,6 @@ class e107plugin
} }
$emessage->add("Setup function <b>".$method_name."()</b> NOT found.", E_MESSAGE_DEBUG); $emessage->add("Setup function <b>".$method_name."()</b> NOT found.", E_MESSAGE_DEBUG);
return FALSE;
// deprecated 0.8 method below. Can safely be removed.
if($what == '' || $when == '') { return true; }
if(!isset($this->plug_vars['management'][$what])) { return true; }
$vars = $this->plug_vars['management'][$what];
if(count($vars) <= 1) { $vars = array($vars); }
foreach($vars as $var)
{
$attrib = varset($var['@attributes']);
if(isset($attrib['when']) && $attrib['when'] == $when)
{
if(is_readable($path.$attrib['file']))
{
include_once($path.$attrib['file']);
if($attrib['type'] == 'fileFunction')
{
$result = call_user_func($attrib['function'], $this);
return $result;
}
elseif($attrib['type'] == 'classFunction')
{
$_tmp = new $attrib['class'];
$result = call_user_func(array($_tmp, $attrib['function']), $this);
return $result;
}
}
}
}
return FALSE; // IMPORTANT. return FALSE; // IMPORTANT.
} }

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_plugins/calendar_menu/calendar_setup.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/calendar_setup.php,v $
| $Revision: 1.1 $ | $Revision: 1.2 $
| $Date: 2009-10-20 03:58:47 $ | $Date: 2009-10-21 12:52:59 $
| $Author: e107coders $ | $Author: e107coders $
| |
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
@@ -24,7 +24,7 @@ if (!defined('e107_INIT')) { exit; }
class calendar_menu_setup // must match folder name ie. <pluginfolder>_setup class calendar_menu_setup // must match folder name ie. <pluginfolder>_setup
{ {
function calendar_menu_install_post($param) function install_post($param)
{ {
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();
if($this->insertDefaultCategory(FALSE)) if($this->insertDefaultCategory(FALSE))
@@ -41,13 +41,13 @@ class calendar_menu_setup // must match folder name ie. <pluginfolder>_setup
} }
function calendar_menu_install_pre($param) function install_pre($param)
{ {
// echo "Calendar uninstall routine<br />"; // echo "Calendar uninstall routine<br />";
} }
function calendar_menu_upgrade_post($param) function upgrade_post($param)
{ {
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();
if($this->insertDefaultCategory(TRUE)) if($this->insertDefaultCategory(TRUE))

View File

@@ -9,36 +9,36 @@
* Custom download install/uninstall/update routines * Custom download install/uninstall/update routines
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/download/download_setup.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/download/download_setup.php,v $
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Date: 2009-10-20 03:58:47 $ * $Date: 2009-10-21 12:53:00 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
class download_setup class download_setup
{ {
function download_install_pre(&$var) function install_pre($var)
{ {
// print_a($var); // print_a($var);
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();
// $mes->add("custom install 'pre' function.", E_MESSAGE_SUCCESS); // $mes->add("custom install 'pre' function.", E_MESSAGE_SUCCESS);
} }
function download_install_post(&$var) function install_post($var)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();
// $mes->add("custom install 'post' function.", E_MESSAGE_SUCCESS); // $mes->add("custom install 'post' function.", E_MESSAGE_SUCCESS);
} }
function download_uninstall_pre(&$var) function uninstall_pre($var)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();
// $mes->add("custom uninstall 'pre' function.", E_MESSAGE_SUCCESS); // $mes->add("custom uninstall 'pre' function.", E_MESSAGE_SUCCESS);
} }
function download_upgrade_post(&$var) function upgrade_post($var)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();

View File

@@ -9,21 +9,21 @@
* Custom forum install/uninstall/update routines * Custom forum install/uninstall/update routines
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_setup.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_setup.php,v $
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Date: 2009-10-20 03:58:47 $ * $Date: 2009-10-21 12:53:00 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
class forum_setup class forum_setup
{ {
function forum_install_pre(&$var) function install_pre($var)
{ {
print_a($var); print_a($var);
echo "custom install 'pre' function<br /><br />"; echo "custom install 'pre' function<br /><br />";
} }
function forum_install_post(&$var) function install_post($var)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();
@@ -34,7 +34,7 @@ class forum_setup
} }
} }
function forum_uninstall_post(&$var) function uninstall_post($var)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();
@@ -45,7 +45,7 @@ class forum_setup
} }
} }
function forum_upgrade_post(&$var) function upgrade_post($var)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();

View File

@@ -7,8 +7,8 @@
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_setup.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_setup.php,v $
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Date: 2009-10-20 03:58:47 $ * $Date: 2009-10-21 12:53:00 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -16,7 +16,7 @@
class pm_setup class pm_setup
{ {
function pm_uninstall_post() function uninstall_post()
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$sql->db_Delete("core", "e107_name = 'pm_prefs'"); $sql->db_Delete("core", "e107_name = 'pm_prefs'");

View File

@@ -9,8 +9,8 @@
* Custom TinyMce install/uninstall/update routines * Custom TinyMce install/uninstall/update routines
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/tinymce_setup.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/tinymce_setup.php,v $
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Date: 2009-10-20 03:49:22 $ * $Date: 2009-10-21 12:53:00 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -18,13 +18,13 @@
class tinymce_setup class tinymce_setup
{ {
/* /*
function tinymce_install_pre(&$var) function install_pre($var)
{ {
// print_a($var); // print_a($var);
// echo "custom install 'pre' function<br /><br />"; // echo "custom install 'pre' function<br /><br />";
} }
*/ */
function tinymce_install_post(&$var) function install_post($var)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$mes = eMessage::getInstance(); $mes = eMessage::getInstance();
@@ -48,12 +48,12 @@ class tinymce_setup
} }
/* /*
function tinymce_uninstall_post(&$var) function uninstall_post($var)
{ {
// $sql = e107::getDb(); // $sql = e107::getDb();
} }
function tinymce_upgrade_post(&$var) function upgrade_post($var)
{ {
// $sql = e107::getDb(); // $sql = e107::getDb();
} }