X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=3ea08477d07b66418458bc814e78ac3b8a0b1a95;hb=8345ac7313ecb7248eecc8cd4484acd40f9f4a3e;hp=f592b4c27c5ef8145a197161c2395d9ba59ec8bc;hpb=f17e6f534fd5a86eda77385e5aa0c4d638804b8e;p=friendica.git diff --git a/boot.php b/boot.php index f592b4c27c..3ea08477d0 100644 --- a/boot.php +++ b/boot.php @@ -14,7 +14,7 @@ require_once('include/features.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_VERSION', '3.2.1753' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1172 ); +define ( 'DB_UPDATE_VERSION', 1173 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -507,13 +507,20 @@ if(! class_exists('App')) { set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path()); - if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") { + if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,9) === "pagename=") { + $this->query_string = substr($_SERVER['QUERY_STRING'],9); + // removing trailing / - maybe a nginx problem + if (substr($this->query_string, 0, 1) == "/") + $this->query_string = substr($this->query_string, 1); + } elseif((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") { $this->query_string = substr($_SERVER['QUERY_STRING'],2); // removing trailing / - maybe a nginx problem if (substr($this->query_string, 0, 1) == "/") $this->query_string = substr($this->query_string, 1); } - if(x($_GET,'q')) + if (x($_GET,'pagename')) + $this->cmd = trim($_GET['pagename'],'/\\'); + elseif (x($_GET,'q')) $this->cmd = trim($_GET['q'],'/\\'); // unix style "homedir" @@ -1016,8 +1023,36 @@ if(! function_exists('update_db')) { if(DB_UPDATE_VERSION == UPDATE_VERSION) { // Compare the current structure with the defined structure + + $t = get_config('database','dbupdate_'.DB_UPDATE_VERSION); + if($t !== false) + return; + + set_config('database','dbupdate_'.DB_UPDATE_VERSION, time()); + require_once("include/dbstructure.php"); - update_structure(false, true); + $retval = update_structure(false, true); + if($retval) { + //send the administrator an e-mail + $email_tpl = get_intltext_template("update_fail_eml.tpl"); + $email_msg = replace_macros($email_tpl, array( + '$sitename' => $a->config['sitename'], + '$siteurl' => $a->get_baseurl(), + '$update' => DB_UPDATE_VERSION, + '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION) + )); + $subject=sprintf(t('Update Error at %s'), $a->get_baseurl()); + require_once('include/email.php'); + $subject = email_header_encode($subject,'UTF-8'); + mail($a->config['admin_email'], $subject, $email_msg, + 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n" + .'Content-type: text/plain; charset=UTF-8'."\n" + .'Content-transfer-encoding: 8bit'); + //try the logger + logger("CRITICAL: Database structure update failed: ".$retval); + break; + } else + set_config('database','dbupdate_'.DB_UPDATE_VERSION, 'success'); for($x = $stored; $x < $current; $x ++) { if(function_exists('update_' . $x)) { @@ -1058,11 +1093,13 @@ if(! function_exists('update_db')) { //try the logger logger('CRITICAL: Update Failed: '. $x); break; - } - else { + } else { set_config('database','update_' . $x, 'success'); set_config('system','build', $x + 1); } + } else { + set_config('database','update_' . $x, 'success'); + set_config('system','build', $x + 1); } } }