forked from Pistolebob/spotweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupgrade-db.php
More file actions
executable file
·41 lines (33 loc) · 1.29 KB
/
upgrade-db.php
File metadata and controls
executable file
·41 lines (33 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
error_reporting(E_ALL & ~8192 & ~E_USER_WARNING); # 8192 == E_DEPRECATED maar PHP < 5.3 heeft die niet
require_once "lib/SpotClassAutoload.php";
require_once "settings.php";
# Verzeker onszelf ervan dat we niet vanuit de webserver uitgevoerd worden
if (isset($_SERVER['SERVER_PROTOCOL'])) {
die("Sorry, db-upgrade.php kan enkel vanuit de server zelf uitgevoerd worden, niet via de webbrowser!");
} # if
# Risky warning, might trip up some stuff
if (@!file_exists(getcwd() . '/' . basename($argv[0]))) {
chdir(__DIR__);
} # if
try {
echo "Updating schema..(" . $settings['db']['engine'] . ")" . PHP_EOL;
$spotUpgrader = new SpotUpgrader($settings['db']);
$spotUpgrader->database();
echo "Schema update done" . PHP_EOL;
echo "Updating settings" . PHP_EOL;
$spotUpgrader->settings($settings);
echo "Settings update done" . PHP_EOL;
$spotUpgrader->users($settings);
echo "Updating users" . PHP_EOL;
echo "Users' update done" . PHP_EOL;
echo "Performing basic analysis of database tables" . PHP_EOL;
$spotUpgrader->analyze($settings);
echo "Basic database optimalisation done" . PHP_EOL;
} catch(Exception $x) {
echo "Database schema of settings upgrade mislukt:" . PHP_EOL;
echo " " . $x->getMessage() . PHP_EOL;
echo PHP_EOL . PHP_EOL;
echo $x->getTraceAsString();
die(1);
} # catch