-
Notifications
You must be signed in to change notification settings - Fork 18
/
manage.php
34 lines (25 loc) · 882 Bytes
/
manage.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
29
30
31
32
33
34
<?php
require 'config-global.php';
require 'config-local.php';
if(in_array('dump-schema', $argv)) {
system('mysqldump --user='.DBConfig::$dbuser.
' --password='.DBConfig::$dbpass.
' --no-data --skip-triggers --compact '.
DBConfig::$dbname.' > schema.sql');
} elseif(in_array('dump-data', $argv)) {
system('mysqldump --user='.DBConfig::$dbuser.
' --password='.DBConfig::$dbpass.
' --no-create-db --no-create-info --complete-insert --compact '.
DBConfig::$dbname.' > data.sql');
} elseif(in_array('load-sql', $argv)) {
system('mysql --user='.DBConfig::$dbuser.
' --password='.DBConfig::$dbpass.
' '.
DBConfig::$dbname.' < '.$argv[2]);
} else {
echo 'Commands:
dump-schema
dump-data
load-sql [filename]
';
}