*/ use wishthis\{Page, User}; $page = new page(__FILE__, 'Update'); $page->header(); $page->navigation(); $user = new User(); /** * Update */ if ('POST' === $_SERVER['REQUEST_METHOD']) { /** Current version is below 0.1.0 */ if (-1 === version_compare($options->version, '0.2.0')) { $database->query('ALTER TABLE `users` ADD `last_login` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `password`, ADD `isAdministrator` BOOLEAN NOT NULL AFTER `last_login` ;'); $database->query('UPDATE `users` SET `isAdministrator` = ' . true . ' WHERE `id` = ' . $user->id . ';'); $database->query('ALTER TABLE `wishlists` ADD `url` VARCHAR(128) NOT NULL AFTER `name` ;'); $database->query('INSERT INTO `options` (`key`, `value`) VALUES ("version", "' . VERSION . '");'); // Use this for future versions since it didn't existsin 0.1.0 // $options->setOption('version', VERSION); } header('Location: /?page=home'); die(); } ?>

title ?>

isLoggedIn()) { ?>

New version detected

Thank you for updating to v!

There have been some changes in the database, please run the updater.

Use at own risk

Be sure to make backups before proceeding.

Maintenance

The administrator of this site is currently running an update. This usually just takes a couple of seconds.

Trying again in 5 seconds...

footer(); ?>