Permalink
Browse files

Merge pull request #108 from dmolavi/master

3.0.3 update
  • Loading branch information...
2 parents 632275a + fc6125a commit 9b971a91600a5e2a260e842b64fa4d14f82874f7 @talmdal talmdal committed Apr 22, 2012
@@ -186,8 +186,10 @@ public function index() {
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 @@ private function get_remote_module_version ($module_name, $server_location) {
//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 = '';
+ }
}
}
@@ -24,7 +24,7 @@ static function install() {
$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 @@ static function install() {
}
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
@@ -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"

0 comments on commit 9b971a9

Please sign in to comment.