1
0

Fix for 3.0.3 upgrade.

This commit is contained in:
dmolavi 2012-04-21 23:05:20 -04:00
parent 632275a198
commit fc6125aa91
3 changed files with 49 additions and 29 deletions

View File

@ -186,8 +186,10 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
log::success("moduleupdates", t("Completed checking remote GitHub for modules updates.")); log::success("moduleupdates", t("Completed checking remote GitHub for modules updates."));
} }
unlink('gm.ini'); if(is_file('gm.ini'))
unlink('gm_core.ini'); unlink('gm.ini');
if(is_file('gm_core.ini'))
unlink('gm_core.ini');
$view->content->vars = $cache; $view->content->vars = $cache;
$view->content->update_time = $cache_updates['date']; $view->content->update_time = $cache_updates['date'];
@ -286,45 +288,63 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
//Check the main Gallery3 GitHub //Check the main Gallery3 GitHub
if ($file == null) { if ($file == null) {
try { try {
if(file_exists('gm_core.ini')) { if(file_exists('gm_core.ini')) {
$file = 1; $file = 1;
} }
if ($file != null) { if ($file != null) {
$gm_core_array = parse_ini_file('gm_core.ini',true); $gm_core_array = parse_ini_file('gm_core.ini',true);
$server = '(G)'; $server = '(G)';
} }
} }
catch (Exception $e) { catch (Exception $e) {
} }
} }
break; break;
case "GH": case "GH":
//Parse ini file from GalleryModules.com //Parse ini file from GalleryModules.com
try { try {
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "))); if(file_exists('gm.ini')) {
if(file_exists('gm.ini')) { $file = 1;
$file = 1; }
} if ($file != null) {
if ($file != null) { $gm_array = parse_ini_file('gm.ini',true);
$gm_array = parse_ini_file('gm.ini',true); $server = '(GH)';
$server = '(GH)'; }
}
} }
catch (Exception $e) { catch (Exception $e) {
echo $e; echo $e;
} }
break; break;
} }
if ($file != null) { if ($file != null) {
if ($server_location == "GH"){ //Search in the GM listing
if($this_gm_repo == "30") { if ($server_location == "GH"){
$version = $gm_array[$module_name]['g3']; //Search if this is a Gallery 3.0 module
} else { if(array_key_exists($module_name,$gm_array)){
$version = $gm_array[$module_name]['g31']; 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 { } 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 = '';
}
} }
} }

View File

@ -24,7 +24,7 @@ class moduleupdates_installer {
$version = module::get_version("moduleupdates"); $version = module::get_version("moduleupdates");
if ($version < 1) { if ($version < 1) {
module::set_version("moduleupdates", 10); module::set_version("moduleupdates", 11);
//Remove the ModuleUpdates cache entry 'JIC' //Remove the ModuleUpdates cache entry 'JIC'
Cache::instance()->delete("ModuleUpdates"); Cache::instance()->delete("ModuleUpdates");
//create the blank ModuleUpdates cache entry with an expiration of 0 days //create the blank ModuleUpdates cache entry with an expiration of 0 days
@ -34,7 +34,7 @@ class moduleupdates_installer {
} }
static function upgrade($version) { static function upgrade($version) {
module::set_version("moduleupdates", 10); module::set_version("moduleupdates", 11);
//Remove the ModuleUpdates cache entry 'JIC' //Remove the ModuleUpdates cache entry 'JIC'
Cache::instance()->delete("ModuleUpdates"); Cache::instance()->delete("ModuleUpdates");
//Empty the ModuleUpdates cache entry so our new version starts from scratch //Empty the ModuleUpdates cache entry so our new version starts from scratch

View File

@ -1,6 +1,6 @@
name = "ModuleUpdates" name = "ModuleUpdates"
description = "Compares your installed module version against the ones stored in the GitHub." description = "Compares your installed module version against the ones stored in the GitHub."
version = 10 version = 11
author_name = "brentil" author_name = "brentil"
author_url = "http://gallery.menalto.com/user/153736" author_url = "http://gallery.menalto.com/user/153736"
info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleupdates" info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleupdates"