Minahito
minah****@users*****
2005年 12月 16日 (金) 18:52:31 JST
Index: xoops2jp/html/modules/base/admin/class/DeactiveModuleHandler.class.php diff -u /dev/null xoops2jp/html/modules/base/admin/class/DeactiveModuleHandler.class.php:1.1.2.1 --- /dev/null Fri Dec 16 18:52:31 2005 +++ xoops2jp/html/modules/base/admin/class/DeactiveModuleHandler.class.php Fri Dec 16 18:52:31 2005 @@ -0,0 +1,77 @@ +<?php +/** + * @version + */ + +/** + */ +class Legacy_DeactiveModuleHandler extends XoopsObjectHandler +{ + var $_mXoopsModules = array(); + + var $mModHandler = null; + + /** + * readonly property + */ + var $_mExclusions = array(".", "..", "CVS"); + + function Legacy_DeactiveModuleHandler(&$db) + { + } + + /** + * Once, load module objects to a member property from XOOPS_MODULE_PATH. + */ + function _setupObjects() + { + if (count($this->_mXoopsModules) == 0) { + if ($handler = opendir(XOOPS_MODULE_PATH)) { + while (($dir = readdir($handler)) !== false) { + if (!in_array($dir, $this->_mExclusions) && is_dir(XOOPS_MODULE_PATH . "/" . $dir)) { + $module =& $this->get($dir); + if ($module !== false) { + $this->_mXoopsModules[] =& $module; + unset($module); + } + } + } + } + } + } + + /** + * Return module object by $dirname that is specified module directory. + * If specified module has been installed, not return it. + * @param $dirname string + * @param XoopsModule or false + */ + function &get($dirname) + { + $ret=false; + + $moduleHandler =& xoops_gethandler('module'); + + $check =& $moduleHandler->getByDirname($dirname); + if (is_object($check)) { + return $ret; + } + + $module =& $moduleHandler->create(); + $module->loadInfoAsVar($dirname); + + return $module; + } + + function &getObjects($criteria=null) + { + $ret =& $this->_setupObjects(); + + // + // ????????? + // + return $this->_mXoopsModules; + } +} + +?>