mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-22 23:05:18 -04:00
Create a gallery::plugin_path which returns the appropriate path to the module or theme. This checks for the existence of an application/modules or application/themes first.
This commit is contained in:
@@ -77,15 +77,23 @@ class module_Core {
|
||||
static function available() {
|
||||
if (empty(self::$available)) {
|
||||
$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);
|
||||
$m =& $modules->$module_name;
|
||||
$m->installed = self::is_installed($module_name);
|
||||
$m->active = self::is_active($module_name);
|
||||
$m->code_version = $m->version;
|
||||
$m->version = self::get_version($module_name);
|
||||
$m->locked = false;
|
||||
foreach (array(APPPATH . "modules/", MODPATH) as $modpath) {
|
||||
foreach (scandir($modpath) as $module_name) {
|
||||
if ($module_name[0] == ".") {
|
||||
continue;
|
||||
}
|
||||
$file = "{$modpath}$module_name/module.info";
|
||||
if (file_exists($file)) {
|
||||
$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);
|
||||
$m->code_version = $m->version;
|
||||
$m->version = self::get_version($module_name);
|
||||
$m->locked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lock certain modules
|
||||
@@ -113,7 +121,7 @@ class module_Core {
|
||||
*/
|
||||
static function install($module_name) {
|
||||
$kohana_modules = Kohana::config("core.modules");
|
||||
array_unshift($kohana_modules, MODPATH . $module_name);
|
||||
array_unshift($kohana_modules, gallery::plugin_path($module_name));
|
||||
Kohana::config_set("core.modules", $kohana_modules);
|
||||
|
||||
$installer_class = "{$module_name}_installer";
|
||||
@@ -140,7 +148,7 @@ class module_Core {
|
||||
*/
|
||||
static function upgrade($module_name) {
|
||||
$kohana_modules = Kohana::config("core.modules");
|
||||
array_unshift($kohana_modules, MODPATH . $module_name);
|
||||
array_unshift($kohana_modules, gallery::plugin_path($module_name));
|
||||
Kohana::config_set("core.modules", $kohana_modules);
|
||||
|
||||
$version_before = module::get_version($module_name);
|
||||
@@ -179,7 +187,7 @@ class module_Core {
|
||||
*/
|
||||
static function activate($module_name) {
|
||||
$kohana_modules = Kohana::config("core.modules");
|
||||
array_unshift($kohana_modules, MODPATH . $module_name);
|
||||
array_unshift($kohana_modules, gallery::plugin_path($module_name));
|
||||
Kohana::config_set("core.modules", $kohana_modules);
|
||||
|
||||
$installer_class = "{$module_name}_installer";
|
||||
@@ -271,7 +279,7 @@ class module_Core {
|
||||
$gallery = $module;
|
||||
} else {
|
||||
self::$active[] = $module;
|
||||
$kohana_modules[] = MODPATH . $module->name;
|
||||
$kohana_modules[] = gallery::plugin_path($module->name);
|
||||
}
|
||||
}
|
||||
self::$active[] = $gallery; // put gallery last in the module list to match core.modules
|
||||
|
||||
Reference in New Issue
Block a user