]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/DBStructure.php
Merge pull request #9362 from annando/post-update-term
[friendica.git] / src / Database / DBStructure.php
index b16879e9cc9cc83c0f569dfab3481ebd384fcc82..bdd8cc208efe2e829183ef3e2ab6ab74d75c802a 100644 (file)
@@ -48,6 +48,22 @@ class DBStructure
         */
        private static $definition = [];
 
+       /**
+        * Set a database version to trigger update functions
+        *
+        * @param string $version
+        * @return void
+        */
+       public static function setDatabaseVersion(string $version)
+       {
+               if (!is_numeric($version)) {
+                       throw new \Asika\SimpleConsole\CommandArgsException('The version number must be numeric');
+               }
+
+               DI::config()->set('system', 'build', $version);
+               echo DI::l10n()->t('The database version had been set to %s.', $version);
+       }
+
        /**
         * Converts all tables from MyISAM/InnoDB Antelope to InnoDB Barracuda
         */
@@ -1004,6 +1020,12 @@ class DBStructure
         */
        public static function checkInitialValues()
        {
+               if (self::existsTable('verb') && !DBA::exists('verb', ['id' => 1])) {
+                       foreach (Item::ACTIVITIES as $index => $activity) {
+                               DBA::insert('verb', ['id' => $index + 1, 'name' => $activity], true);
+                       }
+               }
+
                if (self::existsTable('contact') && !DBA::exists('contact', ['id' => 0])) {
                        DBA::insert('contact', ['nurl' => '']);
                        $lastid = DBA::lastInsertId();