XOOPS Cube Legacy base repository
修订版 | 6ebaff06c1a7ca7e27d028c51a495e5b11275724 (tree) |
---|---|
时间 | 2011-11-21 23:06:39 |
作者 | nbuy <nbuy@704c...> |
Commiter | nbuy |
add Module config loading flag for speedup
git-svn-id: https://xoopscube.svn.sourceforge.net/svnroot/xoopscube/Package_Legacy/trunk@1060 704cf05f-ae62-4b0e-a484-234ee0250e75
@@ -101,9 +101,9 @@ class Legacy_AdminSideMenu extends Legacy_AbstractBlockProcedure | ||
101 | 101 | |
102 | 102 | $handler =& xoops_gethandler('module'); |
103 | 103 | |
104 | - while($row = $db->fetchArray($result)) { | |
105 | - $xoopsModule =& $handler->get($row['mid']); | |
106 | - $module =& Legacy_Utils::createModule($xoopsModule); | |
104 | + while(list($mid) = $db->fetchRow($result)) { | |
105 | + $xoopsModule = & $handler->get($mid); | |
106 | + $module =& Legacy_Utils::createModule($xoopsModule, false); | |
107 | 107 | |
108 | 108 | $this->mModules[] =& $module; |
109 | 109 | unset($module); |
@@ -54,14 +54,14 @@ class Legacy_Utils | ||
54 | 54 | * @param XoopsModule $module |
55 | 55 | * @return Legacy_Module |
56 | 56 | */ |
57 | - function &createModule($module) | |
57 | + function &createModule($module, $loadConfig=true) | |
58 | 58 | { |
59 | 59 | $instance = null; |
60 | 60 | |
61 | 61 | // |
62 | 62 | // TODO need cache here? |
63 | 63 | // |
64 | - XCube_DelegateUtils::call('Legacy_Utils.CreateModule', new XCube_Ref($instance), $module); | |
64 | + XCube_DelegateUtils::call('Legacy_Utils.CreateModule', new XCube_Ref($instance), $module, $loadConfig); | |
65 | 65 | |
66 | 66 | if (is_object($instance) && is_a($instance, 'Legacy_AbstractModule')) { |
67 | 67 | return $instance; |
@@ -81,10 +81,10 @@ class Legacy_Utils | ||
81 | 81 | } |
82 | 82 | |
83 | 83 | if (XC_CLASS_EXISTS($className)) { |
84 | - $instance = new $className($module); | |
84 | + $instance = new $className($module, $loadConfig); | |
85 | 85 | } |
86 | 86 | else { |
87 | - $instance = new Legacy_ModuleAdapter($module); | |
87 | + $instance = new Legacy_ModuleAdapter($module, $loadConfig); | |
88 | 88 | } |
89 | 89 | |
90 | 90 | return $instance; |
@@ -71,11 +71,11 @@ class Legacy_AbstractModule | ||
71 | 71 | * Basically, only Legacy_Controller and its utility functions should call the |
72 | 72 | * constructor. |
73 | 73 | */ |
74 | - function Legacy_AbstractModule(&$module) | |
74 | + function Legacy_AbstractModule(&$module, $loadConfig=true) | |
75 | 75 | { |
76 | 76 | $this->setXoopsModule($module); |
77 | 77 | |
78 | - if ($module->get('hasconfig') == 1 || $module->get('hascomments') == 1 || $module->get('hasnotification') == 1) { | |
78 | + if ($loadConfig && ($module->get('hasconfig') == 1 || $module->get('hascomments') == 1 || $module->get('hasnotification') == 1)) { | |
79 | 79 | $handler =& xoops_gethandler('config'); |
80 | 80 | $this->setModuleConfig($handler->getConfigsByCat(0, $module->get('mid'))); |
81 | 81 | } |
@@ -399,9 +399,9 @@ class Legacy_ModuleAdapter extends Legacy_AbstractModule | ||
399 | 399 | */ |
400 | 400 | var $mAdminMenu = null; |
401 | 401 | |
402 | - function Legacy_ModuleAdapter($module) | |
402 | + function Legacy_ModuleAdapter($module, $loadConfig=true) | |
403 | 403 | { |
404 | - parent::Legacy_AbstractModule($module); | |
404 | + parent::Legacy_AbstractModule($module, $loadConfig); | |
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
@@ -606,7 +606,7 @@ class Legacy_ModuleAdapter extends Legacy_AbstractModule | ||
606 | 606 | return $this->mAdminMenu; |
607 | 607 | } |
608 | 608 | |
609 | - $dmy =& $this->mXoopsModule->getInfo(); | |
609 | + $info =& $this->mXoopsModule->getInfo(); | |
610 | 610 | $root =& XCube_Root::getSingleton(); |
611 | 611 | |
612 | 612 | // |
@@ -614,8 +614,8 @@ class Legacy_ModuleAdapter extends Legacy_AbstractModule | ||
614 | 614 | // |
615 | 615 | $this->mXoopsModule->loadAdminMenu(); |
616 | 616 | if ($this->mXoopsModule->get('hasnotification') |
617 | - || ($this->mXoopsModule->getInfo('config') && is_array($this->mXoopsModule->getInfo('config'))) | |
618 | - || ($this->mXoopsModule->getInfo('comments') && is_array($this->mXoopsModule->getInfo('comments')))) { | |
617 | + || ($info['config'] && is_array($info['config'])) | |
618 | + || ($info['comments'] && is_array($info['comments']))) { | |
619 | 619 | $this->mXoopsModule->adminmenu[] = array( |
620 | 620 | 'link' => $root->mController->getPreferenceEditUrl($this->mXoopsModule), |
621 | 621 | 'title' => _PREFERENCES, |
@@ -631,9 +631,10 @@ class Legacy_ModuleAdapter extends Legacy_AbstractModule | ||
631 | 631 | $this->_mAdminMenuLoadedFlag = true; |
632 | 632 | |
633 | 633 | if ($this->mXoopsModule->adminmenu) { |
634 | + $dirname = $this->mXoopsModule->get('dirname'); | |
634 | 635 | foreach ($this->mXoopsModule->adminmenu as $menu) { |
635 | 636 | if (!isset($menu['absolute']) || (isset($menu['absolute']) && $menu['absolute'] != true)) { |
636 | - $menu['link'] = XOOPS_MODULE_URL . '/' . $this->mXoopsModule->get('dirname') . '/' . $menu['link']; | |
637 | + $menu['link'] = XOOPS_MODULE_URL . '/' . $dirname . '/' . $menu['link']; | |
637 | 638 | } |
638 | 639 | $this->mAdminMenu[] = $menu; |
639 | 640 | } |