Introduce new DI container

- Adding Friendica\DI class for getting dynamic classes
- Replacing BaseObject::getApp() with this class
This commit is contained in:
nupplaPhil 2019-12-15 22:34:11 +01:00
parent a9220aa83b
commit 1de3f186d7
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
132 changed files with 377 additions and 270 deletions

View file

@ -14,6 +14,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Module\BaseSettingsModule;
/**
@ -65,18 +66,18 @@ class UserExport extends BaseSettingsModule
if ($args->getArgc() == 3) {
// @TODO Replace with router-provided arguments
$action = $args->get(2);
$user = self::getApp()->user;
$user = DI::app()->user;
switch ($action) {
case "backup":
header("Content-type: application/json");
header('Content-Disposition: attachment; filename="' . $user['nickname'] . '.' . $action . '"');
self::exportAll(self::getApp());
self::exportAll(DI::app());
exit();
break;
case "account":
header("Content-type: application/json");
header('Content-Disposition: attachment; filename="' . $user['nickname'] . '.' . $action . '"');
self::exportAccount(self::getApp());
self::exportAccount(DI::app());
exit();
break;
case "contact":
@ -92,7 +93,7 @@ class UserExport extends BaseSettingsModule
}
private static function exportMultiRow(string $query)
{
$dbStructure = DBStructure::definition(self::getApp()->getBasePath(), false);
$dbStructure = DBStructure::definition(DI::app()->getBasePath(), false);
preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", $query, $match);
$table = $match[1];
@ -119,7 +120,7 @@ class UserExport extends BaseSettingsModule
private static function exportRow(string $query)
{
$dbStructure = DBStructure::definition(self::getApp()->getBasePath(), false);
$dbStructure = DBStructure::definition(DI::app()->getBasePath(), false);
preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", $query, $match);
$table = $match[1];