コード例 #1
0
ファイル: etsis_CLI.php プロジェクト: parkerj/eduTrac-SIS
 public static function getCurrentRelease()
 {
     $update = new \VisualAppeal\AutoUpdate('app/tmp', 'app/tmp', 1800);
     $update->setCurrentVersion(trim(file_get_contents('RELEASE')));
     $update->setUpdateUrl('http://etsis.s3.amazonaws.com/core/1.1/update-check');
     $update->addLogHandler(new Monolog\Handler\StreamHandler('app/tmp/logs/core-update.' . date('m-d-Y') . '.txt'));
     $update->setCache(new Desarrolla2\Cache\Adapter\File('app/tmp/cache'), 3600);
     if ($update->checkUpdate() !== false) {
         if ($update->newVersionAvailable()) {
             return $update->getLatestVersion();
         }
     }
 }
コード例 #2
0
ファイル: hook-function.php プロジェクト: parkerj/eduTrac-SIS
/**
 * Shows update message when a new release of
 * eduTrac SIS is available.
 *
 * @since 4.0.0
 */
function show_update_message()
{
    $app = \Liten\Liten::getInstance();
    $acl = new \app\src\ACL(get_persondata('personID'));
    if ($acl->userHasRole(8)) {
        $update = new \VisualAppeal\AutoUpdate(rtrim($app->config('file.savepath'), '/'), BASE_PATH, 1800);
        $update->setCurrentVersion(RELEASE_TAG);
        $update->setUpdateUrl('https://etsis.s3.amazonaws.com/core/1.1/update-check');
        // Optional:
        $update->addLogHandler(new Monolog\Handler\StreamHandler(APP_PATH . 'tmp/logs/core-update.' . date('m-d-Y') . '.txt'));
        $update->setCache(new Desarrolla2\Cache\Adapter\File(APP_PATH . 'tmp/cache'), 3600);
        if ($update->checkUpdate() !== false) {
            if ($update->newVersionAvailable()) {
                $alert = '<div class="alerts alerts-warn center">';
                $alert .= sprintf(_t('eduTrac SIS release %s is available for download/upgrade. Before upgrading, make sure to <a href="%s">backup your system</a>.'), $update->getLatestVersion(), 'https://www.edutracsis.com/manual/edutrac-sis-backups/');
                $alert .= '</div>';
            }
        }
    }
    return $app->hook->apply_filter('update_message', $alert);
}
コード例 #3
0
ファイル: core.php プロジェクト: parkerj/eduTrac-SIS
 /**
  * Use this command to check for a new update.
  * 
  * ## EXAMPLES  
  * 
  *      #Displays need for update or not.
  *      $ ./etsis core check_update
  */
 public function check_update()
 {
     $update = new \VisualAppeal\AutoUpdate('app/tmp', 'app/tmp', 1800);
     $update->setCurrentVersion(trim(file_get_contents('RELEASE')));
     $update->setUpdateUrl('http://etsis.s3.amazonaws.com/core/1.1/update-check');
     // Optional:
     $update->addLogHandler(new Monolog\Handler\StreamHandler('app/tmp/logs/core-update.' . date('m-d-Y') . '.txt'));
     $update->setCache(new Desarrolla2\Cache\Adapter\File('app/tmp/cache'), 3600);
     if ($update->checkUpdate() !== false) {
         if ($update->newVersionAvailable()) {
             ETSIS_CLI::line('Release %G' . $update->getLatestVersion() . '%n is available.');
             ETSIS_CLI::line('Do a backup before upgrading: https://www.edutracsis.com/manual/edutrac-sis-backups/');
         } else {
             ETSIS_CLI::line('%GSuccess:%n eduTrac SIS is at the latest release.');
         }
     }
 }