/** * Check to see if there are updates availablw * * @access public * @return boolean */ public static function hasUpdatesAvailable() { global $lC_Database, $lC_Language; $lC_Language->loadIniFile('updates.php'); $result = array(); $available = self::getAvailablePackages(); $result['hasUpdates'] = $available['total'] > 0; $lastChecked = date("Y-m-d H:i:s"); $result['lastChecked'] = $lC_Language->get('text_last_checked') . ' ' . lC_DateTime::getLong($lastChecked, TRUE); $result['total'] = $available['total']; if ($result['hasUpdates']) { $to_version = 0; $to_version_date = ''; foreach ($available['entries'] as $k => $v) { if (version_compare($to_version, $v['version'], '<')) { $to_version = $v['version']; $to_version_date = $v['date']; } } } else { $to_version = utility::getVersion(); $to_version_date = utility::getVersionDate(); } $result['toVersion'] = $to_version; $result['toVersionDate'] = $to_version_date; // update last checked value $lC_Database->startTransaction(); if (!defined('UPDATE_LAST_CHECKED')) { $Qupdate = $lC_Database->query('insert into :table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, last_modified) values (:configuration_title, :configuration_key, :configuration_value, :configuration_description, :configuration_group_id, :last_modified)'); $Qupdate->bindValue(':configuration_title', 'Update Last Checked'); $Qupdate->bindValue(':configuration_key', 'UPDATE_LAST_CHECKED'); $Qupdate->bindValue(':configuration_value', 'See Last Modified'); $Qupdate->bindValue(':configuration_description', 'Update Last Checked'); $Qupdate->bindValue(':configuration_group_id', '6'); } else { $Qupdate = $lC_Database->query("update :table_configuration set last_modified = :last_modified where configuration_key = 'UPDATE_LAST_CHECKED'"); } $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION); $Qupdate->bindValue(':last_modified', $lastChecked); $Qupdate->setLogging($_SESSION['module']); $Qupdate->execute(); if (!$lC_Database->isError()) { $lC_Database->commitTransaction(); $result['rpcStatus'] = 1; } else { $lC_Database->rollbackTransaction(); $result['rpcStatus'] = -1; } return $result; }
// set maint mode=on __setMaintenanceMode('on'); var toVersion = '<?php echo $checkArr['toVersion']; ?> '; $('#versionContainer .fieldset').removeClass('orange-gradient'); $('#version-table tbody').removeClass('green').removeClass('red'); $('#version-table > tbody').empty(); $('#version-table').css("margin-bottom", "10px"); $('#version-table > thead').html('<tr><td class="before"><?php echo $lC_Language->get('text_latest_version'); ?> </td><td class="version">' + toVersion + '</td><td class="after"><?php echo sprintf($lC_Language->get('text_released'), utility::getVersionDate()); ?> </td></tr>').addClass('red'); $('#version-table > tbody').html('<tr><td colspan="3"><span id="updateProgressContainer" style="display:none;"></span></td></tr>'); // start the update process $('#updateButtonset').slideUp(); $('.update-text').html('<p><?php echo $lC_Language->get('text_initializing'); ?> </p>').attr('style', 'text-align:center').blink({ maxBlinks: 5, blinkPeriod: 1000 }); setTimeout(function() { __setup(); __showStep(1,0); $('#vFooterText').html(__cancelBlock()).show();