]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/DBSync.php
Merge pull request #8272 from MrPetovan/bug/8254-regex-url-img
[friendica.git] / src / Module / Admin / DBSync.php
index 4368e6eed564e85c1534311806bc88f2c0e0e6a1..8892c2969165bde30afad0a79102e97753e5f8bc 100644 (file)
@@ -1,17 +1,34 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module\Admin;
 
-use Friendica\Core\Config;
-use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Core\Update;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 use Friendica\DI;
-use Friendica\Module\BaseAdminModule;
+use Friendica\Module\BaseAdmin;
 
-class DBSync extends BaseAdminModule
+class DBSync extends BaseAdmin
 {
        public static function content(array $parameters = [])
        {
@@ -25,10 +42,10 @@ class DBSync extends BaseAdminModule
                        // @TODO: Replace with parameter from router
                        $update = intval($a->argv[3]);
                        if ($update) {
-                               Config::set('database', 'update_' . $update, 'success');
-                               $curr = Config::get('system', 'build');
+                               DI::config()->set('database', 'update_' . $update, 'success');
+                               $curr = DI::config()->get('system', 'build');
                                if (intval($curr) == $update) {
-                                       Config::set('system', 'build', intval($curr) + 1);
+                                       DI::config()->set('system', 'build', intval($curr) + 1);
                                }
                                info(DI::l10n()->t('Update has been marked successful') . EOL);
                        }
@@ -41,8 +58,8 @@ class DBSync extends BaseAdminModule
                                $retval = DBStructure::update($a->getBasePath(), false, true);
                                if ($retval === '') {
                                        $o .= DI::l10n()->t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
-                                       Config::set('database', 'last_successful_update', DB_UPDATE_VERSION);
-                                       Config::set('database', 'last_successful_update_time', time());
+                                       DI::config()->set('database', 'last_successful_update', DB_UPDATE_VERSION);
+                                       DI::config()->set('database', 'last_successful_update_time', time());
                                } else {
                                        $o .= DI::l10n()->t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "<br />";
                                }
@@ -64,13 +81,13 @@ class DBSync extends BaseAdminModule
                                                $o .= DI::l10n()->t("Executing %s failed with error: %s", $func, $retval);
                                        } elseif ($retval === Update::SUCCESS) {
                                                $o .= DI::l10n()->t('Update %s was successfully applied.', $func);
-                                               Config::set('database', $func, 'success');
+                                               DI::config()->set('database', $func, 'success');
                                        } else {
                                                $o .= DI::l10n()->t('Update %s did not return a status. Unknown if it succeeded.', $func);
                                        }
                                } else {
                                        $o .= DI::l10n()->t('There was no additional update function %s that needed to be called.', $func) . "<br />";
-                                       Config::set('database', $func, 'success');
+                                       DI::config()->set('database', $func, 'success');
                                }
 
                                return $o;