]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge pull request #3849 from annando/forum-exclamation
[friendica.git] / boot.php
index 8e80bd4124e9683c96cf4063e3e2967b86a5332c..cdd71719a6e46035d1bbfa6926c404f7302dcb4b 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -41,9 +41,9 @@ require_once 'include/poller.php';
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Asparagus');
-define ( 'FRIENDICA_VERSION',      '3.5.3-rc' );
+define ( 'FRIENDICA_VERSION',      '3.6-dev' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1234      );
+define ( 'DB_UPDATE_VERSION',      1235      );
 
 /**
  * @brief Constant with a HTML line break.
@@ -510,6 +510,11 @@ function startup() {
  */
 function get_app() {
        global $a;
+
+       if (empty($a)) {
+               $a = new App(dirname(__DIR__));
+       }
+
        return $a;
 }
 
@@ -591,7 +596,12 @@ function is_ajax() {
        return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
 }
 
-function check_db() {
+/**
+ * @brief Function to check if request was an AJAX (xmlhttprequest) request.
+ *
+ * @param $via_worker boolean Is the check run via the poller?
+ */
+function check_db($via_worker) {
 
        $build = get_config('system', 'build');
        if (!x($build)) {
@@ -600,7 +610,7 @@ function check_db() {
        }
        if ($build != DB_UPDATE_VERSION) {
                // When we cannot execute the database update via the worker, we will do it directly
-               if (!proc_run(PRIORITY_CRITICAL, 'include/dbupdate.php')) {
+               if (!proc_run(PRIORITY_CRITICAL, 'include/dbupdate.php') && $via_worker) {
                        update_db(get_app());
                }
        }
@@ -894,8 +904,14 @@ function login($register = false, $hiddens = false) {
  * @brief Used to end the current process, after saving session state.
  */
 function killme() {
+       global $session_exists;
+
        if (!get_app()->is_backend()) {
-               session_write_close();
+               if (!$session_exists) {
+                       session_abort();
+               } else {
+                       session_write_close();
+               }
        }
 
        exit();