summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/module.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-10-18 09:28:48 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-10-18 09:28:48 -0700
commit090c4d016baec6376d6d26c347c3e1ca11a929d5 (patch)
treeddab7b8e10cf635b7f45c0c18bdf809c848334a3 /modules/gallery/helpers/module.php
parentc9a030dd08711f89a985504ce26378a315d7ff1f (diff)
parent4949a2ce0b5daca7afe86a261be447440fce7eff (diff)
Merge branch 'master' into talmdal_dev
Conflicts: lib/gallery.common.css themes/admin_wind/views/admin.html.php themes/night_wind/views/sidebar.html.php themes/wind/views/sidebar.html.php
Diffstat (limited to 'modules/gallery/helpers/module.php')
-rw-r--r--modules/gallery/helpers/module.php19
1 files changed, 16 insertions, 3 deletions
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index eab94500..fb298959 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -50,8 +50,20 @@ class module_Core {
* @param string $module_name
*/
static function get($module_name) {
- // @todo can't easily use model_cache here because it throw an exception on missing models.
- return ORM::factory("module", array("name" => $module_name));
+ if (empty(self::$modules[$module_name])) {
+ return ORM::factory("module", array("name" => $module_name));
+ }
+ return self::$modules[$module_name];
+ }
+
+ /**
+ * Get the information about a module
+ * @returns ArrayObject containing the module information from the module.info file or false if
+ * not found
+ */
+ static function info($module_name) {
+ $module_list = self::available();
+ return isset($module_list->$module_name) ? $module_list->$module_name : false;
}
/**
@@ -79,7 +91,8 @@ class module_Core {
$modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
foreach (glob(MODPATH . "*/module.info") as $file) {
$module_name = basename(dirname($file));
- $modules->$module_name = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
+ $modules->$module_name =
+ new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
$m =& $modules->$module_name;
$m->installed = self::is_installed($module_name);
$m->active = self::is_active($module_name);