예제 #1
0
 function _processScript()
 {
     $installScript = trim($this->_mXoopsModule->getInfo('onInstall'));
     if ($installScript != false) {
         require_once XOOPS_MODULE_PATH . "/" . $this->_mXoopsModule->get('dirname') . "/" . $installScript;
         $funcName = 'xoops_module_install_' . $this->_mXoopsModule->get('dirname');
         if (!preg_match("/^[a-zA-Z_][a-zA-Z0-9_]*\$/", $funcName)) {
             $this->mLog->addError(XCUbe_Utils::formatMessage(_AD_LEGACY_ERROR_FAILED_TO_EXECUTE_CALLBACK, $funcName));
             return;
         }
         if (function_exists($funcName)) {
             // Because X2 can use reference parameter, Legacy doesn't use the following code;'
             // if (!call_user_func($funcName, $this->_mXoopsModule)) {
             $result = $funcName($this->_mXoopsModule, new XCube_Ref($this->mLog));
             if (!$result) {
                 $this->mLog->addError(XCUbe_Utils::formatMessage(_AD_LEGACY_ERROR_FAILED_TO_EXECUTE_CALLBACK, $funcName));
             }
         }
     }
 }
예제 #2
0
 function _processScript()
 {
     $installScript = trim($this->_mXoopsModule->getInfo('onUninstall'));
     if ($installScript != false) {
         require_once XOOPS_MODULE_PATH . "/" . $this->_mXoopsModule->get('dirname') . "/" . $installScript;
         $funcName = 'xoops_module_uninstall_' . $this->_mXoopsModule->get('dirname');
         if (!preg_match("/^[a-zA-Z_][a-zA-Z0-9_]*\$/", $funcName)) {
             $this->mLog->addError(XCUbe_Utils::formatMessage(_AD_LEGACY_ERROR_FAILED_TO_EXECUTE_CALLBACK, $funcName));
             return;
         }
         if (function_exists($funcName)) {
             if (!call_user_func($funcName, $this->_mXoopsModule, new XCube_Ref($this->mLog))) {
                 $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_FAILED_TO_EXECUTE_CALLBACK, $funcName));
             }
         }
     }
 }