mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Issue #2818 Moved core database update check to ajax.
This commit is contained in:
parent
ab76e96e86
commit
1069998c42
@ -285,6 +285,8 @@ class admin_start
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
$checked = e107::getSession()->get('core-update-checked');
|
||||
|
||||
|
@ -35,6 +35,24 @@ if(ADMIN && defset('e_ADMIN_UI') && varset($_POST['mode']) == 'sef' && !empty($_
|
||||
exit;
|
||||
}
|
||||
|
||||
if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'update'))
|
||||
{
|
||||
|
||||
require_once(e_ADMIN.'update_routines.php');
|
||||
|
||||
e107::getSession()->set('core-update-checked',false);
|
||||
|
||||
$status = (update_check() === true) ? true : false;
|
||||
|
||||
e107::getSession()->set('core-update-status',$status);
|
||||
|
||||
echo json_encode($status);
|
||||
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'feed'))
|
||||
{
|
||||
|
||||
|
@ -26,6 +26,8 @@ require_once ("update_routines.php");
|
||||
|
||||
new e107Update($dbupdate);
|
||||
|
||||
e107::getSession()->set('core-update-status', false); // reset update status.
|
||||
|
||||
require_once ("footer.php");
|
||||
|
||||
|
||||
|
@ -226,7 +226,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel
|
||||
// --------------------- Add-on updates ---------------------------
|
||||
$ns->setStyle('flexpanel');
|
||||
$ns->setUniqueId('e-addon-updates');
|
||||
$addonUpdates = $tp->parseTemplate("{ADMIN_ADDON_UPDATES}", true, $admin_sc);
|
||||
$addonUpdates = $admin_sc->sc_admin_addon_updates();
|
||||
$info = $this->getMenuPosition('e-addon-updates');
|
||||
$panels[$info['area']][$info['weight']] .= $addonUpdates;
|
||||
|
||||
|
@ -29,13 +29,61 @@ class adminstyle_infopanel
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
||||
$coreUpdateCheck = '';
|
||||
|
||||
|
||||
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>');
|
||||
|
||||
$.get('".e_ADMIN."admin.php?mode=core&type=update', function( data ) {
|
||||
|
||||
var res = $.parseJSON(data);
|
||||
|
||||
if(res === true)
|
||||
{
|
||||
$('#e-admin-core-update').html('<span class=\"text-info\"><i class=\"fa fa-database\"></i></span>');
|
||||
|
||||
$('[data-toggle=\"popover\"]').popover('show');
|
||||
$('.popover').on('click', function()
|
||||
{
|
||||
$('[data-toggle=\"popover\"]').popover('hide');
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#e-admin-core-update').text('');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$code = "
|
||||
jQuery(function($){
|
||||
$('#e-adminfeed').load('".e_ADMIN."admin.php?mode=core&type=feed');
|
||||
$('#e-adminfeed-plugin').load('".e_ADMIN."admin.php?mode=addons&type=plugin');
|
||||
$('#e-adminfeed-theme').load('".e_ADMIN."admin.php?mode=addons&type=theme');
|
||||
|
||||
".$coreUpdateCheck."
|
||||
|
||||
});
|
||||
";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
e107::js('inline',$code,'jquery');
|
||||
|
||||
|
@ -1393,6 +1393,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
||||
return null;
|
||||
}
|
||||
|
||||
e107::getDb()->db_mark_time("sc_admin_addon_updates() // start");
|
||||
|
||||
$themes = $this->getUpdateable('theme');
|
||||
$plugins = $this->getUpdateable('plugin');
|
||||
@ -1408,6 +1409,10 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
||||
|
||||
$tp = e107::getParser();
|
||||
$ns->setUniqueId('e-addon-updates');
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -1429,7 +1434,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
||||
{
|
||||
case "theme":
|
||||
$versions = $mp->getVersionList('theme');
|
||||
$list = e107::getTheme()->getThemeList('version');
|
||||
$list = e107::getTheme()->getList('version');
|
||||
break;
|
||||
|
||||
case "plugin":
|
||||
@ -1884,9 +1889,17 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
||||
|
||||
if($parm == 'enav_popover') // @todo move to template and make generic.
|
||||
{
|
||||
if('0' != ADMINPERMS)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$template = $$tmpl;
|
||||
|
||||
return $template['start']. '<li><a tabindex="0" href="'.e_ADMIN_ABS.'e107_update.php" class="hide e-popover text-primary" role="button" data-container="body" data-toggle="popover" data-placement="right" data-trigger="bottom" data-content="'.$tp->toAttribute(ADLAN_120).'"><span class="text-info">'.$tp->toGlyph('fa-database').'</span></a></li>' .$template['end'];
|
||||
|
||||
$upStatus = (e107::getSession()->get('core-update-status') === true) ? "<span title=\"".ADLAN_120."\" class=\"text-info\"><i class=\"fa fa-database\"></i></span>" : '<!-- -->';
|
||||
|
||||
return $template['start']. '<li><a id="e-admin-core-update" tabindex="0" href="'.e_ADMIN_ABS.'e107_update.php" class="e-popover text-primary" role="button" data-container="body" data-toggle="popover" data-placement="right" data-trigger="bottom" data-content="'.$tp->toAttribute(ADLAN_120).'">'.$upStatus.'</a></li>' .$template['end'];
|
||||
|
||||
}
|
||||
|
||||
|
@ -281,4 +281,4 @@ $NEWSSTYLE = '
|
||||
';
|
||||
|
||||
*/
|
||||
?>
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user