[xoops-cvslog 1511] CVS update: xoops2jp/html/modules/base/admin/class

アーカイブの一覧に戻る

Minahito minah****@users*****
2005年 12月 30日 (金) 17:23:24 JST


Index: xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php
diff -u xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.5 xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.6
--- xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.5	Thu Dec 29 16:25:13 2005
+++ xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php	Fri Dec 30 17:23:24 2005
@@ -50,7 +50,7 @@
 			$adminPerm->setVar('gperm_name', 'module_admin');
 
 			if (!$gpermHandler->insert($adminPerm)) {
-				$log->addWarn("Could not set admin permission " . $tplfile->getVar('bid'));
+				$log->addError("Could not set admin permission " . $this->mModule->getVar('mid'));
 			}
 
 			//
@@ -59,8 +59,8 @@
 			$readPerm =& $this->_createPermission();
 			$readPerm->setVar('gperm_name', 'module_read');
 
-			if (!$gpermHandler->insert($adminPerm)) {
-				$log->addWarn("Could not set read permission " . $tplfile->getVar('bid'));
+			if (!$gpermHandler->insert($readPerm)) {
+				$log->addError("Could not set read permission " . $this->mModule->getVar('mid'));
 			}
 		}
 	}
@@ -120,6 +120,20 @@
 	{
 		Legacy_ModuleUtils::insertAllConfigs($this->mModule, $this->mLog);
 	}
+	
+	function _processScript()
+	{
+		$installScript = trim($this->mModule->getInfo('onInstall'));
+		if ($installScript != false) {
+			require_once XOOPS_MODULE_PATH . "/" . $this->mModule->getVar('dirname') . "/" . $installScript;
+			$funcName = 'xoops_module_install_' . $this->mModule->getVar('dirname');
+			if (function_exists($funcName)) {
+				if (!call_user_func($funcName, $this->mModule)) {
+					$this->mLog->addError("Failed to execute " . $funcName);
+				}
+			}
+		}
+	}
 
 	function hasAgree()
 	{
Index: xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php
diff -u xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php:1.1.2.5 xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php:1.1.2.6
--- xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php:1.1.2.5	Wed Dec 28 23:16:48 2005
+++ xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php	Fri Dec 30 17:23:24 2005
@@ -120,6 +120,20 @@
 	{
 		Legacy_ModuleUtils::deleteAllConfigs($this->mModule, $this->mLog);
 	}
+
+	function _processScript()
+	{
+		$installScript = trim($this->mModule->getInfo('onUninstall'));
+		if ($installScript != false) {
+			require_once XOOPS_MODULE_PATH . "/" . $this->mModule->getVar('dirname') . "/" . $installScript;
+			$funcName = 'xoops_module_uninstall_' . $this->mModule->getVar('dirname');
+			if (function_exists($funcName)) {
+				if (!call_user_func($funcName, $this->mModule)) {
+					$this->mLog->addError("Failed to execute " . $funcName);
+				}
+			}
+		}
+	}
 }
 
 ?>
\ No newline at end of file
Index: xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php
diff -u xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php:1.1.2.2 xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php:1.1.2.3
--- xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php:1.1.2.2	Wed Dec 28 23:16:48 2005
+++ xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php	Fri Dec 30 17:23:24 2005
@@ -4,6 +4,8 @@
 
 class Legacy_ModuleUpdater extends Legacy_AbstractModuleInstaller
 {
+	var $mPreVersion = 0;
+
 	/**
 	 * @return bool
 	 */
@@ -31,6 +33,8 @@
 		if (!is_object($module))
 			return $ret;
 
+		$this->mPreVersion = $module->getVar('version');
+
 		$module->loadInfoAsVar($dirname);
 		
 		return $module;
@@ -171,6 +175,20 @@
 		Legacy_ModuleUtils::deleteAllConfigs($this->mModule, $this->mLog);
 		Legacy_ModuleUtils::insertAllConfigs($this->mModule, $this->mLog);
 	}
+
+	function _processScript()
+	{
+		$installScript = trim($this->mModule->getInfo('onUpdate'));
+		if ($installScript != false) {
+			require_once XOOPS_MODULE_PATH . "/" . $this->mModule->getVar('dirname') . "/" . $installScript;
+			$funcName = 'xoops_module_update_' . $this->mModule->getVar('dirname');
+			if (function_exists($funcName)) {
+				if (!call_user_func($funcName, $this->mModule, $this->mPreVersion)) {
+					$this->mLog->addError("Failed to execute " . $funcName);
+				}
+			}
+		}
+	}
 }
 
 ?>
\ No newline at end of file
Index: xoops2jp/html/modules/base/admin/class/AbstractModuleInstaller.class.php
diff -u xoops2jp/html/modules/base/admin/class/AbstractModuleInstaller.class.php:1.1.2.4 xoops2jp/html/modules/base/admin/class/AbstractModuleInstaller.class.php:1.1.2.5
--- xoops2jp/html/modules/base/admin/class/AbstractModuleInstaller.class.php:1.1.2.4	Thu Dec 29 16:25:13 2005
+++ xoops2jp/html/modules/base/admin/class/AbstractModuleInstaller.class.php	Fri Dec 30 17:23:24 2005
@@ -61,6 +61,8 @@
 		$this->_installPreference();
 		if (!$this->mForceMode && $this->mLog->hasError())
 			return false;
+		
+		$this->_processScript();
 
 		return true;
 	}
@@ -114,6 +116,10 @@
 	function _installPreference()
 	{
 	}
+
+	function _processScript()
+	{
+	}
 	
 	/**
 	 * If set true, this class may never stop for error.


xoops-cvslog メーリングリストの案内
アーカイブの一覧に戻る