-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_sql.php
28 lines (22 loc) · 991 Bytes
/
update_sql.php
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
<?php
/* Update MySQL DB */
// Load driver
require_once 'lib/system/exception/IPrintableException.class.php';
require_once 'lib/system/exception/LoggedException.class.php';
require_once 'lib/system/exception/SystemException.class.php';
require_once 'lib/system/database/DatabaseException.class.php';
require_once 'lib/system/database/PreparedStatement.class.php';
require_once 'lib/system/database/Database.class.php';
require_once 'lib/system/database/MysqlDatabase.class.php';
// NULL values
$dbHost = $dbUser = $dbPassword = $dbName = '';
$dbPort = 0;
// Fetch configuration
require_once 'lib/config.inc.php';
$db = new \skies\system\database\MysqlDatabase($dbHost, $dbUser, $dbPassword, $dbName, $dbPort);
if(!$db instanceof \skies\system\database\Database || !$db->isSupported()) {
die('Error connecting to the SQL server');
}
// Execute query
$db->query(file_get_contents('docs/default.sql'));
echo 'Database updated to '.date('d.m.Y H:i:s', filemtime('docs/default.sql')).'.';