Legacy_ModuleInstallActionにカスタムインストーラについてのコメントがあったので和訳しておきます。
/**
*
* @brief Module Install function having possibility to extend by module developers.
*
* The precondition is that the specified module has been not installed.
*
* @section cinstall The custom-installer
*
* Module developers can use their own custom-installer in this action. Unlike
* the module update function, the standard installer in this action is perhaps
* no problems. But, duplicatable modules or some modules with the special
* framework may need the custom-installer.
*
* @subsection convention Convention
*
* See Legacy_ModuleInstallAction::_getInstaller().
*
* \li $modversion['legacy_installer']['installer']['class'] = {classname};
* \li $modversion['legacy_installer']['installer']['namespace'] = {namespace}; (Optional)
* \li $modversion['legacy_installer']['installer']['filepath'] = {filepath}; (Optional)
*
* You must declare your sub-class of Legacy_ModuleInstaller as
* {namespace}_{classname} in {filepath}. You must specify classname. Others
* are decided by the naming convention without your descriptions. Namespace
* is ucfirst(dirname). Filepath is "admin/class/{classname}.class.php".
*
* For example, "news" module.
*
* $modversion['legacy_installer']['installer']['class'] = "Installer";
*
* You must declare News_Installer in XOOPS_ROOT_PATH . "/modules/news/admin/class/Installerr.class.php".
*
* In the case where you specify the filepath, take care you describe the
* filepath with absolute path.
*
* @subsection process Install Process
*
* \li Gets a instance of the installer class through Legacy_ModuleInstallAction::_getInstaller().
* \li Sets the new XoopsModule built from xoops_version, to the instance.
* \li Sets a value indicating whether an administrator hopes the force-mode, to the instance.
* \li Calls executeInstall().
*
* @see Legacy_ModuleInstallAction::_getInstaller()
* @see Legacy_ModuleInstaller
* @see Legacy_ModuleInstallUtils
*
* @todo These classes are good to abstract again.
*/
モジュールインストール用関数はモジュール開発者が拡張可能である。
特定のモジュールがインストール前であることが前提となる。
カスタムインストーラについて
このアクションにおいて、モジュール開発者は自分個人のカスタムインストーラを使用できる。
モジュールアップデートの関数とは異なり、普通のモジュールはこのアクションの通常のインストーラでおそらく問題ないだろう。
しかし、複製可能なモジュールや特殊なフレームワークを持ったモジュールはカスタムインストーラが必要になるかもしれない。
コーディング規約
Legacy_ModuleInstallAction::_getInstaller()を参照せよ。
・$modversion['legacy_installer']['installer']['class'] = {classname};
・$modversion['legacy_installer']['installer']['namespace'] = {namespace}; (任意)
・$modversion['legacy_installer']['installer']['filepath'] = {filepath}; (任意)
Legacy_ModuleInstallerのサブクラスの{namespace}_{classname}というクラスとして{filepath}において宣言されなければならない。
classnameを明示する必要がある。他は特に記述されない限り、命名規約によって決められる。
namespaceはucfirst(dirname)になる。filepathは"admin/class/{classname}.class.php"になる。
たとえば、newsモジュールの場合、
$modversion['legacy_installer']['installer']['class'] = "Installer";
XOOPS_ROOT_PATH . "/modules/news/admin/class/Installerr.class.php"においてNews_Installerが宣言されなければならない。
filepathを明示する場合、filepathは絶対パスであることに留意せよ。
インストールの過程
・Legacy_ModuleInstallAction::_getInstaller()を通じてインストーラのクラスのインスタンスを取得する。
・xoops_versionから作られたnew XoopsModuleをインスタンスにセットする。
・管理者が強制モード(force-mode)を望むかどうかを指す値をインスタンスにセットする。
・executeInstall()を呼び出す。
Legacy_ModuleInstallAction::_getInstaller()を参照せよ。
Legacy_ModuleInstallerを参照せよ。
Legacy_ModuleInstallUtilsを参照せよ。
トラバURL : http://suin.asia/trackback/69
氷川 XOOPS Module 開発室