/**
  * @static
  * @return GantryUpdates
  */
 public static function &getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new GantryUpdates();
     }
     return self::$instance;
 }
Beispiel #2
0
function get_version_update_info()
{
    $buffer = '';
    gantry_import('core.gantryupdates');
    $gantry_updates = GantryUpdates::getInstance();
    $currentVersion = $gantry_updates->getCurrentVersion();
    $latest_version = $gantry_updates->getLatestVersion();
    if (version_compare($latest_version, $currentVersion, '>')) {
        $klass = "update";
        $upd = JText::sprintf('COM_GANTRY_VERSION_UPDATE_OUTOFDATE', $latest_version, 'index.php?option=com_installer&view=update');
    } else {
        $klass = "noupdate";
        jimport('joomla.utilities.date');
        $nextupdate = new JDate($gantry_updates->getLastUpdated() + 24 * 60 * 60);
        $upd = JText::sprintf('COM_GANTRY_VERSION_UPDATE_CURRENT', JHTML::_('date', $gantry_updates->getLastUpdated() + 24 * 60 * 60, JText::_('DATE_FORMAT_LC2'), true));
    }
    $buffer .= "\n    <div id='updater' class='" . $klass . "'>\n        <div id='updater-bar' class='h2bar'>Gantry <span>v" . $currentVersion . "</span></div>\n        <div id='updater-desc'>" . $upd . "</div>\n    </div>";
    return $buffer;
}
Beispiel #3
0
 public function checkForGantryUpdate()
 {
     gantry_import('core.gantryupdates');
     $gantry_updates = GantryUpdates::getInstance();
     $last_updated = $gantry_updates->getLastUpdated();
     $diff = time() - $last_updated;
     if ($diff > 60 * 60 * 24) {
         jimport('joomla.updater.updater');
         // check for update
         $updater = JUpdater::getInstance();
         $results = @$updater->findUpdates($gantry_updates->getGantryExtensionId());
         $gantry_updates->setLastChecked(time());
     }
 }