diff --git a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php index a469fe67..72ec5112 100755 --- a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php +++ b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php @@ -39,6 +39,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { */ public function index() { + //Start execution timer + $bgtime=time(); + $view = new Admin_View("admin.html"); $view->page_title = t("Gallery 3 :: Manage Module Updates"); $view->content = new View("admin_moduleupdates.html"); @@ -111,10 +114,12 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { $font_color_local = $this->get_local_module_version_color ($module_info->version, $module_info->code_version); list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE"); $font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version); - list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB"); - $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version); - list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH"); - $font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version); + if(!is_numeric($core_version)) { + list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB"); + $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version); + list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH"); + $font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version); + } if($font_color_core == "red" or $font_color_contrib == "red" or $font_color_gh == "red"){ $update_count++; @@ -174,6 +179,20 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { $view->content->GitHub = $GitHub; $view->content->Gallery_Version = substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")); + //End execution timer + $ExecutionTime = (time()-$bgtime); + if ($ExecutionTime < 1) { + $ExecutionTime = '1'; + }else if ($ExecutionTime <= 30){ + $ExecutionTime = '' . $ExecutionTime . ''; + }else if ($ExecutionTime <= 60){ + $ExecutionTime = '' . $ExecutionTime . ''; + }else{ + $ExecutionTime = '' . $ExecutionTime . ''; + } + + + $view->content->ExecutionTime = $ExecutionTime; print $view; } @@ -252,13 +271,24 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { //Check the Gallery3 Community Contributions GitHub if ($file == null) { try { + $thisInstalledVersion = gallery::VERSION; + //Gallery versions prior to 3.0.2 contained the codename in the version string + if (substr_count($thisInstalledVersion, ' ') > 0 ){ + $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strpos($thisInstalledVersion," ")); + } + //Truncate the minor version number + if (substr_count($thisInstalledVersion, '.') > 1 ){ + $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strripos($thisInstalledVersion,".")); + } $file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/". - substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "))."/modules/".$module_name."/module.info", "r"); + $thisInstalledVersion ."/modules/".$module_name."/module.info", "r"); + if ($file != null) { $server = '(GCC)'; } } catch (Exception $e) { + //echo 'Message: ' .$e->getMessage() . '
'; } } break; @@ -303,6 +333,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { if($line == "Not entered" or $line == "See git") { $line = ""; } + if (substr_count($line, '.') > 0) { + $line = str_replace('.','',$line); + } $version = $line; break; } else { diff --git a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php index 1e60a2cb..85f90489 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", 7); + module::set_version("moduleupdates", 8); //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", 7); + module::set_version("moduleupdates", 8); //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 bbf3516a..7c73c340 100755 --- a/3.0/modules/moduleupdates/module.info +++ b/3.0/modules/moduleupdates/module.info @@ -1,3 +1,7 @@ -name = "Module Updates" +name = "ModuleUpdates" description = "Compares your installed module version against the ones stored in the GitHub." -version = 7 \ No newline at end of file +version = 8 +author_name = "brentil" +author_url = "http://gallery.menalto.com/user/153736" +info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleupdates" +discuss_url = "http://gallery.menalto.com/node/96574" diff --git a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php index e55ed7af..18ff31ed 100644 --- a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php +++ b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php @@ -2,7 +2,7 @@
-

+

@@ -16,7 +16,7 @@
  • Green = Your version is newer than the GitHub
    ") ?>
  • Orange = Your file version is newer than the installed version
    ") ?>
  • Pink = Your installed version is newer than file version
    ") ?>
  • -
  • ") ?>
  • +
  • ") ?>
  • " class="submit" />
  • diff --git a/3.1/modules/moduleupdates/controllers/admin_moduleupdates.php b/3.1/modules/moduleupdates/controllers/admin_moduleupdates.php index a469fe67..72ec5112 100755 --- a/3.1/modules/moduleupdates/controllers/admin_moduleupdates.php +++ b/3.1/modules/moduleupdates/controllers/admin_moduleupdates.php @@ -39,6 +39,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { */ public function index() { + //Start execution timer + $bgtime=time(); + $view = new Admin_View("admin.html"); $view->page_title = t("Gallery 3 :: Manage Module Updates"); $view->content = new View("admin_moduleupdates.html"); @@ -111,10 +114,12 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { $font_color_local = $this->get_local_module_version_color ($module_info->version, $module_info->code_version); list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE"); $font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version); - list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB"); - $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version); - list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH"); - $font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version); + if(!is_numeric($core_version)) { + list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB"); + $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version); + list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH"); + $font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version); + } if($font_color_core == "red" or $font_color_contrib == "red" or $font_color_gh == "red"){ $update_count++; @@ -174,6 +179,20 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { $view->content->GitHub = $GitHub; $view->content->Gallery_Version = substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")); + //End execution timer + $ExecutionTime = (time()-$bgtime); + if ($ExecutionTime < 1) { + $ExecutionTime = '1'; + }else if ($ExecutionTime <= 30){ + $ExecutionTime = '' . $ExecutionTime . ''; + }else if ($ExecutionTime <= 60){ + $ExecutionTime = '' . $ExecutionTime . ''; + }else{ + $ExecutionTime = '' . $ExecutionTime . ''; + } + + + $view->content->ExecutionTime = $ExecutionTime; print $view; } @@ -252,13 +271,24 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { //Check the Gallery3 Community Contributions GitHub if ($file == null) { try { + $thisInstalledVersion = gallery::VERSION; + //Gallery versions prior to 3.0.2 contained the codename in the version string + if (substr_count($thisInstalledVersion, ' ') > 0 ){ + $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strpos($thisInstalledVersion," ")); + } + //Truncate the minor version number + if (substr_count($thisInstalledVersion, '.') > 1 ){ + $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strripos($thisInstalledVersion,".")); + } $file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/". - substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "))."/modules/".$module_name."/module.info", "r"); + $thisInstalledVersion ."/modules/".$module_name."/module.info", "r"); + if ($file != null) { $server = '(GCC)'; } } catch (Exception $e) { + //echo 'Message: ' .$e->getMessage() . '
    '; } } break; @@ -303,6 +333,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { if($line == "Not entered" or $line == "See git") { $line = ""; } + if (substr_count($line, '.') > 0) { + $line = str_replace('.','',$line); + } $version = $line; break; } else { diff --git a/3.1/modules/moduleupdates/helpers/moduleupdates_installer.php b/3.1/modules/moduleupdates/helpers/moduleupdates_installer.php index 1e60a2cb..85f90489 100644 --- a/3.1/modules/moduleupdates/helpers/moduleupdates_installer.php +++ b/3.1/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", 7); + module::set_version("moduleupdates", 8); //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", 7); + module::set_version("moduleupdates", 8); //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.1/modules/moduleupdates/module.info b/3.1/modules/moduleupdates/module.info index bbf3516a..7c73c340 100755 --- a/3.1/modules/moduleupdates/module.info +++ b/3.1/modules/moduleupdates/module.info @@ -1,3 +1,7 @@ -name = "Module Updates" +name = "ModuleUpdates" description = "Compares your installed module version against the ones stored in the GitHub." -version = 7 \ No newline at end of file +version = 8 +author_name = "brentil" +author_url = "http://gallery.menalto.com/user/153736" +info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleupdates" +discuss_url = "http://gallery.menalto.com/node/96574" diff --git a/3.1/modules/moduleupdates/views/admin_moduleupdates.html.php b/3.1/modules/moduleupdates/views/admin_moduleupdates.html.php index e55ed7af..18ff31ed 100644 --- a/3.1/modules/moduleupdates/views/admin_moduleupdates.html.php +++ b/3.1/modules/moduleupdates/views/admin_moduleupdates.html.php @@ -2,7 +2,7 @@
    -

    +

    @@ -16,7 +16,7 @@
  • Green = Your version is newer than the GitHub
    ") ?>
  • Orange = Your file version is newer than the installed version
    ") ?>
  • Pink = Your installed version is newer than file version
    ") ?>
  • -
  • ") ?>
  • +
  • ") ?>
  • " class="submit" />