Fix to really only poll GalleryModules.com once. This also only creates one local copy of the ini file to be scanned.
This commit is contained in:
parent
b2eafa02a2
commit
1bb03303cc
@ -93,6 +93,21 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$update_count = 0;
|
$update_count = 0;
|
||||||
|
|
||||||
if($refreshCache == true){
|
if($refreshCache == true){
|
||||||
|
// Only poll GalleryModules.com once for the ini file.
|
||||||
|
$fp = fopen('gm.ini', 'w');
|
||||||
|
if(function_exists("curl_init")) {
|
||||||
|
$cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
|
||||||
|
curl_setopt($cp, CURLOPT_FILE, $fp);
|
||||||
|
|
||||||
|
$buffer = curl_exec($cp);
|
||||||
|
|
||||||
|
curl_close($cp);
|
||||||
|
fclose($fp);
|
||||||
|
} else {
|
||||||
|
fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (module::available() as $this_module_name => $module_info) {
|
foreach (module::available() as $this_module_name => $module_info) {
|
||||||
|
|
||||||
$font_color_local = "black";
|
$font_color_local = "black";
|
||||||
@ -172,6 +187,8 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
log::success("moduleupdates", t("Completed checking remote GitHub for modules updates."));
|
log::success("moduleupdates", t("Completed checking remote GitHub for modules updates."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlink('gm.ini');
|
||||||
|
|
||||||
$view->content->vars = $cache;
|
$view->content->vars = $cache;
|
||||||
$view->content->update_time = $cache_updates['date'];
|
$view->content->update_time = $cache_updates['date'];
|
||||||
$view->content->csrf = access::csrf_token();
|
$view->content->csrf = access::csrf_token();
|
||||||
@ -305,37 +322,20 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "GH":
|
case "GH":
|
||||||
//Check GalleryModules.com
|
//Parse ini file from GalleryModules.com
|
||||||
if ($file == null) {
|
|
||||||
try {
|
try {
|
||||||
$fp = fopen('gm.ini', 'w');
|
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
||||||
if(function_exists("curl_init")) {
|
if(file_exists('gm.ini')) {
|
||||||
$cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
|
|
||||||
curl_setopt($cp, CURLOPT_FILE, $fp);
|
|
||||||
|
|
||||||
$buffer = curl_exec($cp);
|
|
||||||
|
|
||||||
curl_close($cp);
|
|
||||||
$file = 1;
|
|
||||||
fclose($fp);
|
|
||||||
} else {
|
|
||||||
fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
|
|
||||||
fclose($fp);
|
|
||||||
$file = 1;
|
$file = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
|
||||||
|
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
$gm_array = parse_ini_file('gm.ini',true);
|
$gm_array = parse_ini_file('gm.ini',true);
|
||||||
unlink('gm.ini');
|
|
||||||
$server = '(GH)';
|
$server = '(GH)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
echo $e;
|
echo $e;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,21 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
$update_count = 0;
|
$update_count = 0;
|
||||||
|
|
||||||
if($refreshCache == true){
|
if($refreshCache == true){
|
||||||
|
// Only poll GalleryModules.com once for the ini file.
|
||||||
|
$fp = fopen('gm.ini', 'w');
|
||||||
|
if(function_exists("curl_init")) {
|
||||||
|
$cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
|
||||||
|
curl_setopt($cp, CURLOPT_FILE, $fp);
|
||||||
|
|
||||||
|
$buffer = curl_exec($cp);
|
||||||
|
|
||||||
|
curl_close($cp);
|
||||||
|
fclose($fp);
|
||||||
|
} else {
|
||||||
|
fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (module::available() as $this_module_name => $module_info) {
|
foreach (module::available() as $this_module_name => $module_info) {
|
||||||
|
|
||||||
$font_color_local = "black";
|
$font_color_local = "black";
|
||||||
@ -172,6 +187,8 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
log::success("moduleupdates", t("Completed checking remote GitHub for modules updates."));
|
log::success("moduleupdates", t("Completed checking remote GitHub for modules updates."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlink('gm.ini');
|
||||||
|
|
||||||
$view->content->vars = $cache;
|
$view->content->vars = $cache;
|
||||||
$view->content->update_time = $cache_updates['date'];
|
$view->content->update_time = $cache_updates['date'];
|
||||||
$view->content->csrf = access::csrf_token();
|
$view->content->csrf = access::csrf_token();
|
||||||
@ -305,37 +322,20 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "GH":
|
case "GH":
|
||||||
//Check GalleryModules.com
|
//Parse ini file from GalleryModules.com
|
||||||
if ($file == null) {
|
|
||||||
try {
|
try {
|
||||||
$fp = fopen('gm.ini', 'w');
|
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
||||||
if(function_exists("curl_init")) {
|
if(file_exists('gm.ini')) {
|
||||||
$cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
|
|
||||||
curl_setopt($cp, CURLOPT_FILE, $fp);
|
|
||||||
|
|
||||||
$buffer = curl_exec($cp);
|
|
||||||
|
|
||||||
curl_close($cp);
|
|
||||||
$file = 1;
|
|
||||||
fclose($fp);
|
|
||||||
} else {
|
|
||||||
fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
|
|
||||||
fclose($fp);
|
|
||||||
$file = 1;
|
$file = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
|
|
||||||
|
|
||||||
if ($file != null) {
|
if ($file != null) {
|
||||||
$gm_array = parse_ini_file('gm.ini',true);
|
$gm_array = parse_ini_file('gm.ini',true);
|
||||||
unlink('gm.ini');
|
|
||||||
$server = '(GH)';
|
$server = '(GH)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
echo $e;
|
echo $e;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user