]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Settings/UserExport.php
Merge pull request #12020 from annando/no-boot
[friendica.git] / src / Module / Settings / UserExport.php
index b5d79c4af5ac0ab63da19aa03b87a165e16480e1..ccfd08b52c33a4b2544ce6769513605b1239f110 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
- * @license   GNU AGPL version 3 or any later version
+ * @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
 
 namespace Friendica\Module\Settings;
 
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Renderer;
+use Friendica\Core\System;
 use Friendica\Database\DBA;
-use Friendica\Database\DBStructure;
 use Friendica\DI;
 use Friendica\Model\Item;
 use Friendica\Model\Post;
@@ -51,7 +52,7 @@ class UserExport extends BaseSettings
         * @throws HTTPException\ForbiddenException
         * @throws HTTPException\InternalServerErrorException
         */
-       public function content(): string
+       protected function content(array $request = []): string
        {
                if (!local_user()) {
                        throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
@@ -85,7 +86,7 @@ class UserExport extends BaseSettings
         *
         * @throws HTTPException\ForbiddenException
         */
-       public function rawContent()
+       protected function rawContent(array $request = [])
        {
                if (!DI::app()->isLoggedIn()) {
                        throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
@@ -112,8 +113,7 @@ class UserExport extends BaseSettings
                                        self::exportContactsAsCSV(local_user());
                                        break;
                        }
-
-                       exit();
+                       System::exit();
                }
        }
 
@@ -124,7 +124,7 @@ class UserExport extends BaseSettings
         */
        private static function exportMultiRow(string $query)
        {
-               $dbStructure = DBStructure::definition(DI::app()->getBasePath(), false);
+               $dbStructure = DI::dbaDefinition()->getAll();
 
                preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", $query, $match);
                $table = $match[1];
@@ -156,7 +156,7 @@ class UserExport extends BaseSettings
         */
        private static function exportRow(string $query)
        {
-               $dbStructure = DBStructure::definition(DI::app()->getBasePath(), false);
+               $dbStructure = DI::dbaDefinition()->getAll();
 
                preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", $query, $match);
                $table = $match[1];
@@ -253,7 +253,7 @@ class UserExport extends BaseSettings
                );
 
                $output = [
-                       'version' => FRIENDICA_VERSION,
+                       'version' => App::VERSION,
                        'schema' => DB_UPDATE_VERSION,
                        'baseurl' => DI::baseUrl(),
                        'user' => $user,