]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge pull request #4100 from Rudloff/feature/composer
[friendica.git] / boot.php
index 04e14ac4d3d297ce9cdd04d4a2ebca27ccd89ea6..00058727f50142907da991b1698caae48e209286 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -27,8 +27,8 @@ use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
-use Friendica\Object\Contact;
-use Friendica\Util\Lock;
+use Friendica\Model\Contact;
+use Friendica\Database\DBStructure;
 
 require_once 'include/network.php';
 require_once 'include/plugin.php';
@@ -36,16 +36,22 @@ require_once 'include/text.php';
 require_once 'include/datetime.php';
 require_once 'include/pgettext.php';
 require_once 'include/nav.php';
-require_once 'include/features.php';
 require_once 'include/identity.php';
 require_once 'update.php';
-require_once 'include/dbstructure.php';
 
 define('FRIENDICA_PLATFORM',     'Friendica');
 define('FRIENDICA_CODENAME',     'Asparagus');
 define('FRIENDICA_VERSION',      '3.6-dev');
 define('DFRN_PROTOCOL_VERSION',  '2.23');
-define('DB_UPDATE_VERSION',      1235);
+define('DB_UPDATE_VERSION',      1237);
+define('NEW_UPDATE_ROUTINE_VERSION', 1170);
+
+/**
+ * @brief Constants for the database update check
+ */
+const DB_UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
+const DB_UPDATE_SUCCESSFUL = 1;  // Database check was successful
+const DB_UPDATE_FAILED = 2;      // Database check failed
 
 /**
  * @brief Constant with a HTML line break.
@@ -412,7 +418,6 @@ define('ACTIVITY_SHARE',       NAMESPACE_ACTIVITY_SCHEMA . 'share');
 define('ACTIVITY_DELETE',      NAMESPACE_ACTIVITY_SCHEMA . 'delete');
 
 define('ACTIVITY_POKE',        NAMESPACE_ZOT . '/activity/poke');
-define('ACTIVITY_MOOD',        NAMESPACE_ZOT . '/activity/mood');
 
 define('ACTIVITY_OBJ_BOOKMARK', NAMESPACE_ACTIVITY_SCHEMA . 'bookmark');
 define('ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment');
@@ -519,6 +524,8 @@ function startup()
  * @brief Retrieve the App structure
  *
  * Useful in functions which require it but don't get it passed to them
+ *
+ * @return App
  */
 function get_app()
 {
@@ -566,16 +573,6 @@ function x($s, $k = null)
        }
 }
 
-/**
- * @brief Called from db initialisation if db is dead.
- */
-function system_unavailable()
-{
-       include 'system_unavailable.php';
-       system_down();
-       killme();
-}
-
 /**
  * @brief Returns the baseurl.
  *
@@ -687,7 +684,7 @@ function update_db(App $a)
                                // Compare the current structure with the defined structure
 
                                $t = Config::get('database', 'dbupdate_' . DB_UPDATE_VERSION);
-                               if ($t !== false) {
+                               if (!is_null($t)) {
                                        return;
                                }
 
@@ -707,9 +704,9 @@ function update_db(App $a)
 
                                // run new update routine
                                // it update the structure in one call
-                               $retval = update_structure(false, true);
+                               $retval = DBStructure::update(false, true);
                                if ($retval) {
-                                       update_fail(
+                                       DBStructure::updateFail(
                                                DB_UPDATE_VERSION,
                                                $retval
                                        );
@@ -743,7 +740,7 @@ function run_update_function($x)
                // delete the config entry to try again.
 
                $t = Config::get('database', 'update_' . $x);
-               if ($t !== false) {
+               if (!is_null($t)) {
                        return false;
                }
                Config::set('database', 'update_' . $x, time());
@@ -755,7 +752,7 @@ function run_update_function($x)
 
                if ($retval) {
                        //send the administrator an e-mail
-                       update_fail(
+                       DBStructure::updateFail(
                                $x,
                                sprintf(t('Update %s failed. See error logs.'), $x)
                        );