Merge branch 'master' of git://github.com/brentil/gallery3-contrib
This commit is contained in:
commit
05ee3bfe78
@ -16,7 +16,6 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Admin_Moduleupdates_Controller extends Admin_Controller {
|
class Admin_Moduleupdates_Controller extends Admin_Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,16 +43,11 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$view->page_title = t("Gallery 3 :: Manage Module Updates");
|
$view->page_title = t("Gallery 3 :: Manage Module Updates");
|
||||||
$view->content = new View("admin_moduleupdates.html");
|
$view->content = new View("admin_moduleupdates.html");
|
||||||
|
|
||||||
$devDebug = false;
|
|
||||||
$refreshCache = false;
|
$refreshCache = false;
|
||||||
|
|
||||||
$cache = unserialize(Cache::instance()->get("moduleupdates_cache"));
|
$cache = unserialize(Cache::instance()->get("moduleupdates_cache"));
|
||||||
$cache_updates = unserialize(Cache::instance()->get("moduleupdates_cache_updates"));
|
$cache_updates = unserialize(Cache::instance()->get("moduleupdates_cache_updates"));
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
//echo 'Message 01: ' .$cache_updates . '<br>';
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//if someone pressed the button to refresh now
|
//if someone pressed the button to refresh now
|
||||||
if (request::method() == "post") {
|
if (request::method() == "post") {
|
||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
@ -78,7 +72,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
//Check the ability to access the Google
|
//Check the ability to access the Google
|
||||||
$Google = null;
|
$Google = null;
|
||||||
@ -91,71 +84,82 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$update_count = 0;
|
||||||
|
|
||||||
if($refreshCache == true){
|
if($refreshCache == true){
|
||||||
foreach (module::available() as $this_module_name => $module_info) {
|
foreach (module::available() as $this_module_name => $module_info) {
|
||||||
|
|
||||||
//example code for setting cache values
|
$font_color_local = "black";
|
||||||
//Cache::instance()->set($key, "$log{$msg}", array("task", "log", "import"), 2592000);
|
$core_version = '';
|
||||||
//example delete cache
|
$core_server = '';
|
||||||
//Cache::instance()->delete("update_l10n_cache:{$task->id}");
|
$core_dlink = '';
|
||||||
//example for reading cache
|
$font_color_core = "black";
|
||||||
//$log = Cache::instance()->get($key);
|
$contrib_version = '';
|
||||||
|
$contrib_server = '';
|
||||||
|
$contrib_dlink = '';
|
||||||
|
$font_color_contrib = "black";
|
||||||
|
$gh_version = '';
|
||||||
|
$gh_server = '';
|
||||||
|
$gh_dlink = '';
|
||||||
|
$font_color_gh = "black";
|
||||||
|
|
||||||
$remote_version = '';
|
|
||||||
$remote_server = '';
|
|
||||||
$update_count = 0;
|
|
||||||
|
|
||||||
list ($remote_version, $remote_server) = $this->get_remote_module_version($this_module_name, $devDebug);
|
|
||||||
|
|
||||||
$font_color = "black";
|
$font_color_local = $this->get_local_module_version_color ($module_info->version, $module_info->code_version);
|
||||||
//BLUE - DNE: Does Not Exist, this module was not found
|
list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE");
|
||||||
if ($remote_version == "DNE") {
|
$font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version);
|
||||||
$font_color = "blue";
|
list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB");
|
||||||
//PINK - Your installed version is newer than file version
|
$font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version);
|
||||||
} else if ($module_info->version != '' and $module_info->code_version < $module_info->version) {
|
list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH");
|
||||||
$font_color = "pink";
|
$font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version);
|
||||||
//ORANGE - Your file version is newer than the installed version
|
|
||||||
} else if ($module_info->version != '' and $module_info->code_version > $module_info->version) {
|
if($font_color_core == "red" or $font_color_contrib == "red" or $font_color_gh == "red"){
|
||||||
$font_color = "orange";
|
|
||||||
//GREEN - Your version is newer than the GitHub
|
|
||||||
} else if ($remote_version < $module_info->code_version or ($module_info->version != ''
|
|
||||||
and $remote_version < $module_info->version)) {
|
|
||||||
$font_color = "green";
|
|
||||||
//RED - Your version is older than the GitHub
|
|
||||||
} else if ($remote_version > $module_info->code_version or ($module_info->version != ''
|
|
||||||
and $remote_version > $module_info->version)) {
|
|
||||||
$font_color = "red";
|
|
||||||
$update_count++;
|
$update_count++;
|
||||||
/*
|
|
||||||
if($remote_server == "(G3)"){
|
|
||||||
$module_info->name = "<a href=\"http://github.com/gallery/gallery3/tree/master/modules/".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
|
||||||
}else if($remote_server == "(G3CC)"){
|
|
||||||
$module_info->name = "<a href=\"http://github.com/gallery/gallery3-contrib/tree/master/modules/".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
|
||||||
}else if($remote_server == "(brentil)"){
|
|
||||||
$module_info->name = "<a href=\"http://github.com/brentil/gallery3-contrib/tree/master/modules/".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_info->name = "<a href=\"http://codex.gallery2.org/Gallery3:Modules:".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
$module_info->name = "<a href=\"http://codex.gallery2.org/Gallery3:Modules:".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
||||||
|
|
||||||
|
if (is_numeric($core_version)) {
|
||||||
|
if($core_version > $module_info->version) {
|
||||||
|
$core_dlink = "http://github.com/gallery/gallery3/tree/master/modules/".$this_module_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_numeric($contrib_version)) {
|
||||||
|
if($contrib_version > $module_info->version) {
|
||||||
|
$contrib_dlink = "http://github.com/gallery/gallery3-contrib/tree/master/".
|
||||||
|
substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")) ."/modules/".$this_module_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_numeric($gh_version)) {
|
||||||
|
if($gh_version > $module_info->version) {
|
||||||
|
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
||||||
|
if($this_gm_repo == "30"){
|
||||||
|
$gh_dlink = "http://www.gallerymodules.com/update/".$this_module_name;
|
||||||
|
} else {
|
||||||
|
$gh_dlink = "http://www.gallerymodules.com/update".this_gm_repo."/".$this_module_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//populate the list fo modules and their data
|
//populate the list fo modules and their data
|
||||||
$cache->$this_module_name = array ("name" => $module_info->name, "locked" => $module_info->locked,
|
$cache->$this_module_name = array ("name" => $module_info->name, "locked" => $module_info->locked,
|
||||||
"code_version" => $module_info->code_version, "active" => $module_info->active,
|
"code_version" => $module_info->code_version, "active" => $module_info->active,
|
||||||
"version" => $module_info->version,"description" => $module_info->description,
|
"version" => $module_info->version,"description" => $module_info->description,
|
||||||
"remote_version" => $remote_version, "remote_server" => $remote_server, "font_color" => $font_color);
|
"core_version" => $core_version, "core_server" => $core_server, "font_color_core" => $font_color_core,
|
||||||
|
"contrib_version" => $contrib_version, "contrib_server" => $contrib_server, "font_color_contrib" => $font_color_contrib,
|
||||||
|
"gh_version" => $gh_version, "gh_server" => $gh_server, "font_color_gh" => $font_color_gh,
|
||||||
|
"font_color_local" => $font_color_local, "core_dlink" => $core_dlink, "contrib_dlink" => $contrib_dlink,
|
||||||
|
"gh_dlink" => $gh_dlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Define right now as YYYY.MM.DD HH:MM with the # of updates that are out of date
|
//Define right now as YYYY.MM.DD HH:MM with the # of updates that are out of date
|
||||||
$cache_updates = array("date" => date("Y.m.d - H:i"), "updates" => $update_count);
|
$cache_updates = array("date" => date("Y.m.d - H:i"), "updates" => $update_count);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
//echo 'Message 02: ' .$cache_updates . '<br>';
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//Write out the new data to cache with a 30 day expiration & 0 for update data so it's always present
|
//Write out the new data to cache with a 30 day expiration & 0 for update data so it's always present
|
||||||
Cache::instance()->set("moduleupdates_cache", serialize($cache), array("ModuleUpdates"), 30*86400);
|
Cache::instance()->set("moduleupdates_cache", serialize($cache), array("ModuleUpdates"), 30*86400);
|
||||||
Cache::instance()->set("moduleupdates_cache_updates", serialize($cache_updates), array("ModuleUpdates"), null);
|
Cache::instance()->set("moduleupdates_cache_updates", serialize($cache_updates), array("ModuleUpdates"), null);
|
||||||
@ -174,6 +178,52 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
private function get_module_version_color ($version, $code_version, $remote_version) {
|
||||||
|
|
||||||
|
$font_color = "black";
|
||||||
|
|
||||||
|
//BLACK - no module version detected
|
||||||
|
if ($remote_version == "") {
|
||||||
|
$font_color = "black";
|
||||||
|
//BLUE - DNE: Does Not Exist, this module was not found
|
||||||
|
} else if ($remote_version == "DNE") {
|
||||||
|
$font_color = "blue";
|
||||||
|
//GREEN - Your version is newer than the GitHub
|
||||||
|
} else if ($remote_version < $code_version or ($version != ''
|
||||||
|
and $remote_version < $version)) {
|
||||||
|
$font_color = "green";
|
||||||
|
//RED - Your version is older than the GitHub
|
||||||
|
} else if ($remote_version > $code_version or ($version != ''
|
||||||
|
and $remote_version > $version)) {
|
||||||
|
$font_color = "red";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $font_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
private function get_local_module_version_color ($version, $code_version) {
|
||||||
|
|
||||||
|
$font_color = "black";
|
||||||
|
|
||||||
|
//PINK - Your installed version is newer than file version
|
||||||
|
if ($version != '' and $code_version < $version) {
|
||||||
|
$font_color = "pink";
|
||||||
|
//ORANGE - Your file version is newer than the installed version
|
||||||
|
} else if ($version != '' and $code_version > $version) {
|
||||||
|
$font_color = "orange";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $font_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the known GitHub repositories for new versions of modules.
|
* Parses the known GitHub repositories for new versions of modules.
|
||||||
*
|
*
|
||||||
@ -183,32 +233,35 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
*
|
*
|
||||||
* http://github.com/gallery/gallery3
|
* http://github.com/gallery/gallery3
|
||||||
* http://github.com/gallery/gallery3-contrib
|
* http://github.com/gallery/gallery3-contrib
|
||||||
|
* http://www.gallerymodules.com
|
||||||
*
|
*
|
||||||
* @author brentil <forums@inner-ninja.com>
|
* @author brentil <forums@inner-ninja.com>
|
||||||
* @param String The folder name of the module to search for on the remote GitHub server
|
* @param String - The folder name of the module to search for on the remote GitHub server
|
||||||
* @return Array An array with the remote module version and the server it was found on.
|
* @param String - The remote server to check against
|
||||||
|
* @return Array - An array with the remote module version and the server it was found on.
|
||||||
*/
|
*/
|
||||||
private function get_remote_module_version ($module_name, $devDebug) {
|
private function get_remote_module_version ($module_name, $server_location) {
|
||||||
|
|
||||||
$version = 'DNE';
|
$version = '';
|
||||||
$server = '';
|
$server = '';
|
||||||
$file = null;
|
$file = null;
|
||||||
|
|
||||||
//For development debug only
|
switch ($server_location) {
|
||||||
if ($devDebug == true){
|
case "CONTRIB":
|
||||||
|
//Check the Gallery3 Community Contributions GitHub
|
||||||
if ($file == null) {
|
if ($file == null) {
|
||||||
try {
|
try {
|
||||||
$file = fopen ("http://github.com/brentil/gallery3-contrib/raw/master/". substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")) ."/modules/".$module_name."/module.info", "r");
|
$file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/".
|
||||||
|
substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "))."/modules/".$module_name."/module.info", "r");
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
$server = '(brentil)';
|
$server = '(GCC)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
case "CORE":
|
||||||
//Check the main Gallery3 GitHub
|
//Check the main Gallery3 GitHub
|
||||||
if ($file == null) {
|
if ($file == null) {
|
||||||
try {
|
try {
|
||||||
@ -218,31 +271,45 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
//Check the Gallery3 Community Contributions GitHub
|
case "GH":
|
||||||
|
//Check GalleryModules.com
|
||||||
if ($file == null) {
|
if ($file == null) {
|
||||||
try {
|
try {
|
||||||
$file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/". substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")) ."/modules/".$module_name."/module.info", "r");
|
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
||||||
|
if($this_gm_repo == "30"){
|
||||||
|
$file = fopen ("http://www.gallerymodules.com/m/".$module_name, "r");
|
||||||
|
} else {
|
||||||
|
$file = fopen ("http://www.gallerymodules.com/".this_gm_repo."m/".$module_name, "r");
|
||||||
|
}
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
$server = '(GCC)';
|
$server = '(GH)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
while (!feof ($file)) {
|
while (!feof ($file)) {
|
||||||
$line = fgets ($file, 1024);
|
$line = fgets ($file, 1024);
|
||||||
|
if ($server_location == "GH"){
|
||||||
|
//GH stores only the version info
|
||||||
|
if($line == "Not entered" or $line == "See git") {
|
||||||
|
$line = "";
|
||||||
|
}
|
||||||
|
$version = $line;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
//Regular expression to find & gather the version number in the remote module.info file
|
//Regular expression to find & gather the version number in the remote module.info file
|
||||||
if (preg_match ("@version = (.*)@i", $line, $out)) {
|
if (preg_match ("@version = (.*)@i", $line, $out)) {
|
||||||
$version = $out[1];
|
$version = $out[1];
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose ($file);
|
fclose ($file);
|
||||||
|
@ -23,8 +23,8 @@ class moduleupdates_installer {
|
|||||||
static function install() {
|
static function install() {
|
||||||
|
|
||||||
$version = module::get_version("moduleupdates");
|
$version = module::get_version("moduleupdates");
|
||||||
if ($version == 0) {
|
if ($version < 1) {
|
||||||
module::set_version("moduleupdates", 4);
|
module::set_version("moduleupdates", 5);
|
||||||
//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", 4);
|
module::set_version("moduleupdates", 5);
|
||||||
//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
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name = "Module Updates"
|
name = "Module Updates"
|
||||||
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 = 4
|
version = 5
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<div id="g-admin-moduleupdates" class="g-block">
|
<div id="g-admin-moduleupdates" class="g-block">
|
||||||
<h1> <?= t("Module Updates v4.0") ?> </h1>
|
<h1> <?= t("Module Updates v5.0") ?> </h1>
|
||||||
<?= t("Compares your installed module version against the ones stored in the GitHub.") ?>
|
<?= t("Compares your installed module version against the ones stored in the GitHub and GalleryModules.") ?>
|
||||||
|
|
||||||
<div class="g-block-content">
|
<div class="g-block-content">
|
||||||
|
|
||||||
@ -16,7 +16,6 @@
|
|||||||
<li><?= t("<font color=green>Green = Your version is newer than the GitHub</font><br>") ?></li>
|
<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=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("<font color=pink>Pink = Your installed version is newer than file version</font><br>") ?></li>
|
||||||
<li><?= t("<font color=blue>Blue = Does Not Exist/No information available</font><br>") ?></li>
|
|
||||||
<li><?= t("Outbound Status: " . $Google . " - GitHub Status: " . $GitHub . "<br>") ?></li>
|
<li><?= t("Outbound Status: " . $Google . " - GitHub Status: " . $GitHub . "<br>") ?></li>
|
||||||
<li><input type="submit" value="<?= t("Check Modules for Updates")?>" class="submit" /> <? if($update_time == ""){ echo " - Last Scan: Unknown";}else{ echo " - Last Scan: ".$update_time;} ?></li>
|
<li><input type="submit" value="<?= t("Check Modules for Updates")?>" class="submit" /> <? if($update_time == ""){ echo " - Last Scan: Unknown";}else{ echo " - Last Scan: ".$update_time;} ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -25,24 +24,36 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
<ul id="g-action-status" class="g-message-block">
|
<ul id="g-action-status" class="g-message-block">
|
||||||
<li class="g-warning"><?= t("Versions are compared from the official Gallery " . $Gallery_Version . " (G) and official Gallery " . $Gallery_Version . " Community Contributions (GCC). Versions downloaded from the forums will not be shown.") ?></li>
|
<li class="g-warning"><?= t("Versions are compared from GitHub for Gallery Core (GC), Gallery Community Contributions (GCC), and GalleryModules.com (GM). Versions downloaded from the forums will not be shown.") ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th> <?= t("Module") ?> </th>
|
<th> <?= t("Module") ?> </th>
|
||||||
<th> <?= t("Your Version<br>[File/Installed]") ?> </th>
|
<th><center> <?= t("Local /<br>Installed") ?> </center></th>
|
||||||
<th> <?= t("Remote Version") ?> </th>
|
<th width=50><center> <?= t("GC") ?> </center></th>
|
||||||
|
<th width=50><center> <?= t("GCC") ?> </center></th>
|
||||||
|
<th width=85><center> <?= t("GM") ?> </center></th>
|
||||||
<th> <?= t("Description") ?> </th>
|
<th> <?= t("Description") ?> </th>
|
||||||
</tr>
|
</tr>
|
||||||
<? foreach ($vars as $module_name): ?>
|
<? foreach ($vars as $module_name): ?>
|
||||||
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||||
<td> <? echo "<font color=".$module_name['font_color'].">"; ?> <?= t($module_name['name']) ?> </font> </td>
|
<td> <?= t($module_name['name']) ?> </td>
|
||||||
<td> <? echo "<font color=".$module_name['font_color'].">"; ?> <?= $module_name['code_version'] ?><? if ($module_name['version'] != '') echo "/".$module_name['version']; ?> </font> </td>
|
<td align=center> <? echo "<font color=".$module_name['font_color_local'].">"; ?> <? if($module_name['font_color_local'] != "black"){ echo "<b><u>*"; } ?> <? if (is_numeric($module_name['code_version'])) echo $module_name['code_version']; ?><? if (is_numeric($module_name['version'])) echo " / ".$module_name['version']; ?> <? if($module_name['font_color_local'] != "black"){ echo "*</b></u>"; } ?> </td>
|
||||||
<td> <? echo "<font color=".$module_name['font_color'].">"; ?> <?= $module_name['remote_version'] ?> <?= $module_name['remote_server'] ?> </font> </td>
|
<td align=center> <? echo "<font color=".$module_name['font_color_core'].">"; ?> <? if($module_name['font_color_core'] != "black" and $module_name['font_color_core'] != "" ){ echo "<b><u>*"; } ?> <? if(is_numeric($module_name['core_version'])) if($module_name['core_version'] > $module_name['code_version']) { echo "<a href=\"".$module_name['core_dlink']."\" target=\"_blank\">".$module_name['core_version']."</a>";} else { echo $module_name['core_version']; } ?> <? if($module_name['font_color_core'] != "black"){ echo "*</b></u>"; } ?> </font> </td>
|
||||||
<td> <? echo "<font color=".$module_name['font_color'].">"; ?> <?= t($module_name['description']) ?> </font> </td>
|
<td align=center> <? echo "<font color=".$module_name['font_color_contrib'].">"; ?> <? if($module_name['font_color_contrib'] != "black" and $module_name['font_color_contrib'] != "" ){ echo "<b><u>*"; } ?> <? if(is_numeric($module_name['contrib_version'])) if($module_name['contrib_version'] > $module_name['version'] or $module_name['core_version'] > $module_name['code_version']) { echo "<a href=\"".$module_name['contrib_dlink']."\" target=\"_blank\">".$module_name['contrib_version']."</a>";} else { echo $module_name['contrib_version']; } ?> <? if($module_name['font_color_contrib'] != "black"){ echo "*</b></u>"; } ?> </font> </td>
|
||||||
|
<td align=center> <? echo "<font color=".$module_name['font_color_gh'].">"; ?> <? if($module_name['font_color_gh'] != "black" and $module_name['font_color_gh'] != "" ){ echo "<b><u>*"; } ?> <? if(is_numeric($module_name['gh_version'])) if($module_name['gh_version'] > $module_name['version'] or $module_name['core_version'] > $module_name['code_version']) { echo "<a href=\"".$module_name['gh_dlink']."\" target=\"_blank\">".$module_name['gh_version']."</a>";} else { echo $module_name['gh_version']; } ?> <? if($module_name['font_color_gh'] != "black"){ echo "*</b></u>"; } ?> </font> </td>
|
||||||
|
<td> <?= t($module_name['description']) ?> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<? endforeach ?>
|
<? endforeach ?>
|
||||||
|
<tr>
|
||||||
|
<th> <?= t("Module") ?> </th>
|
||||||
|
<th><center> <?= t("Local /<br>Installed") ?> </center></th>
|
||||||
|
<th width=50><center> <?= t("GC") ?> </center></th>
|
||||||
|
<th width=50><center> <?= t("GCC") ?> </center></th>
|
||||||
|
<th width=85><center> <?= t("GM") ?> </center></th>
|
||||||
|
<th> <?= t("Description") ?> </th>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -16,7 +16,6 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Admin_Moduleupdates_Controller extends Admin_Controller {
|
class Admin_Moduleupdates_Controller extends Admin_Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,16 +43,11 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$view->page_title = t("Gallery 3 :: Manage Module Updates");
|
$view->page_title = t("Gallery 3 :: Manage Module Updates");
|
||||||
$view->content = new View("admin_moduleupdates.html");
|
$view->content = new View("admin_moduleupdates.html");
|
||||||
|
|
||||||
$devDebug = false;
|
|
||||||
$refreshCache = false;
|
$refreshCache = false;
|
||||||
|
|
||||||
$cache = unserialize(Cache::instance()->get("moduleupdates_cache"));
|
$cache = unserialize(Cache::instance()->get("moduleupdates_cache"));
|
||||||
$cache_updates = unserialize(Cache::instance()->get("moduleupdates_cache_updates"));
|
$cache_updates = unserialize(Cache::instance()->get("moduleupdates_cache_updates"));
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
//echo 'Message 01: ' .$cache_updates . '<br>';
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//if someone pressed the button to refresh now
|
//if someone pressed the button to refresh now
|
||||||
if (request::method() == "post") {
|
if (request::method() == "post") {
|
||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
@ -78,7 +72,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
//Check the ability to access the Google
|
//Check the ability to access the Google
|
||||||
$Google = null;
|
$Google = null;
|
||||||
@ -91,71 +84,82 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$update_count = 0;
|
||||||
|
|
||||||
if($refreshCache == true){
|
if($refreshCache == true){
|
||||||
foreach (module::available() as $this_module_name => $module_info) {
|
foreach (module::available() as $this_module_name => $module_info) {
|
||||||
|
|
||||||
//example code for setting cache values
|
$font_color_local = "black";
|
||||||
//Cache::instance()->set($key, "$log{$msg}", array("task", "log", "import"), 2592000);
|
$core_version = '';
|
||||||
//example delete cache
|
$core_server = '';
|
||||||
//Cache::instance()->delete("update_l10n_cache:{$task->id}");
|
$core_dlink = '';
|
||||||
//example for reading cache
|
$font_color_core = "black";
|
||||||
//$log = Cache::instance()->get($key);
|
$contrib_version = '';
|
||||||
|
$contrib_server = '';
|
||||||
|
$contrib_dlink = '';
|
||||||
|
$font_color_contrib = "black";
|
||||||
|
$gh_version = '';
|
||||||
|
$gh_server = '';
|
||||||
|
$gh_dlink = '';
|
||||||
|
$font_color_gh = "black";
|
||||||
|
|
||||||
$remote_version = '';
|
|
||||||
$remote_server = '';
|
|
||||||
$update_count = 0;
|
|
||||||
|
|
||||||
list ($remote_version, $remote_server) = $this->get_remote_module_version($this_module_name, $devDebug);
|
|
||||||
|
|
||||||
$font_color = "black";
|
$font_color_local = $this->get_local_module_version_color ($module_info->version, $module_info->code_version);
|
||||||
//BLUE - DNE: Does Not Exist, this module was not found
|
list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE");
|
||||||
if ($remote_version == "DNE") {
|
$font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version);
|
||||||
$font_color = "blue";
|
list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB");
|
||||||
//PINK - Your installed version is newer than file version
|
$font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version);
|
||||||
} else if ($module_info->version != '' and $module_info->code_version < $module_info->version) {
|
list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH");
|
||||||
$font_color = "pink";
|
$font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version);
|
||||||
//ORANGE - Your file version is newer than the installed version
|
|
||||||
} else if ($module_info->version != '' and $module_info->code_version > $module_info->version) {
|
if($font_color_core == "red" or $font_color_contrib == "red" or $font_color_gh == "red"){
|
||||||
$font_color = "orange";
|
|
||||||
//GREEN - Your version is newer than the GitHub
|
|
||||||
} else if ($remote_version < $module_info->code_version or ($module_info->version != ''
|
|
||||||
and $remote_version < $module_info->version)) {
|
|
||||||
$font_color = "green";
|
|
||||||
//RED - Your version is older than the GitHub
|
|
||||||
} else if ($remote_version > $module_info->code_version or ($module_info->version != ''
|
|
||||||
and $remote_version > $module_info->version)) {
|
|
||||||
$font_color = "red";
|
|
||||||
$update_count++;
|
$update_count++;
|
||||||
/*
|
|
||||||
if($remote_server == "(G3)"){
|
|
||||||
$module_info->name = "<a href=\"http://github.com/gallery/gallery3/tree/master/modules/".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
|
||||||
}else if($remote_server == "(G3CC)"){
|
|
||||||
$module_info->name = "<a href=\"http://github.com/gallery/gallery3-contrib/tree/master/modules/".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
|
||||||
}else if($remote_server == "(brentil)"){
|
|
||||||
$module_info->name = "<a href=\"http://github.com/brentil/gallery3-contrib/tree/master/modules/".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_info->name = "<a href=\"http://codex.gallery2.org/Gallery3:Modules:".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
$module_info->name = "<a href=\"http://codex.gallery2.org/Gallery3:Modules:".$this_module_name."\" target=\"_new\">".$module_info->name."</a>";
|
||||||
|
|
||||||
|
if (is_numeric($core_version)) {
|
||||||
|
if($core_version > $module_info->version) {
|
||||||
|
$core_dlink = "http://github.com/gallery/gallery3/tree/master/modules/".$this_module_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_numeric($contrib_version)) {
|
||||||
|
if($contrib_version > $module_info->version) {
|
||||||
|
$contrib_dlink = "http://github.com/gallery/gallery3-contrib/tree/master/".
|
||||||
|
substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")) ."/modules/".$this_module_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_numeric($gh_version)) {
|
||||||
|
if($gh_version > $module_info->version) {
|
||||||
|
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
||||||
|
if($this_gm_repo == "30"){
|
||||||
|
$gh_dlink = "http://www.gallerymodules.com/update/".$this_module_name;
|
||||||
|
} else {
|
||||||
|
$gh_dlink = "http://www.gallerymodules.com/update".this_gm_repo."/".$this_module_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//populate the list fo modules and their data
|
//populate the list fo modules and their data
|
||||||
$cache->$this_module_name = array ("name" => $module_info->name, "locked" => $module_info->locked,
|
$cache->$this_module_name = array ("name" => $module_info->name, "locked" => $module_info->locked,
|
||||||
"code_version" => $module_info->code_version, "active" => $module_info->active,
|
"code_version" => $module_info->code_version, "active" => $module_info->active,
|
||||||
"version" => $module_info->version,"description" => $module_info->description,
|
"version" => $module_info->version,"description" => $module_info->description,
|
||||||
"remote_version" => $remote_version, "remote_server" => $remote_server, "font_color" => $font_color);
|
"core_version" => $core_version, "core_server" => $core_server, "font_color_core" => $font_color_core,
|
||||||
|
"contrib_version" => $contrib_version, "contrib_server" => $contrib_server, "font_color_contrib" => $font_color_contrib,
|
||||||
|
"gh_version" => $gh_version, "gh_server" => $gh_server, "font_color_gh" => $font_color_gh,
|
||||||
|
"font_color_local" => $font_color_local, "core_dlink" => $core_dlink, "contrib_dlink" => $contrib_dlink,
|
||||||
|
"gh_dlink" => $gh_dlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Define right now as YYYY.MM.DD HH:MM with the # of updates that are out of date
|
//Define right now as YYYY.MM.DD HH:MM with the # of updates that are out of date
|
||||||
$cache_updates = array("date" => date("Y.m.d - H:i"), "updates" => $update_count);
|
$cache_updates = array("date" => date("Y.m.d - H:i"), "updates" => $update_count);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
//echo 'Message 02: ' .$cache_updates . '<br>';
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//Write out the new data to cache with a 30 day expiration & 0 for update data so it's always present
|
//Write out the new data to cache with a 30 day expiration & 0 for update data so it's always present
|
||||||
Cache::instance()->set("moduleupdates_cache", serialize($cache), array("ModuleUpdates"), 30*86400);
|
Cache::instance()->set("moduleupdates_cache", serialize($cache), array("ModuleUpdates"), 30*86400);
|
||||||
Cache::instance()->set("moduleupdates_cache_updates", serialize($cache_updates), array("ModuleUpdates"), null);
|
Cache::instance()->set("moduleupdates_cache_updates", serialize($cache_updates), array("ModuleUpdates"), null);
|
||||||
@ -167,12 +171,59 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$view->content->csrf = access::csrf_token();
|
$view->content->csrf = access::csrf_token();
|
||||||
$view->content->Google = $Google;
|
$view->content->Google = $Google;
|
||||||
$view->content->GitHub = $GitHub;
|
$view->content->GitHub = $GitHub;
|
||||||
|
$view->content->Gallery_Version = substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "));
|
||||||
|
|
||||||
|
|
||||||
print $view;
|
print $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
private function get_module_version_color ($version, $code_version, $remote_version) {
|
||||||
|
|
||||||
|
$font_color = "black";
|
||||||
|
|
||||||
|
//BLACK - no module version detected
|
||||||
|
if ($remote_version == "") {
|
||||||
|
$font_color = "black";
|
||||||
|
//BLUE - DNE: Does Not Exist, this module was not found
|
||||||
|
} else if ($remote_version == "DNE") {
|
||||||
|
$font_color = "blue";
|
||||||
|
//GREEN - Your version is newer than the GitHub
|
||||||
|
} else if ($remote_version < $code_version or ($version != ''
|
||||||
|
and $remote_version < $version)) {
|
||||||
|
$font_color = "green";
|
||||||
|
//RED - Your version is older than the GitHub
|
||||||
|
} else if ($remote_version > $code_version or ($version != ''
|
||||||
|
and $remote_version > $version)) {
|
||||||
|
$font_color = "red";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $font_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
private function get_local_module_version_color ($version, $code_version) {
|
||||||
|
|
||||||
|
$font_color = "black";
|
||||||
|
|
||||||
|
//PINK - Your installed version is newer than file version
|
||||||
|
if ($version != '' and $code_version < $version) {
|
||||||
|
$font_color = "pink";
|
||||||
|
//ORANGE - Your file version is newer than the installed version
|
||||||
|
} else if ($version != '' and $code_version > $version) {
|
||||||
|
$font_color = "orange";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $font_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the known GitHub repositories for new versions of modules.
|
* Parses the known GitHub repositories for new versions of modules.
|
||||||
*
|
*
|
||||||
@ -182,66 +233,83 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
*
|
*
|
||||||
* http://github.com/gallery/gallery3
|
* http://github.com/gallery/gallery3
|
||||||
* http://github.com/gallery/gallery3-contrib
|
* http://github.com/gallery/gallery3-contrib
|
||||||
|
* http://www.gallerymodules.com
|
||||||
*
|
*
|
||||||
* @author brentil <forums@inner-ninja.com>
|
* @author brentil <forums@inner-ninja.com>
|
||||||
* @param String The folder name of the module to search for on the remote GitHub server
|
* @param String - The folder name of the module to search for on the remote GitHub server
|
||||||
* @return Array An array with the remote module version and the server it was found on.
|
* @param String - The remote server to check against
|
||||||
|
* @return Array - An array with the remote module version and the server it was found on.
|
||||||
*/
|
*/
|
||||||
private function get_remote_module_version ($module_name, $devDebug) {
|
private function get_remote_module_version ($module_name, $server_location) {
|
||||||
|
|
||||||
$version = 'DNE';
|
$version = '';
|
||||||
$server = '';
|
$server = '';
|
||||||
$file = null;
|
$file = null;
|
||||||
|
|
||||||
//For development debug only
|
switch ($server_location) {
|
||||||
if ($devDebug == true){
|
case "CONTRIB":
|
||||||
|
//Check the Gallery3 Community Contributions GitHub
|
||||||
if ($file == null) {
|
if ($file == null) {
|
||||||
try {
|
try {
|
||||||
$file = fopen ("http://github.com/brentil/gallery3-contrib/raw/master/3.1/modules/".$module_name."/module.info", "r");
|
$file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/".
|
||||||
|
substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "))."/modules/".$module_name."/module.info", "r");
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
$server = '(brentil)';
|
$server = '(GCC)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
case "CORE":
|
||||||
//Check the main Gallery3 GitHub
|
//Check the main Gallery3 GitHub
|
||||||
if ($file == null) {
|
if ($file == null) {
|
||||||
try {
|
try {
|
||||||
$file = fopen ("http://github.com/gallery/gallery3/raw/master/modules/".$module_name."/module.info", "r");
|
$file = fopen ("http://github.com/gallery/gallery3/raw/master/modules/".$module_name."/module.info", "r");
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
$server = '(G3)';
|
$server = '(G)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
//Check the Gallery3 Community Contributions GitHub
|
case "GH":
|
||||||
|
//Check GalleryModules.com
|
||||||
if ($file == null) {
|
if ($file == null) {
|
||||||
try {
|
try {
|
||||||
$file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/3.1/modules/".$module_name."/module.info", "r");
|
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
||||||
|
if($this_gm_repo == "30"){
|
||||||
|
$file = fopen ("http://www.gallerymodules.com/m/".$module_name, "r");
|
||||||
|
} else {
|
||||||
|
$file = fopen ("http://www.gallerymodules.com/".this_gm_repo."m/".$module_name, "r");
|
||||||
|
}
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
$server = '(G3CC)';
|
$server = '(GH)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
while (!feof ($file)) {
|
while (!feof ($file)) {
|
||||||
$line = fgets ($file, 1024);
|
$line = fgets ($file, 1024);
|
||||||
|
if ($server_location == "GH"){
|
||||||
|
//GH stores only the version info
|
||||||
|
if($line == "Not entered" or $line == "See git") {
|
||||||
|
$line = "";
|
||||||
|
}
|
||||||
|
$version = $line;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
//Regular expression to find & gather the version number in the remote module.info file
|
//Regular expression to find & gather the version number in the remote module.info file
|
||||||
if (preg_match ("@version = (.*)@i", $line, $out)) {
|
if (preg_match ("@version = (.*)@i", $line, $out)) {
|
||||||
$version = $out[1];
|
$version = $out[1];
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose ($file);
|
fclose ($file);
|
||||||
|
@ -23,8 +23,8 @@ class moduleupdates_installer {
|
|||||||
static function install() {
|
static function install() {
|
||||||
|
|
||||||
$version = module::get_version("moduleupdates");
|
$version = module::get_version("moduleupdates");
|
||||||
if ($version == 0) {
|
if ($version < 1) {
|
||||||
module::set_version("moduleupdates", 2);
|
module::set_version("moduleupdates", 5);
|
||||||
//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", 2);
|
module::set_version("moduleupdates", 5);
|
||||||
//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
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name = "Module Updates"
|
name = "Module Updates"
|
||||||
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 = 3
|
version = 5
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<div id="g-admin-moduleupdates" class="g-block">
|
<div id="g-admin-moduleupdates" class="g-block">
|
||||||
<h1> <?= t("Module Updates v2.0") ?> </h1>
|
<h1> <?= t("Module Updates v5.0") ?> </h1>
|
||||||
<?= t("Compares your installed module version against the ones stored in the GitHub.") ?>
|
<?= t("Compares your installed module version against the ones stored in the GitHub and GalleryModules.") ?>
|
||||||
|
|
||||||
<div class="g-block-content">
|
<div class="g-block-content">
|
||||||
|
|
||||||
@ -16,7 +16,6 @@
|
|||||||
<li><?= t("<font color=green>Green = Your version is newer than the GitHub</font><br>") ?></li>
|
<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=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("<font color=pink>Pink = Your installed version is newer than file version</font><br>") ?></li>
|
||||||
<li><?= t("<font color=blue>Blue = Does Not Exist/No information available</font><br>") ?></li>
|
|
||||||
<li><?= t("Outbound Status: " . $Google . " - GitHub Status: " . $GitHub . "<br>") ?></li>
|
<li><?= t("Outbound Status: " . $Google . " - GitHub Status: " . $GitHub . "<br>") ?></li>
|
||||||
<li><input type="submit" value="<?= t("Check Modules for Updates")?>" class="submit" /> <? if($update_time == ""){ echo " - Last Scan: Unknown";}else{ echo " - Last Scan: ".$update_time;} ?></li>
|
<li><input type="submit" value="<?= t("Check Modules for Updates")?>" class="submit" /> <? if($update_time == ""){ echo " - Last Scan: Unknown";}else{ echo " - Last Scan: ".$update_time;} ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -25,24 +24,36 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
<ul id="g-action-status" class="g-message-block">
|
<ul id="g-action-status" class="g-message-block">
|
||||||
<li class="g-warning"><?= t("Versions are compared from the official Gallery3 (G3) and official Gallery3 Community Contributions (G3CC). Versions downloaded from the forums will not be shown.") ?></li>
|
<li class="g-warning"><?= t("Versions are compared from GitHub for Gallery Core (GC), Gallery Community Contributions (GCC), and GalleryModules.com (GM). Versions downloaded from the forums will not be shown.") ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th> <?= t("Module") ?> </th>
|
<th> <?= t("Module") ?> </th>
|
||||||
<th> <?= t("Your Version<br>[File/Installed]") ?> </th>
|
<th><center> <?= t("Local /<br>Installed") ?> </center></th>
|
||||||
<th> <?= t("Remote Version") ?> </th>
|
<th width=50><center> <?= t("GC") ?> </center></th>
|
||||||
|
<th width=50><center> <?= t("GCC") ?> </center></th>
|
||||||
|
<th width=85><center> <?= t("GM") ?> </center></th>
|
||||||
<th> <?= t("Description") ?> </th>
|
<th> <?= t("Description") ?> </th>
|
||||||
</tr>
|
</tr>
|
||||||
<? foreach ($vars as $module_name): ?>
|
<? foreach ($vars as $module_name): ?>
|
||||||
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||||
<td> <? echo "<font color=".$module_name['font_color'].">"; ?> <?= t($module_name['name']) ?> </font> </td>
|
<td> <?= t($module_name['name']) ?> </td>
|
||||||
<td> <? echo "<font color=".$module_name['font_color'].">"; ?> <?= $module_name['code_version'] ?><? if ($module_name['version'] != '') echo "/".$module_name['version']; ?> </font> </td>
|
<td align=center> <? echo "<font color=".$module_name['font_color_local'].">"; ?> <? if($module_name['font_color_local'] != "black"){ echo "<b><u>*"; } ?> <? if (is_numeric($module_name['code_version'])) echo $module_name['code_version']; ?><? if (is_numeric($module_name['version'])) echo " / ".$module_name['version']; ?> <? if($module_name['font_color_local'] != "black"){ echo "*</b></u>"; } ?> </td>
|
||||||
<td> <? echo "<font color=".$module_name['font_color'].">"; ?> <?= $module_name['remote_version'] ?> <?= $module_name['remote_server'] ?> </font> </td>
|
<td align=center> <? echo "<font color=".$module_name['font_color_core'].">"; ?> <? if($module_name['font_color_core'] != "black" and $module_name['font_color_core'] != "" ){ echo "<b><u>*"; } ?> <? if(is_numeric($module_name['core_version'])) if($module_name['core_version'] > $module_name['code_version']) { echo "<a href=\"".$module_name['core_dlink']."\" target=\"_blank\">".$module_name['core_version']."</a>";} else { echo $module_name['core_version']; } ?> <? if($module_name['font_color_core'] != "black"){ echo "*</b></u>"; } ?> </font> </td>
|
||||||
<td> <? echo "<font color=".$module_name['font_color'].">"; ?> <?= t($module_name['description']) ?> </font> </td>
|
<td align=center> <? echo "<font color=".$module_name['font_color_contrib'].">"; ?> <? if($module_name['font_color_contrib'] != "black" and $module_name['font_color_contrib'] != "" ){ echo "<b><u>*"; } ?> <? if(is_numeric($module_name['contrib_version'])) if($module_name['contrib_version'] > $module_name['version'] or $module_name['core_version'] > $module_name['code_version']) { echo "<a href=\"".$module_name['contrib_dlink']."\" target=\"_blank\">".$module_name['contrib_version']."</a>";} else { echo $module_name['contrib_version']; } ?> <? if($module_name['font_color_contrib'] != "black"){ echo "*</b></u>"; } ?> </font> </td>
|
||||||
|
<td align=center> <? echo "<font color=".$module_name['font_color_gh'].">"; ?> <? if($module_name['font_color_gh'] != "black" and $module_name['font_color_gh'] != "" ){ echo "<b><u>*"; } ?> <? if(is_numeric($module_name['gh_version'])) if($module_name['gh_version'] > $module_name['version'] or $module_name['core_version'] > $module_name['code_version']) { echo "<a href=\"".$module_name['gh_dlink']."\" target=\"_blank\">".$module_name['gh_version']."</a>";} else { echo $module_name['gh_version']; } ?> <? if($module_name['font_color_gh'] != "black"){ echo "*</b></u>"; } ?> </font> </td>
|
||||||
|
<td> <?= t($module_name['description']) ?> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<? endforeach ?>
|
<? endforeach ?>
|
||||||
|
<tr>
|
||||||
|
<th> <?= t("Module") ?> </th>
|
||||||
|
<th><center> <?= t("Local /<br>Installed") ?> </center></th>
|
||||||
|
<th width=50><center> <?= t("GC") ?> </center></th>
|
||||||
|
<th width=50><center> <?= t("GCC") ?> </center></th>
|
||||||
|
<th width=85><center> <?= t("GM") ?> </center></th>
|
||||||
|
<th> <?= t("Description") ?> </th>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Reference in New Issue
Block a user