Merge pull request #97 from dmolavi/master
Update moduleupdates to use an ini file for core modules, too.
This commit is contained in:
commit
0d23d96d92
@ -64,7 +64,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$cache_updates = array("date" => "", "updates" => 0);
|
$cache_updates = array("date" => "", "updates" => 0);
|
||||||
$refreshCache = true;
|
$refreshCache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check the ability to access the Gallery3 GitHub
|
//Check the ability to access the Gallery3 GitHub
|
||||||
$GitHub = null;
|
$GitHub = null;
|
||||||
try {
|
try {
|
||||||
@ -95,17 +95,25 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
if($refreshCache == true){
|
if($refreshCache == true){
|
||||||
// Only poll GalleryModules.com once for the ini file.
|
// Only poll GalleryModules.com once for the ini file.
|
||||||
$fp = fopen('gm.ini', 'w');
|
$fp = fopen('gm.ini', 'w');
|
||||||
|
$fp2 = fopen('gm_core.ini','w');
|
||||||
if(function_exists("curl_init")) {
|
if(function_exists("curl_init")) {
|
||||||
$cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
|
$cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
|
||||||
curl_setopt($cp, CURLOPT_FILE, $fp);
|
curl_setopt($cp, CURLOPT_FILE, $fp);
|
||||||
|
|
||||||
$buffer = curl_exec($cp);
|
$buffer = curl_exec($cp);
|
||||||
|
|
||||||
curl_close($cp);
|
curl_close($cp);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
$cp = curl_init("http://www.gallerymodules.com/core.ini");
|
||||||
|
curl_setopt($cp, CURLOPT_FILE, $fp2);
|
||||||
|
$buffer = curl_exec($cp);
|
||||||
|
curl_close($cp);
|
||||||
|
fclose($fp2);
|
||||||
} else {
|
} else {
|
||||||
fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
|
fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
fwrite($fp2,file_get_contents("http://www.gallerymodules.com/sandbox/core.ini"));
|
||||||
|
fclose($fp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (module::available() as $this_module_name => $module_info) {
|
foreach (module::available() as $this_module_name => $module_info) {
|
||||||
@ -130,8 +138,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE");
|
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);
|
$font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version);
|
||||||
if(!is_numeric($core_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");
|
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);
|
$font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version);
|
||||||
}
|
}
|
||||||
@ -147,14 +153,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$core_dlink = "http://github.com/gallery/gallery3/tree/master/modules/".$this_module_name;
|
$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 (is_numeric($gh_version)) {
|
||||||
if($gh_version > $module_info->version) {
|
if($gh_version > $module_info->version) {
|
||||||
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
||||||
@ -188,6 +187,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unlink('gm.ini');
|
unlink('gm.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'];
|
||||||
@ -268,7 +268,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
* gather the version information. Uses the following locations;
|
* gather the version information. Uses the following locations;
|
||||||
*
|
*
|
||||||
* http://github.com/gallery/gallery3
|
* http://github.com/gallery/gallery3
|
||||||
* http://github.com/gallery/gallery3-contrib
|
|
||||||
* http://www.gallerymodules.com
|
* http://www.gallerymodules.com
|
||||||
*
|
*
|
||||||
* @author brentil <forums@inner-ninja.com>
|
* @author brentil <forums@inner-ninja.com>
|
||||||
@ -283,39 +282,17 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$file = null;
|
$file = null;
|
||||||
|
|
||||||
switch ($server_location) {
|
switch ($server_location) {
|
||||||
case "CONTRIB":
|
|
||||||
//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/".
|
|
||||||
$thisInstalledVersion ."/modules/".$module_name."/module.info", "r");
|
|
||||||
|
|
||||||
if ($file != null) {
|
|
||||||
$server = '(GCC)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception $e) {
|
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "CORE":
|
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");
|
if(file_exists('gm_core.ini')) {
|
||||||
if ($file != null) {
|
$file = 1;
|
||||||
$server = '(G)';
|
}
|
||||||
}
|
if ($file != null) {
|
||||||
|
$gm_core_array = parse_ini_file('gm_core.ini',true);
|
||||||
|
$server = '(G)';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
}
|
}
|
||||||
@ -347,15 +324,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$version = $gm_array[$module_name]['g31'];
|
$version = $gm_array[$module_name]['g31'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (!feof ($file)) {
|
$version = $gm_core_array[$module_name]['version'];
|
||||||
$line = fgets ($file, 1024);
|
|
||||||
//Regular expression to find & gather the version number in the remote module.info file
|
|
||||||
if (preg_match ("@version = (.*)@i", $line, $out)) {
|
|
||||||
$version = $out[1];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose ($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", 8);
|
module::set_version("moduleupdates", 10);
|
||||||
//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", 8);
|
module::set_version("moduleupdates", 10);
|
||||||
//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,7 +1,7 @@
|
|||||||
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 = 9
|
version = 10
|
||||||
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"
|
||||||
discuss_url = "http://gallery.menalto.com/node/96574"
|
discuss_url = "http://gallery.menalto.com/node/96574"
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<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 GitHub for Gallery Core (GC), Gallery Community Contributions (GCC), and GalleryModules.com (GM). Versions downloaded from the forums will not be shown.") ?></li>
|
<li class="g-warning"><?= t("Versions are compared from GitHub for Gallery Core (GC) and GalleryModules.com (GM). Versions downloaded from the forums will not be shown.") ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Core Modules</legend>
|
<legend>Core Modules</legend>
|
||||||
@ -45,7 +45,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<? endforeach ?>
|
<? endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Community Contributed Modules</legend>
|
<legend>Community Contributed Modules</legend>
|
||||||
@ -53,7 +53,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th> <?= t("Module") ?> </th>
|
<th> <?= t("Module") ?> </th>
|
||||||
<th><center> <?= t("Local /<br>Installed") ?> </center></th>
|
<th><center> <?= t("Local /<br>Installed") ?> </center></th>
|
||||||
<th width=50><center> <?= t("GCC") ?> </center></th>
|
|
||||||
<th width=85><center> <?= t("GM") ?> </center></th>
|
<th width=85><center> <?= t("GM") ?> </center></th>
|
||||||
<th> <?= t("Description") ?> </th>
|
<th> <?= t("Description") ?> </th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -62,7 +61,6 @@
|
|||||||
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||||
<td> <?= t($module_name['name']) ?> </td>
|
<td> <?= t($module_name['name']) ?> </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 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 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 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>
|
<td> <?= t($module_name['description']) ?> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -64,7 +64,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$cache_updates = array("date" => "", "updates" => 0);
|
$cache_updates = array("date" => "", "updates" => 0);
|
||||||
$refreshCache = true;
|
$refreshCache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check the ability to access the Gallery3 GitHub
|
//Check the ability to access the Gallery3 GitHub
|
||||||
$GitHub = null;
|
$GitHub = null;
|
||||||
try {
|
try {
|
||||||
@ -95,17 +95,25 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
if($refreshCache == true){
|
if($refreshCache == true){
|
||||||
// Only poll GalleryModules.com once for the ini file.
|
// Only poll GalleryModules.com once for the ini file.
|
||||||
$fp = fopen('gm.ini', 'w');
|
$fp = fopen('gm.ini', 'w');
|
||||||
|
$fp2 = fopen('gm_core.ini','w');
|
||||||
if(function_exists("curl_init")) {
|
if(function_exists("curl_init")) {
|
||||||
$cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
|
$cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
|
||||||
curl_setopt($cp, CURLOPT_FILE, $fp);
|
curl_setopt($cp, CURLOPT_FILE, $fp);
|
||||||
|
|
||||||
$buffer = curl_exec($cp);
|
$buffer = curl_exec($cp);
|
||||||
|
|
||||||
curl_close($cp);
|
curl_close($cp);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
$cp = curl_init("http://www.gallerymodules.com/core.ini");
|
||||||
|
curl_setopt($cp, CURLOPT_FILE, $fp2);
|
||||||
|
$buffer = curl_exec($cp);
|
||||||
|
curl_close($cp);
|
||||||
|
fclose($fp2);
|
||||||
} else {
|
} else {
|
||||||
fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
|
fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
fwrite($fp2,file_get_contents("http://www.gallerymodules.com/sandbox/core.ini"));
|
||||||
|
fclose($fp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (module::available() as $this_module_name => $module_info) {
|
foreach (module::available() as $this_module_name => $module_info) {
|
||||||
@ -130,8 +138,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE");
|
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);
|
$font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version);
|
||||||
if(!is_numeric($core_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");
|
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);
|
$font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version);
|
||||||
}
|
}
|
||||||
@ -147,14 +153,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$core_dlink = "http://github.com/gallery/gallery3/tree/master/modules/".$this_module_name;
|
$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 (is_numeric($gh_version)) {
|
||||||
if($gh_version > $module_info->version) {
|
if($gh_version > $module_info->version) {
|
||||||
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
||||||
@ -188,6 +187,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unlink('gm.ini');
|
unlink('gm.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'];
|
||||||
@ -268,7 +268,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
* gather the version information. Uses the following locations;
|
* gather the version information. Uses the following locations;
|
||||||
*
|
*
|
||||||
* http://github.com/gallery/gallery3
|
* http://github.com/gallery/gallery3
|
||||||
* http://github.com/gallery/gallery3-contrib
|
|
||||||
* http://www.gallerymodules.com
|
* http://www.gallerymodules.com
|
||||||
*
|
*
|
||||||
* @author brentil <forums@inner-ninja.com>
|
* @author brentil <forums@inner-ninja.com>
|
||||||
@ -283,39 +282,17 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$file = null;
|
$file = null;
|
||||||
|
|
||||||
switch ($server_location) {
|
switch ($server_location) {
|
||||||
case "CONTRIB":
|
|
||||||
//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/".
|
|
||||||
$thisInstalledVersion ."/modules/".$module_name."/module.info", "r");
|
|
||||||
|
|
||||||
if ($file != null) {
|
|
||||||
$server = '(GCC)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception $e) {
|
|
||||||
//echo 'Message: ' .$e->getMessage() . '<br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "CORE":
|
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");
|
if(file_exists('gm_core.ini')) {
|
||||||
if ($file != null) {
|
$file = 1;
|
||||||
$server = '(G)';
|
}
|
||||||
}
|
if ($file != null) {
|
||||||
|
$gm_core_array = parse_ini_file('gm_core.ini',true);
|
||||||
|
$server = '(G)';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
}
|
}
|
||||||
@ -347,15 +324,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$version = $gm_array[$module_name]['g31'];
|
$version = $gm_array[$module_name]['g31'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (!feof ($file)) {
|
$version = $gm_core_array[$module_name]['version'];
|
||||||
$line = fgets ($file, 1024);
|
|
||||||
//Regular expression to find & gather the version number in the remote module.info file
|
|
||||||
if (preg_match ("@version = (.*)@i", $line, $out)) {
|
|
||||||
$version = $out[1];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose ($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", 8);
|
module::set_version("moduleupdates", 10);
|
||||||
//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", 8);
|
module::set_version("moduleupdates", 10);
|
||||||
//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,7 +1,7 @@
|
|||||||
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 = 9
|
version = 10
|
||||||
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"
|
||||||
discuss_url = "http://gallery.menalto.com/node/96574"
|
discuss_url = "http://gallery.menalto.com/node/96574"
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<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 GitHub for Gallery Core (GC), Gallery Community Contributions (GCC), and GalleryModules.com (GM). Versions downloaded from the forums will not be shown.") ?></li>
|
<li class="g-warning"><?= t("Versions are compared from GitHub for Gallery Core (GC) and GalleryModules.com (GM). Versions downloaded from the forums will not be shown.") ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Core Modules</legend>
|
<legend>Core Modules</legend>
|
||||||
@ -45,7 +45,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<? endforeach ?>
|
<? endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Community Contributed Modules</legend>
|
<legend>Community Contributed Modules</legend>
|
||||||
@ -53,7 +53,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th> <?= t("Module") ?> </th>
|
<th> <?= t("Module") ?> </th>
|
||||||
<th><center> <?= t("Local /<br>Installed") ?> </center></th>
|
<th><center> <?= t("Local /<br>Installed") ?> </center></th>
|
||||||
<th width=50><center> <?= t("GCC") ?> </center></th>
|
|
||||||
<th width=85><center> <?= t("GM") ?> </center></th>
|
<th width=85><center> <?= t("GM") ?> </center></th>
|
||||||
<th> <?= t("Description") ?> </th>
|
<th> <?= t("Description") ?> </th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -62,7 +61,6 @@
|
|||||||
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
<tr class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||||
<td> <?= t($module_name['name']) ?> </td>
|
<td> <?= t($module_name['name']) ?> </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 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 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 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>
|
<td> <?= t($module_name['description']) ?> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Reference in New Issue
Block a user