.
*/
require('../conf.php');
function lower_version($that, $this) {
$that = explode('.', $that);
$this = explode('.', $this);
while (count($that) < count($this)) $that[] = 0;
while (count($this) < count($that)) $this[] = 0;
for ($i = 0; $i < count($this); $i++) {
if ($this[$i] > $that[$i]) {
return true;
}
}
return false;
}
if (isset($_GET['upgrade']) && lower_version($_GET['upgrade'], '0.1')) {
try {
$_pdo->query("ALTER TABLE `assignment` CHANGE `hours` `hours` FLOAT UNSIGNED NOT NULL");
} catch (PDOException $e) {
echo "Altering the database structure failed with a PDOException ({$e->getCode()}): {$e->getMessage()}
" . $e->getTraceAsString();
}
}
if (isset($_GET['upgrade'])) {
echo "
All done.";
}
?>
You're going to upgrade to version =constants::version?>. What was your old version number?