1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Issue #2818 Moved addons update check to ajax.

This commit is contained in:
Cameron
2017-11-16 14:20:22 -08:00
parent a253cdcf69
commit 3baf2f776f
4 changed files with 60 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ if(ADMIN && defset('e_ADMIN_UI') && varset($_POST['mode']) == 'sef' && !empty($_
exit;
}
if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'update'))
if(getperms('0') && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'update'))
{
require_once(e_ADMIN.'update_routines.php');
@@ -52,6 +52,38 @@ if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type']
}
if(getperms('0') && e_AJAX_REQUEST && varset($_GET['mode']) == 'addons' && ($_GET['type'] == 'update'))
{
e107::getSession()->set('addons-update-checked',true);
$sc = e107::getScBatch('admin');
$themes = $sc->getUpdateable('theme');
$plugins = $sc->getUpdateable('plugin');
$text = $sc->renderAddonUpdate($plugins);
$text .= $sc->renderAddonUpdate($themes);
if(empty($text))
{
exit;
}
$ns = e107::getRender();
$tp = e107::getParser();
$ns->setUniqueId('e-addon-updates');
$ns->setStyle('warning');
$ret = $ns->tablerender($tp->toGlyph('fa-arrow-circle-o-down').LAN_UPDATE_AVAILABLE,$text,'default', true);
echo $ret;
e107::getSession()->set('addons-update-status',$ret);
exit;
}
if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'feed'))
{

View File

@@ -31,12 +31,13 @@ class adminstyle_infopanel
{
$coreUpdateCheck = '';
$addonUpdateCheck = '';
if( e107::getSession()->get('core-update-status') !== true)
{
$coreUpdateCheck = "
$('#e-admin-core-update').html('<i title=\"Checking for updates\" class=\"fa fa-spinner fa-spin\"></i>');
$('#e-admin-core-update').html('<i title=\"".LAN_CHECKING_FOR_UPDATES."\" class=\"fa fa-spinner fa-spin\"></i>');
$.get('".e_ADMIN."admin.php?mode=core&type=update', function( data ) {
var res = $.parseJSON(data);
@@ -63,7 +64,13 @@ class adminstyle_infopanel
}
if( e107::getSession()->get('addons-update-checked') !== true)
{
$addonUpdateCheck = "
$('#e-admin-addons-update').load('".e_ADMIN."admin.php?mode=addons&type=update');
";
}
@@ -74,6 +81,7 @@ class adminstyle_infopanel
$('#e-adminfeed-theme').load('".e_ADMIN."admin.php?mode=addons&type=theme');
".$coreUpdateCheck."
".$addonUpdateCheck."
});
";

View File

@@ -1393,6 +1393,17 @@ Inverse 10 <span class="badge badge-inverse">10</span>
return null;
}
$res = e107::getSession()->get('addons-update-status');
if($res !== null)
{
return $res;
}
return "<div id='e-admin-addons-update'><!-- --></div>";
/*
e107::getDb()->db_mark_time("sc_admin_addon_updates() // start");
$themes = $this->getUpdateable('theme');
@@ -1413,13 +1424,16 @@ Inverse 10 <span class="badge badge-inverse">10</span>
e107::getDb()->db_mark_time("sc_admin_addon_updates() // end");
return $ns->tablerender($tp->toGlyph('fa-arrow-circle-o-down').LAN_UPDATE_AVAILABLE,$text,'default',true);
return $ns->tablerender($tp->toGlyph('fa-arrow-circle-o-down').LAN_UPDATE_AVAILABLE,$text,'default',true);*/
}
private function getUpdateable($type)
public function getUpdateable($type)
{
if(empty($type))
@@ -1463,7 +1477,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
private function renderAddonUpdate($list)
public function renderAddonUpdate($list)
{
if(empty($list))

View File

@@ -542,4 +542,5 @@ define("LAN_ERROR_CONNECTION","Unable to connect for updates. Please check firew
define("LAN_UI_X_CANT_EQUAL_Y", "[x] cannot be the same as [y]");
define("LAN_UI_VIEW_GRID_LABEL", "Grid view");
define("LAN_UI_VIEW_LIST_LABEL", "List view");
define("LAN_CHECKING_FOR_UPDATES", "Checking for updates");