Index: branches/5.2.x/core/units/modules/modules_event_handler.php =================================================================== diff -u -N -r14602 -r14699 --- branches/5.2.x/core/units/modules/modules_event_handler.php (.../modules_event_handler.php) (revision 14602) +++ branches/5.2.x/core/units/modules/modules_event_handler.php (.../modules_event_handler.php) (revision 14699) @@ -1,6 +1,6 @@ getObject(); /* @var $object kDBList */ - + if ($event->Special) { $object->addFilter('current_module', '%1$s.Name = '.$event->Special); } @@ -130,7 +130,11 @@ { parent::OnAfterListQuery($event); - $new_modules = $this->_getNewModules(); + $modules_helper =& $this->Application->recallObject('ModulesHelper'); + /* @var $modules_helper kModulesHelper */ + + $new_modules = $modules_helper->getModules(kModulesHelper::NOT_INSTALLED); + if (!$new_modules || $this->Application->RecallVar('user_id') != USER_ROOT) { return ; } @@ -154,48 +158,4 @@ $object->addRecord($module_record); } } - - /** - * Returns list of modules, that are not installed, but available in file system - * - * @return Array - */ - function _getNewModules() - { - $modules_helper =& $this->Application->recallObject('ModulesHelper'); - /* @var $modules_helper kModulesHelper */ - - $modules = Array (); - if ($dir = @opendir(MODULES_PATH)) { - while (($file = readdir($dir)) !== false) { - if ($file != '.' && $file != '..') { - $module_folder = MODULES_PATH . '/' . $file; - if (is_dir($module_folder) && $this->_isModule($module_folder)) { - // this is module -> check if it's installed already - if (!$modules_helper->moduleInstalled($file)) { - $install_order = trim( file_get_contents($module_folder . '/install/install_order.txt') ); - $modules[$install_order] = $file; - } - } - } - } - - closedir($dir); - } - - // allows to control module install order - ksort($modules, SORT_NUMERIC); - return $modules; - } - - /** - * Checks, that given folder is module root folder - * - * @param string $folder - * @return bool - */ - function _isModule($folder) - { - return file_exists($folder . '/install.php') && file_exists($folder . '/install/install_schema.sql'); - } } \ No newline at end of file