1
0

ModuleUpdates - v8 - 2011.06.23

Fixed: Bugs relating to the new Community Contributed Modules section & GCC stored modules
Added: Modules information for the new Gallery 3.0.2 Modules tab
Added: SPEED! The module checking process is now 60% faster than before thanks to logic updates in the data gathering process. The decrease in update checking time will be more noticeable as more modules are added.
This commit is contained in:
brentil 2011-06-24 18:17:09 -04:00
parent 3afb3ea7dc
commit 976d10a0a7
8 changed files with 96 additions and 22 deletions

View File

@ -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 = '<font color=green>1</font>';
}else if ($ExecutionTime <= 30){
$ExecutionTime = '<font color=green>' . $ExecutionTime . '</font>';
}else if ($ExecutionTime <= 60){
$ExecutionTime = '<font color=orange>' . $ExecutionTime . '</font>';
}else{
$ExecutionTime = '<font color=red>' . $ExecutionTime . '</font>';
}
$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() . '<br>';
}
}
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 {

View File

@ -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

View File

@ -1,3 +1,7 @@
name = "Module Updates"
name = "ModuleUpdates"
description = "Compares your installed module version against the ones stored in the GitHub."
version = 7
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"

View File

@ -2,7 +2,7 @@
<div id="g-admin-moduleupdates" class="g-block">
<h1> <?= t("Module Updates v".$mu_version.".0") ?> </h1>
<h1> <?= t("ModuleUpdates v".$mu_version) ?> </h1>
<?= t("Compares your installed module version against the ones stored in the GitHub and GalleryModules.") ?>
<div class="g-block-content">
@ -16,7 +16,7 @@
<li><?= t("<font color=green>Green = Your version is newer than the GitHub</font><br>") ?></li>
<li><?= t("<font color=orange>Orange = Your file version is newer than the installed version</font><br>") ?></li>
<li><?= t("<font color=pink>Pink = Your installed version is newer than file version</font><br>") ?></li>
<li><?= t("Outbound Status: " . $Google . " - GitHub Status: " . $GitHub . "<br>") ?></li>
<li><?= t("Outbound Status: " . $Google . " - GitHub Status: " . $GitHub . " - Execution Time: " . $ExecutionTime . " s <br>") ?></li>
<li><input type="submit" value="<?= t("Check Modules for Updates")?>" class="submit" /> <? if($update_time == ""){ echo "&nbsp;- Last Scan: Unknown";}else{ echo "&nbsp;- Last Scan: ".$update_time;} ?></li>
</ul>
</fieldset>

View File

@ -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 = '<font color=green>1</font>';
}else if ($ExecutionTime <= 30){
$ExecutionTime = '<font color=green>' . $ExecutionTime . '</font>';
}else if ($ExecutionTime <= 60){
$ExecutionTime = '<font color=orange>' . $ExecutionTime . '</font>';
}else{
$ExecutionTime = '<font color=red>' . $ExecutionTime . '</font>';
}
$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() . '<br>';
}
}
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 {

View File

@ -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

View File

@ -1,3 +1,7 @@
name = "Module Updates"
name = "ModuleUpdates"
description = "Compares your installed module version against the ones stored in the GitHub."
version = 7
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"

View File

@ -2,7 +2,7 @@
<div id="g-admin-moduleupdates" class="g-block">
<h1> <?= t("Module Updates v".$mu_version.".0") ?> </h1>
<h1> <?= t("ModuleUpdates v".$mu_version) ?> </h1>
<?= t("Compares your installed module version against the ones stored in the GitHub and GalleryModules.") ?>
<div class="g-block-content">
@ -16,7 +16,7 @@
<li><?= t("<font color=green>Green = Your version is newer than the GitHub</font><br>") ?></li>
<li><?= t("<font color=orange>Orange = Your file version is newer than the installed version</font><br>") ?></li>
<li><?= t("<font color=pink>Pink = Your installed version is newer than file version</font><br>") ?></li>
<li><?= t("Outbound Status: " . $Google . " - GitHub Status: " . $GitHub . "<br>") ?></li>
<li><?= t("Outbound Status: " . $Google . " - GitHub Status: " . $GitHub . " - Execution Time: " . $ExecutionTime . " s <br>") ?></li>
<li><input type="submit" value="<?= t("Check Modules for Updates")?>" class="submit" /> <? if($update_time == ""){ echo "&nbsp;- Last Scan: Unknown";}else{ echo "&nbsp;- Last Scan: ".$update_time;} ?></li>
</ul>
</fieldset>