返信する: ぶろぐコメント

対象モジュール なーお'nぶろぐ
件名 [xoops] フォーラムモジュ-ル「xcforum」製作開始
要旨 d3forumの後継フォーラム・掲示板モジュール、「xcforum」を作り始めました。 自分にはかなーりハードルが高いのですが、 facebookのグループで色々相談しながらできそうなんで、もしかしたらできるかも。  facebook内の当該スレ  それに、「factory」という、モジュール自動生成サイトがるのでこれを利用します。 で、今後の参考になるかもしれないので、できるだけメモを残しておきます。 ...


オプション

参照

Re: [xoops] フォーラムモジュ-ル「xcforum」製作開始
投稿者: なーお 投稿日時: 2012/3/11 13:19

factoryが生成するモジュールinstallコードで、notificationがインストールされない問題が発覚したので、 その解決までをメモっておきます。

html/modules/legacy/admin/class/ModuleInstallInformation.class.php の
function _loadNotificationPreferenceInfomations(&$modversion, &$collection)
内の頭に atrace();をしてみたところ、

従来モジュール (GNAViの例)

Everything is expanded.Everything is shortened.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 
 
 
 
 
 
 
 
 
 
 
 
#0 /html**/modules/legacy/admin/class/ModuleInstallInformation.class.php(658): atrace()
#1 /html**/modules/legacy/admin/class/ModuleInstallInformation.class.php(784): Legacy_ModinfoX2FileReader->_loadNotificationPreferenceInfomations(Array, Object(Legacy_PreferenceInfoCollection))
#2 /html**/modules/legacy/admin/class/ModuleInstallUtils.class.php(722): Legacy_ModinfoX2FileReader->loadPreferenceInformations()
#3 /html**/modules/legacy/admin/class/ModuleInstaller.class.php(188): Legacy_ModuleInstallUtils->installAllOfConfigs(Object(XoopsModule), Object(Legacy_ModuleInstallLog))
#4 /html**/modules/legacy/admin/class/ModuleInstaller.class.php(254): Legacy_ModuleInstaller->_installPreferences()
#5 /html**/modules/legacy/admin/actions/ModuleInstallAction.class.php(170): Legacy_ModuleInstaller->executeInstall()
#6 /html**/modules/legacy/class/ActionFrame.class.php(153): Legacy_ModuleInstallAction->execute(Object(Legacy_Controller), Object(XoopsUser))
#7 [internal function]: Legacy_ActionFrame->execute(Object(Legacy_Controller))
#8 /html**/core/XCube_Delegate.class.php(356): call_user_func_array(Array, Array)
#9 /html**/core/XCube_Controller.class.php(216): XCube_Delegate->call(Object(XCube_Ref))
#10 /html**/modules/legacy/admin/index.php(24): XCube_Controller->execute()
#11 {main}

factory生成モジュール(xcforumの例)

Everything is expanded.Everything is shortened.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 
 
 
 
 
 
 
 
 
 
 
 
#0 /html**/modules/legacy/admin/class/ModuleInstallInformation.class.php(658): atrace()
#1 /html**/modules/legacy/admin/class/ModuleInstallInformation.class.php(784): Legacy_ModinfoX2FileReader->_loadNotificationPreferenceInfomations(Array, Object(Legacy_PreferenceInfoCollection))
#2 /html**/modules/xcforum/admin/class/installer/XcforumInstallUtils.class.php(872): Legacy_ModinfoX2FileReader->loadPreferenceInformations()
#3 /trust**/modules/xcforum/admin/class/installer/XcforumInstaller.class.php(198): Xcforum_InstallUtils::installAllOfConfigs(Object(XoopsModule), Object(Legacy_ModuleInstallLog))
#4 /trust**/modules/xcforum/admin/class/installer/XcforumInstaller.class.php(276): Xcforum_Installer->_installPreferences()
#5 /html**/modules/legacy/admin/actions/ModuleInstallAction.class.php(170): Xcforum_Installer->executeInstall()
#6 /html**/modules/legacy/class/ActionFrame.class.php(153): Legacy_ModuleInstallAction->execute(Object(Legacy_Controller), Object(XoopsUser))
#7 [internal function]: Legacy_ActionFrame->execute(Object(Legacy_Controller))
#8 /html**/core/XCube_Delegate.class.php(356): call_user_func_array(Array, Array)
#9 /html**/core/XCube_Controller.class.php(216): XCube_Delegate->call(Object(XCube_Ref))
#10 /html**/modules/legacy/admin/index.php(24): XCube_Controller->execute()
#11 {main}

ということで、どうやらXcforumInstaller.class.phpが怪しい。

Xcforum_InstallUtils.class.php の 「public static function installAllOfConfigs」の内容を そっくりそのまま、Legacy_ModuleInstallUtils 内の同メソッドを上書きしてみたら、無事にnotificationもインストールできた。 :-)

867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
    public static function installAllOfConfigs(/*** XoopsModule ***/ &$module,/*** Legacy_ModuleInstallLog ***/ &$log)
    {
        $dirname = $module->get('dirname');
 
        $fileReader =new Legacy_ModinfoX2FileReader($dirname);
        $preferences =& $fileReader->loadPreferenceInformations();
 
        //
        // Preferences
        //
        foreach (array_keys($preferences->mPreferences) as $idx) {
            Legacy_ModuleInstallUtils::installPreferenceByInfo($preferences->mPreferences[$idx], $module, $log);
        }
 
        //
        // Comments
        //
        foreach (array_keys($preferences->mComments) as $idx) {
            Legacy_ModuleInstallUtils::installPreferenceByInfo($preferences->mComments[$idx], $module, $log);
        }
 
        //
        // Notifications
        //
        foreach (array_keys($preferences->mNotifications) as $idx) {
            Legacy_ModuleInstallUtils::installPreferenceByInfo($preferences->mNotifications[$idx], $module, $log);
        }
    }

factoryに書かれたコードが、XCL2.2のLegacyモジュールの変更に追い付いていなかったのかな? :roll: