]> git.mxchange.org Git - friendica.git/blob - include/dbupdate.php
Merge pull request #3140 from annando/issue-3116
[friendica.git] / include / dbupdate.php
1 <?php
2
3 use \Friendica\Core\Config;
4
5 require_once("boot.php");
6
7 function dbupdate_run(&$argv, &$argc) {
8         global $a, $db;
9
10         if(is_null($a)){
11                 $a = new App;
12         }
13
14         if(is_null($db)) {
15                 @include(".htconfig.php");
16                 require_once("include/dba.php");
17                 $db = new dba($db_host, $db_user, $db_pass, $db_data);
18                         unset($db_host, $db_user, $db_pass, $db_data);
19         }
20
21         Config::load();
22
23         // We are deleting the latest dbupdate entry.
24         // This is done to avoid endless loops because the update was interupted.
25         Config::delete('database','dbupdate_'.DB_UPDATE_VERSION);
26
27         update_db($a);
28 }
29
30 if (array_search(__file__,get_included_files())===0){
31   dbupdate_run($_SERVER["argv"],$_SERVER["argc"]);
32   killme();
33 }