Esempio n. 1
0
$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();
    $announcements = ob_get_clean();
    $message = MessageBox::Success(_("Die Datenbank wurde erfolgreich migriert."), explode("\n", $announcements));
}
$current = $version->get();
$migrations = $migrator->relevant_migrations($target);
$template = $template_factory->open('web_migrate');
$template->set_attribute('current_page', _('Datenbank-Migration'));
$template->set_attribute('current', $current);
$template->set_attribute('target', $target);
$template->set_attribute('migrations', $migrations);
$template->set_attribute('lock', $lock);
$template->set_attribute('message', $message);
echo $template->render();
include 'lib/include/html_end.inc.php';