-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.php
38 lines (25 loc) · 931 Bytes
/
update.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
35
36
37
38
<?php
declare(strict_types=1);
use \RedBeanPHP\R;
require 'vendor/autoload.php';
$appPath = dirname(__FILE__);
if (!file_exists("$appPath/storage/uploads")) {
mkdir("$appPath/storage/uploads", 0766, true);
}
if (file_exists("$appPath/public/2016")) {
rename("$appPath/public/2016", "$appPath/storage/uploads/2016");
}
if (file_exists("$appPath/public/thumbs")) {
rename("$appPath/public/thumbs", "$appPath/storage/thumbs");
}
if (file_exists("$appPath/database.db")) {
rename("$appPath/database.db", "$appPath/storage/database.db");
}
if (file_exists("$appPath/config/local.php") && !file_exists("$appPath/storage/config.php")) {
rename("$appPath/config/local.php", "$appPath/storage/config.php");
}
$db = \ParagonIE\EasyDB\Factory::create("sqlite:$appPath/storage/database.db");
$migrationRunner = new \TopSecret\Migration\MigrationRunner($db);
$migrationRunner->migrate();
echo 'Upgrade finished ...';
echo '';