帳號登錄
帳號:
密碼:
記住我 | 忘記密碼 | 帳號註冊
網站導覽
模組開發 : Xoops 安裝與反安裝
作者 elie 於 2010年08月12日 22:00:00 (4910 次閱讀)

原始出處 http://www.xoops.org/modules/mediawiki/index.php/Dev:xoops_install_uninstall

 

onInstall, onUninstall, onUpdate

模組安裝系統有個功能可以讓Xoops 核心在模組安裝或解除安裝後執行一段開發者指定的程式碼。編輯xoops_version.php:

   $modversion['onInstall'] = 'install_funcs.php';
   $modversion['onUninstall'] = 'install_funcs.php';
   $modversion['onUpdate'] = 'install_funcs.php';

在install_funcs.php:

$xoopsMod 是該模組的$XoopsModule 物件。

   function xoops_module_install_<DIRNAME>( $xoopsMod ) {
       if (everythingIsOK) {
           return true;
       } else {
           return false;
       }
   }
   function xoops_module_uninstall_<DIRNAME>( $xoopsMod ) {
       if (everythingIsOK) {
           return true;
       } else {
           return false;
       }
   }
   function xoops_module_update_<DIRNAME> ( $xoopsMod, $oldversion) {
       switch ($oldversion) { //remember that version is multiplied with 100 to get an integer
           case 100: //perform actions to upgrade from version 1.00
               break;
           case 110: //perform actions to upgrade from version 1.10
               break;
       }
   }


可列印模式 轉寄給朋友

The XOOPS organisation ("XOOPS") is committed to protecting the privacy of users of the XOOPS.org sites.
The website used Ver.2.4.5 POWERED BY XOOPS PROJECT.