/** * Private constructor to ensure the singleton pattern is used correctly. */ private function __construct() { FileLock::setDirectory($GLOBALS['TMP_PATH']); $this->lock = new FileLock('studip-cronjob'); }
require '../lib/bootstrap.php'; require_once 'lib/migrations/db_migration.php'; require_once 'lib/migrations/db_schema_version.php'; require_once 'lib/migrations/migrator.php'; page_open(array("sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", "user" => "Seminar_User")); $auth->login_if(!$perm->have_perm("root")); $perm->check("root"); if (empty($_SESSION['_language'])) { $_SESSION['_language'] = get_accepted_languages(); } $_language_path = init_i18n($_SESSION['_language']); include 'lib/include/html_head.inc.php'; $path = $GLOBALS['STUDIP_BASE_PATH'] . '/db/migrations'; $verbose = true; $target = NULL; FileLock::setDirectory($GLOBALS['TMP_PATH']); $lock = new FileLock('web-migrate'); if ($lock->isLocked() && Request::int('release_lock')) { $lock->release(); } if (Request::int('target')) { $target = (int) Request::int('target'); } $version = new DBSchemaVersion('studip'); $migrator = new Migrator($path, $version, $verbose); if (Request::submitted('start')) { ob_start(); set_time_limit(0); $lock->lock(array('timestamp' => time(), 'user_id' => $GLOBALS['user']->id)); $migrator->migrate_to($target); $lock->release();