diff --git a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php index de243ebb..7228fe64 100755 --- a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php +++ b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php @@ -186,8 +186,10 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { log::success("moduleupdates", t("Completed checking remote GitHub for modules updates.")); } - unlink('gm.ini'); - unlink('gm_core.ini'); + if(is_file('gm.ini')) + unlink('gm.ini'); + if(is_file('gm_core.ini')) + unlink('gm_core.ini'); $view->content->vars = $cache; $view->content->update_time = $cache_updates['date']; @@ -286,45 +288,63 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { //Check the main Gallery3 GitHub if ($file == null) { try { - if(file_exists('gm_core.ini')) { - $file = 1; - } - if ($file != null) { - $gm_core_array = parse_ini_file('gm_core.ini',true); - $server = '(G)'; - } + if(file_exists('gm_core.ini')) { + $file = 1; + } + if ($file != null) { + $gm_core_array = parse_ini_file('gm_core.ini',true); + $server = '(G)'; + } } - catch (Exception $e) { + catch (Exception $e) { } } break; case "GH": //Parse ini file from GalleryModules.com try { - $this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "))); - if(file_exists('gm.ini')) { - $file = 1; - } - if ($file != null) { - $gm_array = parse_ini_file('gm.ini',true); - $server = '(GH)'; - } + if(file_exists('gm.ini')) { + $file = 1; + } + if ($file != null) { + $gm_array = parse_ini_file('gm.ini',true); + $server = '(GH)'; + } } catch (Exception $e) { echo $e; } break; } - + if ($file != null) { - if ($server_location == "GH"){ - if($this_gm_repo == "30") { - $version = $gm_array[$module_name]['g3']; - } else { - $version = $gm_array[$module_name]['g31']; - } + //Search in the GM listing + if ($server_location == "GH"){ + //Search if this is a Gallery 3.0 module + if(array_key_exists($module_name,$gm_array)){ + if(array_key_exists('g3',$gm_array[$module_name])){ + $version = $gm_array[$module_name]['g3']; + } + if($version == ''){ + if(array_key_exists('g31',$gm_array[$module_name])){ + $version = $gm_array[$module_name]['g31']; + } + } + if($version == ''){ + if(array_key_exists('codex',$gm_array[$module_name])){ + $version = $gm_array[$module_name]['codex']; + } + } + } else { //Module not found + $version = ''; + } + //Search in the Core listing } else { - $version = $gm_core_array[$module_name]['version']; + if(array_key_exists($module_name,$gm_core_array)){ + $version = $gm_core_array[$module_name]['version']; + } else { //Module not found + $version = ''; + } } } diff --git a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php index 23235e98..aec27d02 100644 --- a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php +++ b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php @@ -24,7 +24,7 @@ class moduleupdates_installer { $version = module::get_version("moduleupdates"); if ($version < 1) { - module::set_version("moduleupdates", 10); + module::set_version("moduleupdates", 11); //Remove the ModuleUpdates cache entry 'JIC' Cache::instance()->delete("ModuleUpdates"); //create the blank ModuleUpdates cache entry with an expiration of 0 days @@ -34,7 +34,7 @@ class moduleupdates_installer { } static function upgrade($version) { - module::set_version("moduleupdates", 10); + module::set_version("moduleupdates", 11); //Remove the ModuleUpdates cache entry 'JIC' Cache::instance()->delete("ModuleUpdates"); //Empty the ModuleUpdates cache entry so our new version starts from scratch diff --git a/3.0/modules/moduleupdates/module.info b/3.0/modules/moduleupdates/module.info index aebec9d3..cf66ddd7 100755 --- a/3.0/modules/moduleupdates/module.info +++ b/3.0/modules/moduleupdates/module.info @@ -1,6 +1,6 @@ name = "ModuleUpdates" description = "Compares your installed module version against the ones stored in the GitHub." -version = 10 +version = 11 author_name = "brentil" author_url = "http://gallery.menalto.com/user/153736" info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleupdates"