diff --git a/bin/daemon.php b/bin/daemon.php
index 948829c1bf..b3166145b8 100755
--- a/bin/daemon.php
+++ b/bin/daemon.php
@@ -37,7 +37,7 @@ $dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['daemon']]);
\Friendica\BaseObject::setDependencyInjection($dice);
-$a = \Friendica\BaseObject::getApp();
+$a = \Friendica\DI::app();
if ($a->getMode()->isInstall()) {
die("Friendica isn't properly installed yet.\n");
diff --git a/bin/worker.php b/bin/worker.php
index 469dcb001e..1de90d8cae 100755
--- a/bin/worker.php
+++ b/bin/worker.php
@@ -36,7 +36,7 @@ $dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['worker']]);
BaseObject::setDependencyInjection($dice);
-$a = BaseObject::getApp();
+$a = Friendica\DI::app();
// Check the database structure and possibly fixes it
Update::check($a->getBasePath(), true, $a->getMode());
diff --git a/boot.php b/boot.php
index fd87576725..2dcc15f7d3 100644
--- a/boot.php
+++ b/boot.php
@@ -23,8 +23,8 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\System;
-use Friendica\Core\Session;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Term;
use Friendica\Util\BasePath;
@@ -241,12 +241,12 @@ if (!defined('CURLE_OPERATION_TIMEDOUT')) {
* Useful in functions which require it but don't get it passed to them
*
* @deprecated since version 2018.09
- * @see BaseObject::getApp()
+ * @see DI::app()
* @return App
*/
function get_app()
{
- return BaseObject::getApp();
+ return DI::app();
}
/**
diff --git a/include/api.php b/include/api.php
index 4b7a1f742f..916051f06c 100644
--- a/include/api.php
+++ b/include/api.php
@@ -1370,7 +1370,7 @@ function api_get_item(array $condition)
*/
function api_users_show($type)
{
- $a = BaseObject::getApp();
+ $a = Friendica\DI::app();
$user_info = api_get_user($a);
@@ -2968,7 +2968,7 @@ function api_format_items_profiles($profile_row)
*/
function api_format_items($items, $user_info, $filter_user = false, $type = "json")
{
- $a = BaseObject::getApp();
+ $a = Friendica\DI::app();
$ret = [];
@@ -3002,7 +3002,7 @@ function api_format_items($items, $user_info, $filter_user = false, $type = "jso
*/
function api_format_item($item, $type = "json", $status_user = null, $author_user = null, $owner_user = null)
{
- $a = BaseObject::getApp();
+ $a = Friendica\DI::app();
if (empty($status_user) || empty($author_user) || empty($owner_user)) {
list($status_user, $author_user, $owner_user) = api_item_get_user($a, $item);
diff --git a/include/items.php b/include/items.php
index 3868db40a2..a449571ff7 100644
--- a/include/items.php
+++ b/include/items.php
@@ -344,7 +344,7 @@ function drop_items(array $items)
function drop_item($id, $return = '')
{
- $a = BaseObject::getApp();
+ $a = Friendica\DI::app();
// locate item to be deleted
diff --git a/index.php b/index.php
index dbdac5fcbf..a7eee2a331 100644
--- a/index.php
+++ b/index.php
@@ -17,7 +17,7 @@ $dice = $dice->addRule(Friendica\App\Mode::class, ['call' => [['determineRunMode
\Friendica\BaseObject::setDependencyInjection($dice);
-$a = \Friendica\BaseObject::getApp();
+$a = \Friendica\DI::app();
$a->runFrontend(
$dice->create(\Friendica\App\Module::class),
diff --git a/src/BaseObject.php b/src/BaseObject.php
index 2048188451..742b2c8598 100644
--- a/src/BaseObject.php
+++ b/src/BaseObject.php
@@ -31,18 +31,7 @@ class BaseObject
public static function setDependencyInjection(Dice $dice)
{
self::$dice = $dice;
- }
-
- /**
- * Get the app
- *
- * Same as get_app from boot.php
- *
- * @return App
- */
- public static function getApp()
- {
- return self::getClass(App::class);
+ DI::init($dice);
}
/**
diff --git a/src/Console/PostUpdate.php b/src/Console/PostUpdate.php
index fb640a0b0e..f6a7f69d22 100644
--- a/src/Console/PostUpdate.php
+++ b/src/Console/PostUpdate.php
@@ -57,7 +57,7 @@ HELP;
protected function doExecute()
{
- $a = \Friendica\BaseObject::getApp();
+ $a = \Friendica\DI::app();
if ($this->getOption($this->helpOptions)) {
$this->out($this->getHelp());
diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index 3617470df4..037ea901af 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -19,6 +19,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Event;
use Friendica\Model\Photo;
@@ -1093,7 +1094,7 @@ class BBCode extends BaseObject
$text = Cache::get($cache_key);
if (is_null($text)) {
- $a = self::getApp();
+ $a = DI::app();
$stamp1 = microtime(true);
@@ -1149,7 +1150,7 @@ class BBCode extends BaseObject
private static function cleanPictureLinksCallback($match)
{
- $a = self::getApp();
+ $a = DI::app();
// When the picture link is the own photo path then we can avoid fetching the link
$own_photo_url = preg_quote(Strings::normaliseLink($a->getBaseURL()) . '/photos/');
@@ -1253,7 +1254,7 @@ class BBCode extends BaseObject
*/
public static function convert($text, $try_oembed = true, $simple_html = 0, $for_plaintext = false)
{
- $a = self::getApp();
+ $a = DI::app();
/*
* preg_match_callback function to replace potential Oembed tags with Oembed content
@@ -2010,7 +2011,7 @@ class BBCode extends BaseObject
*/
public static function toMarkdown($text, $for_diaspora = true)
{
- $a = self::getApp();
+ $a = DI::app();
$original_text = $text;
diff --git a/src/Content/Text/Markdown.php b/src/Content/Text/Markdown.php
index a715de7e97..cca64b0ab2 100644
--- a/src/Content/Text/Markdown.php
+++ b/src/Content/Text/Markdown.php
@@ -8,6 +8,7 @@ namespace Friendica\Content\Text;
use Friendica\BaseObject;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\Contact;
/**
@@ -43,7 +44,7 @@ class Markdown extends BaseObject
$html = $MarkdownParser->transform($text);
- self::getApp()->getProfiler()->saveTimestamp($stamp1, "parser", System::callstack());
+ DI::app()->getProfiler()->saveTimestamp($stamp1, "parser", System::callstack());
return $html;
}
diff --git a/src/Core/ACL.php b/src/Core/ACL.php
index 64e03d4719..6134828658 100644
--- a/src/Core/ACL.php
+++ b/src/Core/ACL.php
@@ -9,6 +9,7 @@ namespace Friendica\Core;
use Friendica\App\Page;
use Friendica\BaseObject;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@@ -35,7 +36,7 @@ class ACL extends BaseObject
*/
public static function getSuggestContactSelectHTML($selname, $selclass, array $options = [], array $preselected = [])
{
- $a = self::getApp();
+ $a = DI::app();
$networks = null;
@@ -145,7 +146,7 @@ class ACL extends BaseObject
*/
public static function getMessageContactSelectHTML($selname, $selclass, array $preselected = [], $size = 4, $tabindex = null)
{
- $a = self::getApp();
+ $a = DI::app();
$o = '';
diff --git a/src/Core/Addon.php b/src/Core/Addon.php
index 2ec46b71c1..b1c1ad2e60 100644
--- a/src/Core/Addon.php
+++ b/src/Core/Addon.php
@@ -7,6 +7,7 @@ namespace Friendica\Core;
use Friendica\BaseObject;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Util\Strings;
/**
@@ -177,7 +178,7 @@ class Addon extends BaseObject
@include_once('addon/' . $addon . '/' . $addon . '.php');
if (function_exists($addon . '_install')) {
$func = $addon . '_install';
- $func(self::getApp());
+ $func(DI::app());
$addon_admin = (function_exists($addon . "_addon_admin") ? 1 : 0);
@@ -234,11 +235,11 @@ class Addon extends BaseObject
if (function_exists($addon . '_uninstall')) {
$func = $addon . '_uninstall';
- $func(self::getApp());
+ $func(DI::app());
}
if (function_exists($addon . '_install')) {
$func = $addon . '_install';
- $func(self::getApp());
+ $func(DI::app());
}
DBA::update('addon', ['timestamp' => $t], ['id' => $i['id']]);
}
@@ -267,7 +268,7 @@ class Addon extends BaseObject
*/
public static function getInfo($addon)
{
- $a = self::getApp();
+ $a = DI::app();
$addon = Strings::sanitizeFilePathItem($addon);
diff --git a/src/Core/Hook.php b/src/Core/Hook.php
index 5caa543194..959ed9fa16 100644
--- a/src/Core/Hook.php
+++ b/src/Core/Hook.php
@@ -7,6 +7,7 @@ namespace Friendica\Core;
use Friendica\App;
use Friendica\BaseObject;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Util\Strings;
/**
@@ -75,7 +76,7 @@ class Hook extends BaseObject
*/
public static function register($hook, $file, $function, $priority = 0)
{
- $file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
+ $file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
if (DBA::exists('hook', $condition)) {
@@ -98,7 +99,7 @@ class Hook extends BaseObject
*/
public static function unregister($hook, $file, $function)
{
- $relative_file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
+ $relative_file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
// This here is only needed for fixing a problem that existed on the develop branch
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
@@ -148,7 +149,7 @@ class Hook extends BaseObject
if ($hook[0] != $fork_hook[0]) {
continue;
}
- self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata);
+ self::callSingle(DI::app(), 'hook_fork', $fork_hook, $hookdata);
}
if (!$hookdata['execute']) {
@@ -175,7 +176,7 @@ class Hook extends BaseObject
{
if (array_key_exists($name, self::$hooks)) {
foreach (self::$hooks[$name] as $hook) {
- self::callSingle(self::getApp(), $name, $hook, $data);
+ self::callSingle(DI::app(), $name, $hook, $data);
}
}
}
diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php
index d9d913050f..ce90d78dee 100644
--- a/src/Core/Renderer.php
+++ b/src/Core/Renderer.php
@@ -7,6 +7,7 @@ namespace Friendica\Core;
use Exception;
use Friendica\BaseObject;
+use Friendica\DI;
use Friendica\Render\FriendicaSmarty;
use Friendica\Render\ITemplateEngine;
@@ -61,7 +62,7 @@ class Renderer extends BaseObject
public static function replaceMacros($s, array $vars = [])
{
$stamp1 = microtime(true);
- $a = self::getApp();
+ $a = DI::app();
// pass $baseurl to all templates if it isn't set
$vars = array_merge(['$baseurl' => $a->getBaseURL()], $vars);
@@ -92,7 +93,7 @@ class Renderer extends BaseObject
public static function getMarkupTemplate($s, $root = '')
{
$stamp1 = microtime(true);
- $a = self::getApp();
+ $a = DI::app();
$t = self::getTemplateEngine();
try {
diff --git a/src/Core/Search.php b/src/Core/Search.php
index e43e621d29..ff1a8a317c 100644
--- a/src/Core/Search.php
+++ b/src/Core/Search.php
@@ -4,6 +4,7 @@ namespace Friendica\Core;
use Friendica\BaseObject;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Network\HTTPException;
@@ -92,7 +93,7 @@ class Search extends BaseObject
*/
public static function getContactsFromGlobalDirectory($search, $type = self::TYPE_ALL, $page = 1)
{
- $config = self::getApp()->getConfig();
+ $config = DI::app()->getConfig();
$server = $config->get('system', 'directory', self::DEFAULT_DIRECTORY);
$searchUrl = $server . '/search';
@@ -158,7 +159,7 @@ class Search extends BaseObject
*/
public static function getContactsFromLocalDirectory($search, $type = self::TYPE_ALL, $start = 0, $itemPage = 80)
{
- $config = self::getApp()->getConfig();
+ $config = DI::app()->getConfig();
$diaspora = $config->get('system', 'diaspora_enabled') ? Protocol::DIASPORA : Protocol::DFRN;
$ostatus = !$config->get('system', 'ostatus_disabled') ? Protocol::OSTATUS : Protocol::DFRN;
diff --git a/src/Core/System.php b/src/Core/System.php
index 7aba0653e1..cf6fd9b4a9 100644
--- a/src/Core/System.php
+++ b/src/Core/System.php
@@ -6,6 +6,7 @@ namespace Friendica\Core;
use Friendica\App\BaseURL;
use Friendica\BaseObject;
+use Friendica\DI;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Util\XML;
@@ -43,7 +44,7 @@ class System extends BaseObject
*/
public static function removedBaseUrl(string $orig_url)
{
- return self::getApp()->removeBaseURL($orig_url);
+ return DI::app()->removeBaseURL($orig_url);
}
/**
@@ -184,7 +185,7 @@ class System extends BaseObject
if (is_bool($prefix) && !$prefix) {
$prefix = '';
} elseif (empty($prefix)) {
- $prefix = hash('crc32', self::getApp()->getHostName());
+ $prefix = hash('crc32', DI::app()->getHostName());
}
while (strlen($prefix) < ($size - 13)) {
diff --git a/src/Core/Theme.php b/src/Core/Theme.php
index 4f870687ce..7df985df35 100644
--- a/src/Core/Theme.php
+++ b/src/Core/Theme.php
@@ -7,6 +7,7 @@
namespace Friendica\Core;
use Friendica\BaseObject;
+use Friendica\DI;
use Friendica\Model\Profile;
use Friendica\Util\Strings;
@@ -194,7 +195,7 @@ class Theme
*/
public static function getPathForFile($file)
{
- $a = BaseObject::getApp();
+ $a = DI::app();
$theme = $a->getCurrentTheme();
@@ -232,7 +233,7 @@ class Theme
return 'view/theme/' . $theme . '/style.css';
}
- $a = BaseObject::getApp();
+ $a = DI::app();
$query_params = [];
diff --git a/src/Core/Worker.php b/src/Core/Worker.php
index c64b0ebc6b..b9362dace5 100644
--- a/src/Core/Worker.php
+++ b/src/Core/Worker.php
@@ -7,6 +7,7 @@ namespace Friendica\Core;
use Friendica\BaseObject;
use Friendica\Core;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Process;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@@ -1232,11 +1233,11 @@ class Worker
*/
public static function defer()
{
- if (empty(BaseObject::getApp()->queue)) {
+ if (empty(DI::app()->queue)) {
return false;
}
- $queue = BaseObject::getApp()->queue;
+ $queue = DI::app()->queue;
$retrial = $queue['retrial'];
$id = $queue['id'];
diff --git a/src/DI.php b/src/DI.php
new file mode 100644
index 0000000000..ef05b5cb07
--- /dev/null
+++ b/src/DI.php
@@ -0,0 +1,33 @@
+create(App::class, $arguments);
+ default:
+ return null;
+ }
+ }
+}
diff --git a/src/LegacyModule.php b/src/LegacyModule.php
index 950f8faad2..9c22ec5d78 100644
--- a/src/LegacyModule.php
+++ b/src/LegacyModule.php
@@ -67,7 +67,7 @@ class LegacyModule extends BaseModule
$function_name = static::$moduleName . '_' . $function_suffix;
if (\function_exists($function_name)) {
- $a = self::getApp();
+ $a = DI::app();
return $function_name($a);
} else {
return parent::{$function_suffix}($parameters);
diff --git a/src/Model/Attach.php b/src/Model/Attach.php
index 0073a6ed3f..fce55f5106 100644
--- a/src/Model/Attach.php
+++ b/src/Model/Attach.php
@@ -11,6 +11,7 @@ use Friendica\Core\StorageManager;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
+use Friendica\DI;
use Friendica\Model\Storage\IStorage;
use Friendica\Object\Image;
use Friendica\Util\DateTimeFormat;
@@ -31,7 +32,7 @@ class Attach extends BaseObject
*/
private static function getFields()
{
- $allfields = DBStructure::definition(self::getApp()->getBasePath(), false);
+ $allfields = DBStructure::definition(DI::app()->getBasePath(), false);
$fields = array_keys($allfields['attach']['fields']);
array_splice($fields, array_search('data', $fields), 1);
return $fields;
diff --git a/src/Model/Contact.php b/src/Model/Contact.php
index 1fd8426acd..c4f05b2dc9 100644
--- a/src/Model/Contact.php
+++ b/src/Model/Contact.php
@@ -16,6 +16,7 @@ use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Protocol\Activity;
@@ -1733,7 +1734,7 @@ class Contact extends BaseObject
*/
public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0)
{
- $a = self::getApp();
+ $a = DI::app();
$cid = self::getIdForURL($contact_url);
diff --git a/src/Model/Item.php b/src/Model/Item.php
index ebee91ffc2..9a86097ae8 100644
--- a/src/Model/Item.php
+++ b/src/Model/Item.php
@@ -21,6 +21,7 @@ use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\Diaspora;
@@ -2513,7 +2514,7 @@ class Item extends BaseObject
$guid = System::createUUID();
}
- return self::getApp()->getBaseURL() . '/objects/' . $guid;
+ return DI::app()->getBaseURL() . '/objects/' . $guid;
}
/**
@@ -3474,7 +3475,7 @@ class Item extends BaseObject
*/
private static function addRedirToImageTags(array &$item)
{
- $app = self::getApp();
+ $app = DI::app();
$matches = [];
$cnt = preg_match_all('|\[img\](http[^\[]*?/photo/[a-fA-F0-9]+?(-[0-9]\.[\w]+?)?)\[\/img\]|', $item['body'], $matches, PREG_SET_ORDER);
@@ -3509,7 +3510,7 @@ class Item extends BaseObject
*/
public static function prepareBody(array &$item, $attach = false, $is_preview = false)
{
- $a = self::getApp();
+ $a = DI::app();
Hook::callAll('prepare_body_init', $item);
// In order to provide theme developers more possibilities, event items
@@ -3647,7 +3648,7 @@ class Item extends BaseObject
*/
public static function getPlink($item)
{
- $a = self::getApp();
+ $a = DI::app();
if ($a->user['nickname'] != "") {
$ret = [
diff --git a/src/Model/Nodeinfo.php b/src/Model/Nodeinfo.php
index 60eba2713a..f6deb31bd5 100644
--- a/src/Model/Nodeinfo.php
+++ b/src/Model/Nodeinfo.php
@@ -5,6 +5,7 @@ namespace Friendica\Model;
use Friendica\BaseObject;
use Friendica\Core\Addon;
use Friendica\Database\DBA;
+use Friendica\DI;
/**
* Model interaction for the nodeinfo
@@ -18,7 +19,7 @@ class Nodeinfo extends BaseObject
*/
public static function update()
{
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
$logger = $app->getLogger();
diff --git a/src/Model/Notify.php b/src/Model/Notify.php
index eef481ad8f..842f9509cd 100644
--- a/src/Model/Notify.php
+++ b/src/Model/Notify.php
@@ -12,6 +12,7 @@ use Friendica\Core\L10n\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\Database;
+use Friendica\DI;
use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
@@ -515,7 +516,7 @@ final class Notify extends BaseObject
$ident = self::PERSONAL;
$notifies = [];
- $myurl = str_replace('http://', '', self::getApp()->contact['nurl']);
+ $myurl = str_replace('http://', '', DI::app()->contact['nurl']);
$diasp_url = str_replace('/profile/', '/u/', $myurl);
$condition = ["NOT `wall` AND `uid` = ? AND (`item`.`author-id` = ? OR `item`.`tag` REGEXP ? OR `item`.`tag` REGEXP ?)",
@@ -669,7 +670,7 @@ final class Notify extends BaseObject
// We have to distinguish between these two because they use different data.
// Contact suggestions
if ($intro['fid']) {
- $return_addr = bin2hex(self::getApp()->user['nickname'] . '@' .
+ $return_addr = bin2hex(DI::app()->user['nickname'] . '@' .
$this->baseUrl->getHostName() .
(($this->baseUrl->getURLPath()) ? '/' . $this->baseUrl->getURLPath() : ''));
diff --git a/src/Model/Photo.php b/src/Model/Photo.php
index db3c4d429b..445e8a5e5c 100644
--- a/src/Model/Photo.php
+++ b/src/Model/Photo.php
@@ -15,6 +15,7 @@ use Friendica\Core\StorageManager;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
+use Friendica\DI;
use Friendica\Model\Storage\IStorage;
use Friendica\Object\Image;
use Friendica\Util\DateTimeFormat;
@@ -202,7 +203,7 @@ class Photo extends BaseObject
*/
private static function getFields()
{
- $allfields = DBStructure::definition(self::getApp()->getBasePath(), false);
+ $allfields = DBStructure::definition(DI::app()->getBasePath(), false);
$fields = array_keys($allfields["photo"]["fields"]);
array_splice($fields, array_search("data", $fields), 1);
return $fields;
diff --git a/src/Module/Admin/Addons/Details.php b/src/Module/Admin/Addons/Details.php
index a196e7834f..b7c9b68c28 100644
--- a/src/Module/Admin/Addons/Details.php
+++ b/src/Module/Admin/Addons/Details.php
@@ -6,6 +6,7 @@ use Friendica\Content\Text\Markdown;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Util\Strings;
@@ -15,7 +16,7 @@ class Details extends BaseAdminModule
{
parent::post($parameters);
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc > 2) {
// @TODO: Replace with parameter from router
@@ -39,7 +40,7 @@ class Details extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
$addons_admin = Addon::getAdminList();
diff --git a/src/Module/Admin/Addons/Index.php b/src/Module/Admin/Addons/Index.php
index f327f0dc92..237eb73255 100644
--- a/src/Module/Admin/Addons/Index.php
+++ b/src/Module/Admin/Addons/Index.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Admin\Addons;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
class Index extends BaseAdminModule
@@ -13,7 +14,7 @@ class Index extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
// reload active themes
if (!empty($_GET['action'])) {
diff --git a/src/Module/Admin/Blocklist/Contact.php b/src/Module/Admin/Blocklist/Contact.php
index 38ae233715..e21c0ed959 100644
--- a/src/Module/Admin/Blocklist/Contact.php
+++ b/src/Module/Admin/Blocklist/Contact.php
@@ -6,6 +6,7 @@ use Friendica\Content\Pager;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Model;
@@ -38,14 +39,14 @@ class Contact extends BaseAdminModule
notice(L10n::tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
}
- self::getApp()->internalRedirect('admin/blocklist/contact');
+ DI::app()->internalRedirect('admin/blocklist/contact');
}
public static function content(array $parameters = [])
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
$condition = ['uid' => 0, 'blocked' => true];
diff --git a/src/Module/Admin/Blocklist/Server.php b/src/Module/Admin/Blocklist/Server.php
index 53647e64ef..5b84e40653 100644
--- a/src/Module/Admin/Blocklist/Server.php
+++ b/src/Module/Admin/Blocklist/Server.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Admin\Blocklist;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Util\Strings;
@@ -47,14 +48,14 @@ class Server extends BaseAdminModule
info(L10n::t('Site blocklist updated.') . EOL);
}
- self::getApp()->internalRedirect('admin/blocklist/server');
+ DI::app()->internalRedirect('admin/blocklist/server');
}
public static function content(array $parameters = [])
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
$blocklist = Config::get('system', 'blocklist');
$blocklistform = [];
diff --git a/src/Module/Admin/DBSync.php b/src/Module/Admin/DBSync.php
index 0d68a56481..7aeba4e1b1 100644
--- a/src/Module/Admin/DBSync.php
+++ b/src/Module/Admin/DBSync.php
@@ -8,6 +8,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\Update;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
class DBSync extends BaseAdminModule
@@ -16,7 +17,7 @@ class DBSync extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
$o = '';
diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php
index 85683d238f..c9a5a9813d 100644
--- a/src/Module/Admin/Features.php
+++ b/src/Module/Admin/Features.php
@@ -6,6 +6,7 @@ use Friendica\Content\Feature;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
class Features extends BaseAdminModule
@@ -39,7 +40,7 @@ class Features extends BaseAdminModule
}
}
- self::getApp()->internalRedirect('admin/features');
+ DI::app()->internalRedirect('admin/features');
}
public static function content(array $parameters = [])
diff --git a/src/Module/Admin/Item/Delete.php b/src/Module/Admin/Item/Delete.php
index f5f4687cec..77849a9aa9 100644
--- a/src/Module/Admin/Item/Delete.php
+++ b/src/Module/Admin/Item/Delete.php
@@ -4,6 +4,7 @@ namespace Friendica\Module\Admin\Item;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Module\BaseAdminModule;
use Friendica\Util\Strings;
@@ -33,7 +34,7 @@ class Delete extends BaseAdminModule
}
info(L10n::t('Item marked for deletion.') . EOL);
- self::getApp()->internalRedirect('admin/item/delete');
+ DI::app()->internalRedirect('admin/item/delete');
}
public static function content(array $parameters = [])
diff --git a/src/Module/Admin/Item/Source.php b/src/Module/Admin/Item/Source.php
index 9c41e60f47..610f61aec3 100644
--- a/src/Module/Admin/Item/Source.php
+++ b/src/Module/Admin/Item/Source.php
@@ -4,6 +4,7 @@ namespace Friendica\Module\Admin\Item;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Module\BaseAdminModule;
@@ -17,7 +18,7 @@ class Source extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
$guid = null;
// @TODO: Replace with parameter from router
diff --git a/src/Module/Admin/Logs/Settings.php b/src/Module/Admin/Logs/Settings.php
index 42f3435f65..0617c1c217 100644
--- a/src/Module/Admin/Logs/Settings.php
+++ b/src/Module/Admin/Logs/Settings.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Admin\Logs;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Util\Strings;
use Psr\Log\LogLevel;
@@ -34,14 +35,14 @@ class Settings extends BaseAdminModule
}
info(L10n::t("Log settings updated."));
- self::getApp()->internalRedirect('admin/logs');
+ DI::app()->internalRedirect('admin/logs');
}
public static function content(array $parameters = [])
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
$log_choices = [
LogLevel::ERROR => 'Error',
diff --git a/src/Module/Admin/Queue.php b/src/Module/Admin/Queue.php
index 9ce44ff15a..d538f396eb 100644
--- a/src/Module/Admin/Queue.php
+++ b/src/Module/Admin/Queue.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Admin;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Util\Arrays;
use Friendica\Util\DateTimeFormat;
@@ -23,7 +24,7 @@ class Queue extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
// @TODO: Replace with parameter from router
$deferred = $a->argc > 2 && $a->argv[2] == 'deferred';
diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php
index 4a02e98b82..abf9d95edb 100644
--- a/src/Module/Admin/Site.php
+++ b/src/Module/Admin/Site.php
@@ -10,6 +10,7 @@ use Friendica\Core\StorageManager;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Module\Register;
use Friendica\Protocol\PortableContact;
@@ -27,7 +28,7 @@ class Site extends BaseAdminModule
self::checkFormSecurityTokenRedirectOnError('/admin/site', 'admin_site');
- $a = self::getApp();
+ $a = DI::app();
if (!empty($_POST['republish_directory'])) {
Worker::add(PRIORITY_LOW, 'Directory');
@@ -416,7 +417,7 @@ class Site extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
/* Installed langs */
$lang_choices = L10n::getAvailableLanguages();
diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php
index e10533ee94..4011fec1c7 100644
--- a/src/Module/Admin/Summary.php
+++ b/src/Module/Admin/Summary.php
@@ -10,6 +10,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\Update;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
+use Friendica\DI;
use Friendica\Model\Register;
use Friendica\Module\BaseAdminModule;
use Friendica\Network\HTTPException\InternalServerErrorException;
@@ -24,7 +25,7 @@ class Summary extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
// are there MyISAM tables in the DB? If so, trigger a warning message
$warningtext = [];
@@ -208,7 +209,7 @@ class Summary extends BaseAdminModule
private static function checkSelfHostMeta()
{
// Fetch the host-meta to check if this really is a vital server
- return Network::curl(self::getApp()->getBaseURL() . '/.well-known/host-meta')->isSuccess();
+ return Network::curl(DI::app()->getBaseURL() . '/.well-known/host-meta')->isSuccess();
}
}
diff --git a/src/Module/Admin/Themes/Details.php b/src/Module/Admin/Themes/Details.php
index 912adc4297..0e9fa08f52 100644
--- a/src/Module/Admin/Themes/Details.php
+++ b/src/Module/Admin/Themes/Details.php
@@ -6,6 +6,7 @@ use Friendica\Content\Text\Markdown;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Theme;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Util\Strings;
@@ -15,7 +16,7 @@ class Details extends BaseAdminModule
{
parent::post($parameters);
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc > 2) {
// @TODO: Replace with parameter from router
@@ -43,7 +44,7 @@ class Details extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc > 2) {
// @TODO: Replace with parameter from router
diff --git a/src/Module/Admin/Themes/Embed.php b/src/Module/Admin/Themes/Embed.php
index 70a12dadd2..8a7b5c19ea 100644
--- a/src/Module/Admin/Themes/Embed.php
+++ b/src/Module/Admin/Themes/Embed.php
@@ -4,6 +4,7 @@ namespace Friendica\Module\Admin\Themes;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Util\Strings;
@@ -11,7 +12,7 @@ class Embed extends BaseAdminModule
{
public static function init(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc > 2) {
// @TODO: Replace with parameter from router
@@ -27,7 +28,7 @@ class Embed extends BaseAdminModule
{
parent::post($parameters);
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc > 2) {
// @TODO: Replace with parameter from router
@@ -57,7 +58,7 @@ class Embed extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc > 2) {
// @TODO: Replace with parameter from router
diff --git a/src/Module/Admin/Themes/Index.php b/src/Module/Admin/Themes/Index.php
index 8f7843e293..db6c4bc60b 100644
--- a/src/Module/Admin/Themes/Index.php
+++ b/src/Module/Admin/Themes/Index.php
@@ -6,6 +6,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Theme;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
use Friendica\Util\Strings;
@@ -15,7 +16,7 @@ class Index extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
$allowed_themes = Theme::getAllowedList();
diff --git a/src/Module/Admin/Tos.php b/src/Module/Admin/Tos.php
index 6fbdc21e8f..5c7d592253 100644
--- a/src/Module/Admin/Tos.php
+++ b/src/Module/Admin/Tos.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Admin;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Module\BaseAdminModule;
class Tos extends BaseAdminModule
@@ -29,7 +30,7 @@ class Tos extends BaseAdminModule
info(L10n::t('The Terms of Service settings have been updated.'));
- self::getApp()->internalRedirect('admin/tos');
+ DI::app()->internalRedirect('admin/tos');
}
public static function content(array $parameters = [])
diff --git a/src/Module/Admin/Users.php b/src/Module/Admin/Users.php
index 84332c979f..e6162ae858 100644
--- a/src/Module/Admin/Users.php
+++ b/src/Module/Admin/Users.php
@@ -7,6 +7,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Register;
use Friendica\Model\User;
use Friendica\Module\BaseAdminModule;
@@ -19,7 +20,7 @@ class Users extends BaseAdminModule
{
parent::post($parameters);
- $a = self::getApp();
+ $a = DI::app();
$pending = $_POST['pending'] ?? [];
$users = $_POST['user'] ?? [];
@@ -135,7 +136,7 @@ class Users extends BaseAdminModule
{
parent::content($parameters);
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc > 3) {
// @TODO: Replace with parameter from router
diff --git a/src/Module/AllFriends.php b/src/Module/AllFriends.php
index 0d9bf59858..2699990736 100644
--- a/src/Module/AllFriends.php
+++ b/src/Module/AllFriends.php
@@ -7,6 +7,7 @@ use Friendica\Content\ContactSelector;
use Friendica\Content\Pager;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Network\HTTPException;
use Friendica\Util\Proxy as ProxyUtils;
@@ -18,7 +19,7 @@ class AllFriends extends BaseModule
{
public static function content(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
if (!local_user()) {
throw new HTTPException\ForbiddenException();
diff --git a/src/Module/Apps.php b/src/Module/Apps.php
index bc099ce8bb..be0b60f6e1 100644
--- a/src/Module/Apps.php
+++ b/src/Module/Apps.php
@@ -7,6 +7,7 @@ use Friendica\Content\Nav;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
/**
* Shows the App menu
@@ -17,7 +18,7 @@ class Apps extends BaseModule
{
$privateaddons = Config::get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) {
- self::getApp()->internalRedirect();
+ DI::app()->internalRedirect();
}
}
diff --git a/src/Module/Attach.php b/src/Module/Attach.php
index f67104015d..fab1be2d58 100644
--- a/src/Module/Attach.php
+++ b/src/Module/Attach.php
@@ -10,6 +10,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\Attach as MAttach;
/**
@@ -22,7 +23,7 @@ class Attach extends BaseModule
*/
public static function rawContent(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc != 2) {
throw new \Friendica\Network\HTTPException\BadRequestException();
}
diff --git a/src/Module/Base/Api.php b/src/Module/Base/Api.php
index 08cf96158d..3a4e100897 100644
--- a/src/Module/Base/Api.php
+++ b/src/Module/Base/Api.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Base;
use Friendica\App\Arguments;
use Friendica\BaseModule;
use Friendica\Core\L10n;
+use Friendica\DI;
use Friendica\Network\HTTPException;
require_once __DIR__ . '/../../../include/api.php';
@@ -41,7 +42,7 @@ class Api extends BaseModule
throw new HTTPException\UnauthorizedException(L10n::t('Permission denied.'));
}
- $a = self::getApp();
+ $a = DI::app();
if (!empty($a->user['uid']) && $a->user['uid'] != api_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
@@ -67,7 +68,7 @@ class Api extends BaseModule
*/
protected static function login()
{
- api_login(self::getApp());
+ api_login(DI::app());
self::$current_user_id = api_user();
@@ -86,7 +87,7 @@ class Api extends BaseModule
*/
protected static function getUser($contact_id = null)
{
- return api_get_user(self::getApp(), $contact_id);
+ return api_get_user(DI::app(), $contact_id);
}
protected static function format($root_element, $data)
diff --git a/src/Module/BaseAdminModule.php b/src/Module/BaseAdminModule.php
index 01aa00d423..08db0a98c4 100644
--- a/src/Module/BaseAdminModule.php
+++ b/src/Module/BaseAdminModule.php
@@ -7,6 +7,7 @@ use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
+use Friendica\DI;
use Friendica\Network\HTTPException\ForbiddenException;
require_once 'boot.php';
@@ -50,7 +51,7 @@ abstract class BaseAdminModule extends BaseModule
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if (!is_site_admin()) {
notice(L10n::t('Please login to continue.'));
diff --git a/src/Module/BaseSearchModule.php b/src/Module/BaseSearchModule.php
index 96692b0b2d..7c6760a8d1 100644
--- a/src/Module/BaseSearchModule.php
+++ b/src/Module/BaseSearchModule.php
@@ -9,6 +9,7 @@ use Friendica\Content\Pager;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Search;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Network\HTTPException;
use Friendica\Object\Search\ContactResult;
@@ -33,7 +34,7 @@ class BaseSearchModule extends BaseModule
*/
public static function performContactSearch($search, $prefix = '')
{
- $a = self::getApp();
+ $a = DI::app();
$config = $a->getConfig();
$type = Search::TYPE_ALL;
@@ -97,7 +98,7 @@ class BaseSearchModule extends BaseModule
return '';
}
- $a = self::getApp();
+ $a = DI::app();
$id = 0;
$entries = [];
diff --git a/src/Module/BaseSettingsModule.php b/src/Module/BaseSettingsModule.php
index 4900de42e6..244dcdf17d 100644
--- a/src/Module/BaseSettingsModule.php
+++ b/src/Module/BaseSettingsModule.php
@@ -6,12 +6,13 @@ use Friendica\BaseModule;
use Friendica\Content\Feature;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
class BaseSettingsModule extends BaseModule
{
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$tpl = Renderer::getMarkupTemplate('settings/head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
diff --git a/src/Module/Bookmarklet.php b/src/Module/Bookmarklet.php
index 2993c20a7b..bae0e7c4d4 100644
--- a/src/Module/Bookmarklet.php
+++ b/src/Module/Bookmarklet.php
@@ -5,6 +5,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\ACL;
use Friendica\Core\L10n;
+use Friendica\DI;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException;
use Friendica\Util\Strings;
@@ -19,7 +20,7 @@ class Bookmarklet extends BaseModule
{
$_GET['mode'] = 'minimal';
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
if (!local_user()) {
diff --git a/src/Module/Contact.php b/src/Module/Contact.php
index 82b7e4b992..d366eaf0bd 100644
--- a/src/Module/Contact.php
+++ b/src/Module/Contact.php
@@ -17,6 +17,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException\BadRequestException;
@@ -78,7 +79,7 @@ class Contact extends BaseModule
public static function post(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if (!local_user()) {
return;
@@ -247,7 +248,7 @@ class Contact extends BaseModule
return Login::form($_SERVER['REQUEST_URI']);
}
- $a = self::getApp();
+ $a = DI::app();
$nets = $_GET['nets'] ?? '';
$rel = $_GET['rel'] ?? '';
diff --git a/src/Module/Debug/Feed.php b/src/Module/Debug/Feed.php
index c764c90003..48601d6bb3 100644
--- a/src/Module/Debug/Feed.php
+++ b/src/Module/Debug/Feed.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Debug;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Protocol;
use Friendica\Util\Network;
@@ -18,7 +19,7 @@ class Feed extends BaseModule
{
if (!local_user()) {
info(L10n::t('You must be logged in to use this module'));
- self::getApp()->internalRedirect();
+ DI::app()->internalRedirect();
}
}
diff --git a/src/Module/Debug/ItemBody.php b/src/Module/Debug/ItemBody.php
index f166fb0a27..8212ce38b5 100644
--- a/src/Module/Debug/ItemBody.php
+++ b/src/Module/Debug/ItemBody.php
@@ -4,6 +4,7 @@ namespace Friendica\Module\Debug;
use Friendica\BaseModule;
use Friendica\Core\L10n;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Network\HTTPException;
@@ -18,7 +19,7 @@ class ItemBody extends BaseModule
throw new HTTPException\UnauthorizedException(L10n::t('Access denied.'));
}
- $app = self::getApp();
+ $app = DI::app();
// @TODO: Replace with parameter from router
$itemId = (($app->argc > 1) ? intval($app->argv[1]) : 0);
diff --git a/src/Module/Debug/Localtime.php b/src/Module/Debug/Localtime.php
index 0d78f08d79..b762abdbc5 100644
--- a/src/Module/Debug/Localtime.php
+++ b/src/Module/Debug/Localtime.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Debug;
use Friendica\BaseModule;
use Friendica\Core\Installer;
use Friendica\Core\L10n;
+use Friendica\DI;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
@@ -17,13 +18,13 @@ class Localtime extends BaseModule
$bd_format = L10n::t('l F d, Y \@ g:i A');
if (!empty($_POST['timezone'])) {
- self::getApp()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
+ DI::app()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
}
}
public static function content(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
$time = ($_REQUEST['time'] ?? '') ?: 'now';
diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php
index 7d2e686725..a255ad3841 100644
--- a/src/Module/Delegation.php
+++ b/src/Module/Delegation.php
@@ -9,6 +9,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\User;
use Friendica\Network\HTTPException\ForbiddenException;
@@ -25,7 +26,7 @@ class Delegation extends BaseModule
}
$uid = local_user();
- $orig_record = self::getApp()->user;
+ $orig_record = DI::app()->user;
if (Session::get('submanage')) {
$user = User::getById(Session::get('submanage'));
@@ -82,7 +83,7 @@ class Delegation extends BaseModule
/** @var Authentication $authentication */
$authentication = self::getClass(Authentication::class);
- $authentication->setForUser(self::getApp(), $user, true, true);
+ $authentication->setForUser(DI::app(), $user, true, true);
if ($limited_id) {
Session::set('submanage', $original_id);
@@ -91,7 +92,7 @@ class Delegation extends BaseModule
$ret = [];
Hook::callAll('home_init', $ret);
- self::getApp()->internalRedirect('profile/' . self::getApp()->user['nickname']);
+ DI::app()->internalRedirect('profile/' . DI::app()->user['nickname']);
// NOTREACHED
}
@@ -101,7 +102,7 @@ class Delegation extends BaseModule
throw new ForbiddenException(L10n::t('Permission denied.'));
}
- $identities = self::getApp()->identities;
+ $identities = DI::app()->identities;
//getting additinal information for each identity
foreach ($identities as $key => $identity) {
@@ -112,7 +113,7 @@ class Delegation extends BaseModule
$identities[$key]['thumb'] = $thumb['thumb'];
- $identities[$key]['selected'] = ($identity['nickname'] === self::getApp()->user['nickname']);
+ $identities[$key]['selected'] = ($identity['nickname'] === DI::app()->user['nickname']);
$condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], NOTIFY_INTRO, NOTIFY_MAIL];
$params = ['distinct' => true, 'expression' => 'parent'];
diff --git a/src/Module/Diaspora/Fetch.php b/src/Module/Diaspora/Fetch.php
index 0efe641ba6..9ed8fb109e 100644
--- a/src/Module/Diaspora/Fetch.php
+++ b/src/Module/Diaspora/Fetch.php
@@ -5,6 +5,7 @@ namespace Friendica\Module\Diaspora;
use Friendica\BaseModule;
use Friendica\Core\Protocol;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Network\HTTPException;
@@ -19,7 +20,7 @@ class Fetch extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
// @TODO: Replace with parameter from router
if (($app->argc != 3) || (!in_array($app->argv[1], ["post", "status_message", "reshare"]))) {
diff --git a/src/Module/Directory.php b/src/Module/Directory.php
index f24c066507..e38810e8ec 100644
--- a/src/Module/Directory.php
+++ b/src/Module/Directory.php
@@ -10,6 +10,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Session;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Network\HTTPException;
@@ -23,7 +24,7 @@ class Directory extends BaseModule
{
public static function content(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
if (($config->get('system', 'block_public') && !Session::isAuthenticated()) ||
diff --git a/src/Module/Feed.php b/src/Module/Feed.php
index ba21537627..58140d835b 100644
--- a/src/Module/Feed.php
+++ b/src/Module/Feed.php
@@ -3,6 +3,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Protocol\OStatus;
/**
@@ -25,7 +26,7 @@ class Feed extends BaseModule
{
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$last_update = $_GET['last_update'] ?? '';
$nocache = !empty($_GET['nocache']) && local_user();
diff --git a/src/Module/Filer/RemoveTag.php b/src/Module/Filer/RemoveTag.php
index 0246f1db36..65fd6cdf36 100644
--- a/src/Module/Filer/RemoveTag.php
+++ b/src/Module/Filer/RemoveTag.php
@@ -3,6 +3,7 @@
namespace Friendica\Module\Filer;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Model\FileTag;
use Friendica\Network\HTTPException;
use Friendica\Util\XML;
@@ -18,7 +19,7 @@ class RemoveTag extends BaseModule
throw new HTTPException\ForbiddenException();
}
- $app = self::getApp();
+ $app = DI::app();
$logger = $app->getLogger();
$item_id = (($app->argc > 1) ? intval($app->argv[1]) : 0);
diff --git a/src/Module/Filer/SaveTag.php b/src/Module/Filer/SaveTag.php
index 7f0da83bce..1e19cdff19 100644
--- a/src/Module/Filer/SaveTag.php
+++ b/src/Module/Filer/SaveTag.php
@@ -6,6 +6,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Util\XML;
@@ -18,13 +19,13 @@ class SaveTag extends BaseModule
{
if (!local_user()) {
info(L10n::t('You must be logged in to use this module'));
- self::getApp()->internalRedirect();
+ DI::app()->internalRedirect();
}
}
public static function rawContent(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$logger = $a->getLogger();
$term = XML::unescape(trim($_GET['term'] ?? ''));
diff --git a/src/Module/FollowConfirm.php b/src/Module/FollowConfirm.php
index 5e9ab0481c..a19f127376 100644
--- a/src/Module/FollowConfirm.php
+++ b/src/Module/FollowConfirm.php
@@ -4,6 +4,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Model\Introduction;
+use Friendica\DI;
/**
* Process follow request confirmations
@@ -12,7 +13,7 @@ class FollowConfirm extends BaseModule
{
public static function post(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$uid = local_user();
if (!$uid) {
diff --git a/src/Module/Followers.php b/src/Module/Followers.php
index c2096cd052..0907f8ba5c 100644
--- a/src/Module/Followers.php
+++ b/src/Module/Followers.php
@@ -6,6 +6,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\User;
use Friendica\Protocol\ActivityPub;
@@ -16,7 +17,7 @@ class Followers extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
// @TODO: Replace with parameter from router
if (empty($a->argv[1])) {
diff --git a/src/Module/Following.php b/src/Module/Following.php
index 8eaa1835c2..739971df99 100644
--- a/src/Module/Following.php
+++ b/src/Module/Following.php
@@ -6,6 +6,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\User;
use Friendica\Protocol\ActivityPub;
@@ -16,7 +17,7 @@ class Following extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
// @TODO: Replace with parameter from router
if (empty($a->argv[1])) {
diff --git a/src/Module/Friendica.php b/src/Module/Friendica.php
index ee8b220611..2eb2940ed3 100644
--- a/src/Module/Friendica.php
+++ b/src/Module/Friendica.php
@@ -7,6 +7,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model\User;
/**
@@ -17,7 +18,7 @@ class Friendica extends BaseModule
{
public static function content(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
$visibleAddonList = Addon::getVisibleList();
@@ -90,7 +91,7 @@ class Friendica extends BaseModule
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
// @TODO: Replace with parameter from router
if ($app->argc <= 1 || ($app->argv[1] !== 'json')) {
diff --git a/src/Module/Group.php b/src/Module/Group.php
index 5699d2d30b..e7e1978986 100644
--- a/src/Module/Group.php
+++ b/src/Module/Group.php
@@ -12,6 +12,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Util\Strings;
@@ -21,7 +22,7 @@ class Group extends BaseModule
{
public static function post(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if ($a->isAjax()) {
self::ajaxPost();
@@ -71,7 +72,7 @@ class Group extends BaseModule
public static function ajaxPost()
{
try {
- $a = self::getApp();
+ $a = DI::app();
if (!local_user()) {
throw new \Exception(L10n::t('Permission denied.'), 403);
@@ -134,7 +135,7 @@ class Group extends BaseModule
throw new \Friendica\Network\HTTPException\ForbiddenException();
}
- $a = self::getApp();
+ $a = DI::app();
$a->page['aside'] = Model\Group::sidebarWidget('contact', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
diff --git a/src/Module/Help.php b/src/Module/Help.php
index 58cc95affd..0ff4cc68b0 100644
--- a/src/Module/Help.php
+++ b/src/Module/Help.php
@@ -6,6 +6,7 @@ use Friendica\BaseModule;
use Friendica\Content\Nav;
use Friendica\Content\Text\Markdown;
use Friendica\Core\L10n;
+use Friendica\DI;
use Friendica\Network\HTTPException;
use Friendica\Util\Strings;
@@ -21,7 +22,7 @@ class Help extends BaseModule
$text = '';
$filename = '';
- $a = self::getApp();
+ $a = DI::app();
$config = $a->getConfig();
$lang = $config->get('system', 'language');
diff --git a/src/Module/Home.php b/src/Module/Home.php
index 8fdb613f9b..eb122b0527 100644
--- a/src/Module/Home.php
+++ b/src/Module/Home.php
@@ -6,6 +6,7 @@ use Friendica\BaseModule;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Module\Security\Login;
/**
@@ -15,7 +16,7 @@ class Home extends BaseModule
{
public static function content(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
// currently no returned data is used
diff --git a/src/Module/Inbox.php b/src/Module/Inbox.php
index 8ab169567e..d6a33606df 100644
--- a/src/Module/Inbox.php
+++ b/src/Module/Inbox.php
@@ -10,6 +10,7 @@ use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Protocol\ActivityPub;
use Friendica\Util\HTTPSignature;
use Friendica\Util\Network;
@@ -21,7 +22,7 @@ class Inbox extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$postdata = Network::postdata();
diff --git a/src/Module/Install.php b/src/Module/Install.php
index 71547ad51e..107f83e77d 100644
--- a/src/Module/Install.php
+++ b/src/Module/Install.php
@@ -8,6 +8,7 @@ use Friendica\Core;
use Friendica\Core\Config\Cache\ConfigCache;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Network\HTTPException;
use Friendica\Util\BasePath;
use Friendica\Util\Strings;
@@ -48,7 +49,7 @@ class Install extends BaseModule
public static function init(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if (!$a->getMode()->isInstall()) {
throw new HTTPException\ForbiddenException();
@@ -78,7 +79,7 @@ class Install extends BaseModule
public static function post(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$configCache = $a->getConfigCache();
switch (self::$currentWizardStep) {
@@ -151,7 +152,7 @@ class Install extends BaseModule
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$configCache = $a->getConfigCache();
$output = '';
diff --git a/src/Module/Invite.php b/src/Module/Invite.php
index cd616001be..9261ea703c 100644
--- a/src/Module/Invite.php
+++ b/src/Module/Invite.php
@@ -6,6 +6,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Network\HTTPException;
use Friendica\Protocol\Email;
@@ -24,7 +25,7 @@ class Invite extends BaseModule
self::checkFormSecurityTokenRedirectOnError('/', 'send_invite');
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
$max_invites = intval($config->get('system', 'max_invites'));
@@ -110,7 +111,7 @@ class Invite extends BaseModule
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
}
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
$inviteOnly = false;
diff --git a/src/Module/Item/Compose.php b/src/Module/Item/Compose.php
index ded41fe392..78c4710a36 100644
--- a/src/Module/Item/Compose.php
+++ b/src/Module/Item/Compose.php
@@ -12,6 +12,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\FileTag;
use Friendica\Model\Group;
@@ -29,7 +30,7 @@ class Compose extends BaseModule
if (!empty($_REQUEST['body'])) {
$_REQUEST['return'] = 'network';
require_once 'mod/item.php';
- item_post(self::getApp());
+ item_post(DI::app());
} else {
notice(L10n::t('Please enter a post body.'));
}
@@ -41,7 +42,7 @@ class Compose extends BaseModule
return Login::form('compose', false);
}
- $a = self::getApp();
+ $a = DI::app();
if ($a->getCurrentTheme() !== 'frio') {
throw new NotImplementedException(L10n::t('This feature is only available with the frio theme.'));
diff --git a/src/Module/Item/Ignore.php b/src/Module/Item/Ignore.php
index e67f2113cd..75b2a7bd35 100644
--- a/src/Module/Item/Ignore.php
+++ b/src/Module/Item/Ignore.php
@@ -8,6 +8,7 @@ use Friendica\Core\L10n\L10n;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\Database;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Network\HTTPException;
@@ -69,7 +70,7 @@ class Ignore extends BaseModule
$rand = "?$rand";
}
- self::getApp()->internalRedirect($return_path . $rand);
+ DI::app()->internalRedirect($return_path . $rand);
}
// the json doesn't really matter, it will either be 0 or 1
diff --git a/src/Module/Like.php b/src/Module/Like.php
index 1c98cbc38c..74a0b8d859 100644
--- a/src/Module/Like.php
+++ b/src/Module/Like.php
@@ -3,6 +3,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Core\Session;
use Friendica\Network\HTTPException;
@@ -25,7 +26,7 @@ class Like extends BaseModule
$verb = 'like';
}
- $app = self::getApp();
+ $app = DI::app();
// @TODO: Replace with parameter from router
$itemId = (($app->argc > 1) ? Strings::escapeTags(trim($app->argv[1])) : 0);
diff --git a/src/Module/Magic.php b/src/Module/Magic.php
index 0f610d123c..d34f7e8744 100644
--- a/src/Module/Magic.php
+++ b/src/Module/Magic.php
@@ -8,6 +8,7 @@ use Friendica\BaseModule;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\HTTPSignature;
use Friendica\Util\Network;
@@ -22,7 +23,7 @@ class Magic extends BaseModule
{
public static function init(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$ret = ['success' => false, 'url' => '', 'message' => ''];
Logger::log('magic mdule: invoked', Logger::DEBUG);
@@ -48,7 +49,7 @@ class Magic extends BaseModule
$contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
// Redirect if the contact is already authenticated on this site.
- if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], Strings::normaliseLink(self::getApp()->getBaseURL())) !== false) {
+ if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], Strings::normaliseLink(DI::app()->getBaseURL())) !== false) {
if ($test) {
$ret['success'] = true;
$ret['message'] .= 'Local site - you are already authenticated.' . EOL;
diff --git a/src/Module/Maintenance.php b/src/Module/Maintenance.php
index 056bde7325..35a6df6295 100644
--- a/src/Module/Maintenance.php
+++ b/src/Module/Maintenance.php
@@ -5,6 +5,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Network\HTTPException;
use Friendica\Util\Strings;
@@ -16,7 +17,7 @@ class Maintenance extends BaseModule
{
public static function content(array $parameters = [])
{
- $config = self::getApp()->getConfig();
+ $config = DI::app()->getConfig();
$reason = $config->get('system', 'maintenance_reason');
diff --git a/src/Module/Manifest.php b/src/Module/Manifest.php
index 9e09740594..de1dfc9150 100644
--- a/src/Module/Manifest.php
+++ b/src/Module/Manifest.php
@@ -4,12 +4,13 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\Renderer;
+use Friendica\DI;
class Manifest extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
$tpl = Renderer::getMarkupTemplate('manifest.tpl');
diff --git a/src/Module/NodeInfo.php b/src/Module/NodeInfo.php
index 8e3692e3d3..5c5b573b22 100644
--- a/src/Module/NodeInfo.php
+++ b/src/Module/NodeInfo.php
@@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\Addon;
use Friendica\Core\System;
+use Friendica\DI;
/**
* Standardized way of exposing metadata about a server running one of the distributed social networks.
@@ -15,7 +16,7 @@ class NodeInfo extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
if ($parameters['version'] == '1.0') {
self::printNodeInfo1($app);
diff --git a/src/Module/Notifications/Notify.php b/src/Module/Notifications/Notify.php
index 721a89a694..d95d9c0d8e 100644
--- a/src/Module/Notifications/Notify.php
+++ b/src/Module/Notifications/Notify.php
@@ -6,6 +6,7 @@ use Friendica\BaseModule;
use Friendica\BaseObject;
use Friendica\Core\L10n;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\Notify as ModelNotify;
use Friendica\Network\HTTPException;
@@ -23,7 +24,7 @@ class Notify extends BaseModule
public static function rawContent(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
// @TODO: Replace with parameter from router
if ($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all') {
@@ -47,7 +48,7 @@ class Notify extends BaseModule
*/
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
// @TODO: Replace with parameter from router
if ($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) {
diff --git a/src/Module/Objects.php b/src/Module/Objects.php
index df57636926..4817811a34 100644
--- a/src/Module/Objects.php
+++ b/src/Module/Objects.php
@@ -7,6 +7,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Protocol\ActivityPub;
@@ -17,7 +18,7 @@ class Objects extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if (empty($a->argv[1])) {
throw new \Friendica\Network\HTTPException\NotFoundException();
diff --git a/src/Module/Oembed.php b/src/Module/Oembed.php
index f9d9284281..38e209e84d 100644
--- a/src/Module/Oembed.php
+++ b/src/Module/Oembed.php
@@ -4,6 +4,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Content;
+use Friendica\DI;
use Friendica\Util\Strings;
/**
@@ -19,7 +20,7 @@ class Oembed extends BaseModule
{
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
// Unused form: /oembed/b2h?url=...
if ($a->argv[1] == 'b2h') {
diff --git a/src/Module/OpenSearch.php b/src/Module/OpenSearch.php
index 309db6af95..acab0f5ed4 100644
--- a/src/Module/OpenSearch.php
+++ b/src/Module/OpenSearch.php
@@ -5,6 +5,7 @@ namespace Friendica\Module;
use DOMDocument;
use DOMElement;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Util\XML;
/**
@@ -20,8 +21,8 @@ class OpenSearch extends BaseModule
{
header('Content-type: application/opensearchdescription+xml');
- $hostname = self::getApp()->getHostName();
- $baseUrl = self::getApp()->getBaseURL();
+ $hostname = DI::app()->getHostName();
+ $baseUrl = DI::app()->getBaseURL();
/** @var DOMDocument $xml */
$xml = null;
diff --git a/src/Module/Outbox.php b/src/Module/Outbox.php
index c2024151e5..ee667cc4da 100644
--- a/src/Module/Outbox.php
+++ b/src/Module/Outbox.php
@@ -6,6 +6,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\User;
use Friendica\Protocol\ActivityPub;
@@ -16,7 +17,7 @@ class Outbox extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
// @TODO: Replace with parameter from router
if (empty($a->argv[1])) {
diff --git a/src/Module/Photo.php b/src/Module/Photo.php
index 9987c38f51..0c2baeac40 100644
--- a/src/Module/Photo.php
+++ b/src/Module/Photo.php
@@ -9,6 +9,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\Photo as MPhoto;
use Friendica\Object\Image;
@@ -25,7 +26,7 @@ class Photo extends BaseModule
*/
public static function init(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
// @TODO: Replace with parameter from router
if ($a->argc <= 1 || $a->argc > 4) {
throw new \Friendica\Network\HTTPException\BadRequestException();
diff --git a/src/Module/Pinned.php b/src/Module/Pinned.php
index e4c0d2b0e7..1bd25f2722 100644
--- a/src/Module/Pinned.php
+++ b/src/Module/Pinned.php
@@ -3,6 +3,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Model\Item;
/**
@@ -30,7 +31,7 @@ class Pinned extends BaseModule
$returnPath = $_REQUEST['return'] ?? '';
if (!empty($returnPath)) {
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
- self::getApp()->internalRedirect($returnPath . $rand);
+ DI::app()->internalRedirect($returnPath . $rand);
}
// the json doesn't really matter, it will either be 0 or 1
diff --git a/src/Module/Profile.php b/src/Module/Profile.php
index d399ba8ddf..eb8becfff5 100644
--- a/src/Module/Profile.php
+++ b/src/Module/Profile.php
@@ -14,6 +14,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact as ContactModel;
use Friendica\Model\Group;
use Friendica\Model\Item;
@@ -36,7 +37,7 @@ class Profile extends BaseModule
public static function init(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
// @TODO: Replace with parameter from router
if ($a->argc < 2) {
@@ -78,7 +79,7 @@ class Profile extends BaseModule
public static function content(array $parameters = [], $update = 0)
{
- $a = self::getApp();
+ $a = DI::app();
if (!$update) {
ProfileModel::load($a, self::$which, self::$profile);
diff --git a/src/Module/Profile/Contacts.php b/src/Module/Profile/Contacts.php
index 9a96590ac3..9d26f1bbef 100644
--- a/src/Module/Profile/Contacts.php
+++ b/src/Module/Profile/Contacts.php
@@ -12,6 +12,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Util\Proxy as ProxyUtils;
@@ -24,7 +25,7 @@ class Contacts extends BaseModule
throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('User not found.'));
}
- $a = self::getApp();
+ $a = DI::app();
//@TODO: Get value from router parameters
$nickname = $a->argv[1];
diff --git a/src/Module/Proxy.php b/src/Module/Proxy.php
index fbf4b8bd5c..ed7cabfefb 100644
--- a/src/Module/Proxy.php
+++ b/src/Module/Proxy.php
@@ -9,6 +9,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Logger;
+use Friendica\DI;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Util\HTTPSignature;
@@ -33,7 +34,7 @@ class Proxy extends BaseModule
public static function init(array $parameters = [])
{
// Set application instance here
- $a = self::getApp();
+ $a = DI::app();
/*
* Pictures are stored in one of the following ways:
@@ -156,7 +157,7 @@ class Proxy extends BaseModule
*/
private static function getRequestInfo()
{
- $a = self::getApp();
+ $a = DI::app();
$size = 1024;
$sizetype = '';
@@ -230,7 +231,7 @@ class Proxy extends BaseModule
*/
private static function setupDirectCache()
{
- $a = self::getApp();
+ $a = DI::app();
$basepath = $a->getBasePath();
// If the cache path isn't there, try to create it
diff --git a/src/Module/PublicRSAKey.php b/src/Module/PublicRSAKey.php
index f652811b54..5e90d90725 100644
--- a/src/Module/PublicRSAKey.php
+++ b/src/Module/PublicRSAKey.php
@@ -4,6 +4,7 @@ namespace Friendica\Module;
use ASN_BASE;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Model\User;
use Friendica\Network\HTTPException\BadRequestException;
@@ -14,7 +15,7 @@ class PublicRSAKey extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
// @TODO: Replace with parameter from router
if ($app->argc !== 2) {
diff --git a/src/Module/RandomProfile.php b/src/Module/RandomProfile.php
index c5b31afeef..f595ae98ed 100644
--- a/src/Module/RandomProfile.php
+++ b/src/Module/RandomProfile.php
@@ -3,6 +3,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@@ -13,7 +14,7 @@ class RandomProfile extends BaseModule
{
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
$contactUrl = GContact::getRandomUrl();
diff --git a/src/Module/ReallySimpleDiscovery.php b/src/Module/ReallySimpleDiscovery.php
index 7cf0db6c7b..43fdcf102c 100644
--- a/src/Module/ReallySimpleDiscovery.php
+++ b/src/Module/ReallySimpleDiscovery.php
@@ -3,6 +3,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Util\XML;
/**
@@ -15,7 +16,7 @@ class ReallySimpleDiscovery extends BaseModule
{
header('Content-Type: text/xml');
- $app = self::getApp();
+ $app = DI::app();
$xml = null;
echo XML::fromArray([
'rsd' => [
diff --git a/src/Module/Register.php b/src/Module/Register.php
index 3b43970197..df7a028166 100644
--- a/src/Module/Register.php
+++ b/src/Module/Register.php
@@ -14,6 +14,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Util\Strings;
@@ -123,7 +124,7 @@ class Register extends BaseModule
'$ask_password' => $ask_password,
'$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
'$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
- '$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "nickname@%s".', self::getApp()->getHostName()),
+ '$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "nickname@%s".', DI::app()->getHostName()),
'$nicklabel' => L10n::t('Choose a nickname: '),
'$photo' => $photo,
'$publish' => $profile_publish,
@@ -131,7 +132,7 @@ class Register extends BaseModule
'$username' => $username,
'$email' => $email,
'$nickname' => $nickname,
- '$sitename' => self::getApp()->getHostName(),
+ '$sitename' => DI::app()->getHostName(),
'$importh' => L10n::t('Import'),
'$importt' => L10n::t('Import your profile to this friendica instance'),
'$showtoslink' => Config::get('system', 'tosdisplay'),
@@ -156,7 +157,7 @@ class Register extends BaseModule
{
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');
- $a = self::getApp();
+ $a = DI::app();
$arr = ['post' => $_POST];
Hook::callAll('register_post', $arr);
diff --git a/src/Module/Search/Directory.php b/src/Module/Search/Directory.php
index f9988c0049..df73437c6e 100644
--- a/src/Module/Search/Directory.php
+++ b/src/Module/Search/Directory.php
@@ -4,6 +4,7 @@ namespace Friendica\Module\Search;
use Friendica\Content\Widget;
use Friendica\Core\L10n;
+use Friendica\DI;
use Friendica\Module\BaseSearchModule;
use Friendica\Module\Security\Login;
use Friendica\Util\Strings;
@@ -22,7 +23,7 @@ class Directory extends BaseSearchModule
$search = Strings::escapeTags(trim(rawurldecode($_REQUEST['search'] ?? '')));
- $a = self::getApp();
+ $a = DI::app();
if (empty($a->page['aside'])) {
$a->page['aside'] = '';
diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php
index 23b134b455..4e8a4c63c5 100644
--- a/src/Module/Search/Index.php
+++ b/src/Module/Search/Index.php
@@ -16,6 +16,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Term;
@@ -68,7 +69,7 @@ class Index extends BaseSearchModule
}
if (local_user()) {
- self::getApp()->page['aside'] .= Widget\SavedSearches::getHTML('search?q=' . urlencode($search), $search);
+ DI::app()->page['aside'] .= Widget\SavedSearches::getHTML('search?q=' . urlencode($search), $search);
}
Nav::setSelected('search');
@@ -190,7 +191,7 @@ class Index extends BaseSearchModule
Logger::info('Start Conversation.', ['q' => $search]);
- $o .= conversation(self::getApp(), $r, $pager, 'search', false, false, 'commented', local_user());
+ $o .= conversation(DI::app(), $r, $pager, 'search', false, false, 'commented', local_user());
$o .= $pager->renderMinimal(count($r));
diff --git a/src/Module/Search/Saved.php b/src/Module/Search/Saved.php
index 88668272de..80f84a927c 100644
--- a/src/Module/Search/Saved.php
+++ b/src/Module/Search/Saved.php
@@ -6,6 +6,7 @@ use Friendica\App\Arguments;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Util\Strings;
class Saved extends BaseModule
@@ -39,6 +40,6 @@ class Saved extends BaseModule
}
}
- self::getApp()->internalRedirect($return_url);
+ DI::app()->internalRedirect($return_url);
}
}
diff --git a/src/Module/Security/Login.php b/src/Module/Security/Login.php
index 311cbdd9bb..5de46903db 100644
--- a/src/Module/Security/Login.php
+++ b/src/Module/Security/Login.php
@@ -13,6 +13,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
+use Friendica\DI;
use Friendica\Module\Register;
use Friendica\Util\Strings;
@@ -25,7 +26,7 @@ class Login extends BaseModule
{
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if (local_user()) {
$a->internalRedirect();
@@ -57,7 +58,7 @@ class Login extends BaseModule
/** @var Authentication $authentication */
$authentication = self::getClass(Authentication::class);
$authentication->withPassword(
- self::getApp(),
+ DI::app(),
trim($_POST['username']),
trim($_POST['password']),
!empty($_POST['remember'])
@@ -81,7 +82,7 @@ class Login extends BaseModule
*/
public static function form($return_path = null, $register = false, $hiddens = [])
{
- $a = self::getApp();
+ $a = DI::app();
$o = '';
$noid = Config::get('system', 'no_openid');
@@ -133,7 +134,7 @@ class Login extends BaseModule
$o .= Renderer::replaceMacros(
$tpl,
[
- '$dest_url' => self::getApp()->getBaseURL(true) . '/login',
+ '$dest_url' => DI::app()->getBaseURL(true) . '/login',
'$logout' => L10n::t('Logout'),
'$login' => L10n::t('Login'),
diff --git a/src/Module/Security/Logout.php b/src/Module/Security/Logout.php
index 062d55687b..c0a0761087 100644
--- a/src/Module/Security/Logout.php
+++ b/src/Module/Security/Logout.php
@@ -12,6 +12,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Session;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Model\Profile;
/**
@@ -39,7 +40,7 @@ class Logout extends BaseModule
System::externalRedirect($visitor_home);
} else {
info(L10n::t('Logged out.'));
- self::getApp()->internalRedirect();
+ DI::app()->internalRedirect();
}
}
}
diff --git a/src/Module/Security/TwoFactor/Recovery.php b/src/Module/Security/TwoFactor/Recovery.php
index 90e1488ed9..b0f88fcfb7 100644
--- a/src/Module/Security/TwoFactor/Recovery.php
+++ b/src/Module/Security/TwoFactor/Recovery.php
@@ -7,6 +7,7 @@ use Friendica\App\Authentication;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
+use Friendica\DI;
use Friendica\Model\TwoFactor\RecoveryCode;
/**
@@ -32,7 +33,7 @@ class Recovery extends BaseModule
if (($_POST['action'] ?? '') == 'recover') {
self::checkFormSecurityTokenRedirectOnError('2fa', 'twofactor_recovery');
- $a = self::getApp();
+ $a = DI::app();
$recovery_code = $_POST['recovery_code'] ?? '';
@@ -54,12 +55,12 @@ class Recovery extends BaseModule
public static function content(array $parameters = [])
{
if (!local_user()) {
- self::getApp()->internalRedirect();
+ DI::app()->internalRedirect();
}
// Already authenticated with 2FA token
if (Session::get('2fa')) {
- self::getApp()->internalRedirect();
+ DI::app()->internalRedirect();
}
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/recovery.tpl'), [
diff --git a/src/Module/Security/TwoFactor/Verify.php b/src/Module/Security/TwoFactor/Verify.php
index 10327aea59..08545b061e 100644
--- a/src/Module/Security/TwoFactor/Verify.php
+++ b/src/Module/Security/TwoFactor/Verify.php
@@ -8,6 +8,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
+use Friendica\DI;
use PragmaRX\Google2FA\Google2FA;
/**
@@ -28,7 +29,7 @@ class Verify extends BaseModule
if (($_POST['action'] ?? '') == 'verify') {
self::checkFormSecurityTokenRedirectOnError('2fa', 'twofactor_verify');
- $a = self::getApp();
+ $a = DI::app();
$code = $_POST['verify_code'] ?? '';
@@ -51,12 +52,12 @@ class Verify extends BaseModule
public static function content(array $parameters = [])
{
if (!local_user()) {
- self::getApp()->internalRedirect();
+ DI::app()->internalRedirect();
}
// Already authenticated with 2FA token
if (Session::get('2fa')) {
- self::getApp()->internalRedirect();
+ DI::app()->internalRedirect();
}
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/verify.tpl'), [
diff --git a/src/Module/Settings/Delegation.php b/src/Module/Settings/Delegation.php
index e3c2b8d34c..78730c3d63 100644
--- a/src/Module/Settings/Delegation.php
+++ b/src/Module/Settings/Delegation.php
@@ -10,6 +10,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\User;
use Friendica\Module\BaseSettingsModule;
use Friendica\Network\HTTPException;
@@ -22,7 +23,7 @@ class Delegation extends BaseSettingsModule
{
public static function post(array $parameters = [])
{
- if (!local_user() || !empty(self::getApp()->user['uid']) && self::getApp()->user['uid'] != local_user()) {
+ if (!local_user() || !empty(DI::app()->user['uid']) && DI::app()->user['uid'] != local_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
}
@@ -64,7 +65,7 @@ class Delegation extends BaseSettingsModule
if ($action === 'add' && $user_id) {
if (Session::get('submanage')) {
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
- self::getApp()->internalRedirect('settings/delegation');
+ DI::app()->internalRedirect('settings/delegation');
}
$user = User::getById($user_id, ['nickname']);
@@ -80,17 +81,17 @@ class Delegation extends BaseSettingsModule
notice(L10n::t('Delegate user not found.'));
}
- self::getApp()->internalRedirect('settings/delegation');
+ DI::app()->internalRedirect('settings/delegation');
}
if ($action === 'remove' && $user_id) {
if (Session::get('submanage')) {
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
- self::getApp()->internalRedirect('settings/delegation');
+ DI::app()->internalRedirect('settings/delegation');
}
DBA::delete('manage', ['uid' => $user_id, 'mid' => local_user()]);
- self::getApp()->internalRedirect('settings/delegation');
+ DI::app()->internalRedirect('settings/delegation');
}
// find everybody that currently has delegated management to this account/page
diff --git a/src/Module/Settings/TwoFactor/AppSpecific.php b/src/Module/Settings/TwoFactor/AppSpecific.php
index fe7423c5d2..1823b56f0d 100644
--- a/src/Module/Settings/TwoFactor/AppSpecific.php
+++ b/src/Module/Settings/TwoFactor/AppSpecific.php
@@ -7,6 +7,7 @@ namespace Friendica\Module\Settings\TwoFactor;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model\TwoFactor\AppSpecificPassword;
use Friendica\Module\BaseSettingsModule;
use Friendica\Module\Security\Login;
@@ -29,12 +30,12 @@ class AppSpecific extends BaseSettingsModule
$verified = PConfig::get(local_user(), '2fa', 'verified');
if (!$verified) {
- self::getApp()->internalRedirect('settings/2fa');
+ DI::app()->internalRedirect('settings/2fa');
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.'));
- self::getApp()->internalRedirect('settings/2fa');
+ DI::app()->internalRedirect('settings/2fa');
}
}
@@ -52,10 +53,10 @@ class AppSpecific extends BaseSettingsModule
$description = $_POST['description'] ?? '';
if (empty($description)) {
notice(L10n::t('App-specific password generation failed: The description is empty.'));
- self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
notice(L10n::t('App-specific password generation failed: This description already exists.'));
- self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} else {
self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
notice(L10n::t('New app-specific password generated.'));
@@ -65,7 +66,7 @@ class AppSpecific extends BaseSettingsModule
case 'revoke_all' :
AppSpecificPassword::deleteAllForUser(local_user());
notice(L10n::t('App-specific passwords successfully revoked.'));
- self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
break;
}
}
@@ -77,7 +78,7 @@ class AppSpecific extends BaseSettingsModule
notice(L10n::t('App-specific password successfully revoked.'));
}
- self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
}
diff --git a/src/Module/Settings/TwoFactor/Index.php b/src/Module/Settings/TwoFactor/Index.php
index 03c866ce89..9e822e89ee 100644
--- a/src/Module/Settings/TwoFactor/Index.php
+++ b/src/Module/Settings/TwoFactor/Index.php
@@ -8,6 +8,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
+use Friendica\DI;
use Friendica\Model\TwoFactor\AppSpecificPassword;
use Friendica\Model\TwoFactor\RecoveryCode;
use Friendica\Model\User;
@@ -38,7 +39,7 @@ class Index extends BaseSettingsModule
PConfig::set(local_user(), '2fa', 'secret', $Google2FA->generateSecretKey(32));
- self::getApp()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
break;
case 'disable':
@@ -49,22 +50,22 @@ class Index extends BaseSettingsModule
Session::remove('2fa');
notice(L10n::t('Two-factor authentication successfully disabled.'));
- self::getApp()->internalRedirect('settings/2fa');
+ DI::app()->internalRedirect('settings/2fa');
}
break;
case 'recovery':
if ($has_secret) {
- self::getApp()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
break;
case 'app_specific':
if ($has_secret) {
- self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
break;
case 'configure':
if (!$verified) {
- self::getApp()->internalRedirect('settings/2fa/verify?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/verify?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
break;
}
diff --git a/src/Module/Settings/TwoFactor/Recovery.php b/src/Module/Settings/TwoFactor/Recovery.php
index 8bd40bec98..28f839644c 100644
--- a/src/Module/Settings/TwoFactor/Recovery.php
+++ b/src/Module/Settings/TwoFactor/Recovery.php
@@ -7,6 +7,7 @@ namespace Friendica\Module\Settings\TwoFactor;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model\TwoFactor\RecoveryCode;
use Friendica\Module\BaseSettingsModule;
use Friendica\Module\Security\Login;
@@ -27,12 +28,12 @@ class Recovery extends BaseSettingsModule
$secret = PConfig::get(local_user(), '2fa', 'secret');
if (!$secret) {
- self::getApp()->internalRedirect('settings/2fa');
+ DI::app()->internalRedirect('settings/2fa');
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.'));
- self::getApp()->internalRedirect('settings/2fa');
+ DI::app()->internalRedirect('settings/2fa');
}
}
@@ -48,7 +49,7 @@ class Recovery extends BaseSettingsModule
if ($_POST['action'] == 'regenerate') {
RecoveryCode::regenerateForUser(local_user());
notice(L10n::t('New recovery codes successfully generated.'));
- self::getApp()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
+ DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
}
}
diff --git a/src/Module/Settings/TwoFactor/Verify.php b/src/Module/Settings/TwoFactor/Verify.php
index 28ee999d14..b478632620 100644
--- a/src/Module/Settings/TwoFactor/Verify.php
+++ b/src/Module/Settings/TwoFactor/Verify.php
@@ -13,6 +13,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
+use Friendica\DI;
use Friendica\Module\BaseSettingsModule;
use Friendica\Module\Security\Login;
use PragmaRX\Google2FA\Google2FA;
@@ -34,12 +35,12 @@ class Verify extends BaseSettingsModule
$verified = PConfig::get(local_user(), '2fa', 'verified');
if ($secret && $verified) {
- self::getApp()->internalRedirect('settings/2fa');
+ DI::app()->internalRedirect('settings/2fa');
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.'));
- self::getApp()->internalRedirect('settings/2fa');
+ DI::app()->internalRedirect('settings/2fa');
}
}
@@ -62,7 +63,7 @@ class Verify extends BaseSettingsModule
notice(L10n::t('Two-factor authentication successfully activated.'));
- self::getApp()->internalRedirect('settings/2fa');
+ DI::app()->internalRedirect('settings/2fa');
} else {
notice(L10n::t('Invalid code, please retry.'));
}
diff --git a/src/Module/Settings/UserExport.php b/src/Module/Settings/UserExport.php
index 19722a18e2..643a5998e9 100644
--- a/src/Module/Settings/UserExport.php
+++ b/src/Module/Settings/UserExport.php
@@ -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];
diff --git a/src/Module/Smilies.php b/src/Module/Smilies.php
index a808ce820c..963cc8c344 100644
--- a/src/Module/Smilies.php
+++ b/src/Module/Smilies.php
@@ -6,6 +6,7 @@ use Friendica\BaseModule;
use Friendica\Content;
use Friendica\Core\Renderer;
use Friendica\Core\System;
+use Friendica\DI;
/**
* Prints the possible Smilies of this node
@@ -14,7 +15,7 @@ class Smilies extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
if (!empty($app->argv[1]) && ($app->argv[1] === "json")) {
$smilies = Content\Smilies::getList();
diff --git a/src/Module/Starred.php b/src/Module/Starred.php
index c1fa4c3b8b..d6ec19ea73 100644
--- a/src/Module/Starred.php
+++ b/src/Module/Starred.php
@@ -3,6 +3,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Model\Item;
/**
@@ -35,7 +36,7 @@ class Starred extends BaseModule
$returnPath = $_REQUEST['return'] ?? '';
if (!empty($returnPath)) {
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
- self::getApp()->internalRedirect($returnPath . $rand);
+ DI::app()->internalRedirect($returnPath . $rand);
}
// the json doesn't really matter, it will either be 0 or 1
diff --git a/src/Module/Statistics.php b/src/Module/Statistics.php
index 6e599ac9b1..1fe129011a 100644
--- a/src/Module/Statistics.php
+++ b/src/Module/Statistics.php
@@ -5,12 +5,13 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\Addon;
use Friendica\Core\System;
+use Friendica\DI;
class Statistics extends BaseModule
{
public static function init(array $parameters = [])
{
- $config = self::getApp()->getConfig();
+ $config = DI::app()->getConfig();
if (!$config->get("system", "nodeinfo")) {
throw new \Friendica\Network\HTTPException\NotFoundException();
@@ -19,8 +20,8 @@ class Statistics extends BaseModule
public static function rawContent(array $parameters = [])
{
- $config = self::getApp()->getConfig();
- $logger = self::getApp()->getLogger();
+ $config = DI::app()->getConfig();
+ $logger = DI::app()->getLogger();
$registration_open =
intval($config->get('config', 'register_policy')) !== Register::CLOSED
diff --git a/src/Module/Theme.php b/src/Module/Theme.php
index e9ce8d396f..cc8f914528 100644
--- a/src/Module/Theme.php
+++ b/src/Module/Theme.php
@@ -3,6 +3,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Util\Strings;
/**
@@ -14,7 +15,7 @@ class Theme extends BaseModule
{
header("Content-Type: text/css");
- $a = self::getApp();
+ $a = DI::app();
if ($a->argc == 4) {
$theme = $a->argv[2];
diff --git a/src/Module/ToggleMobile.php b/src/Module/ToggleMobile.php
index 0efc2e54b5..71b2de7b65 100644
--- a/src/Module/ToggleMobile.php
+++ b/src/Module/ToggleMobile.php
@@ -3,6 +3,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
/**
* Toggles the mobile view (on/off)
@@ -11,7 +12,7 @@ class ToggleMobile extends BaseModule
{
public static function content(array $parameters = [])
{
- $a = self::getApp();
+ $a = DI::app();
if (isset($_GET['off'])) {
$_SESSION['show-mobile'] = false;
diff --git a/src/Module/Tos.php b/src/Module/Tos.php
index ea29a5e072..7adce79174 100644
--- a/src/Module/Tos.php
+++ b/src/Module/Tos.php
@@ -14,6 +14,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Content\Text\BBCode;
+use Friendica\DI;
class Tos extends BaseModule
{
@@ -50,7 +51,7 @@ class Tos extends BaseModule
public static function init(array $parameters = [])
{
if (strlen(Config::get('system','singleuser'))) {
- self::getApp()->internalRedirect('profile/' . Config::get('system','singleuser'));
+ DI::app()->internalRedirect('profile/' . Config::get('system','singleuser'));
}
}
diff --git a/src/Module/Welcome.php b/src/Module/Welcome.php
index f69991e496..e62c5a62db 100644
--- a/src/Module/Welcome.php
+++ b/src/Module/Welcome.php
@@ -5,6 +5,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\DI;
/**
* Prints the welcome page for new users
@@ -13,7 +14,7 @@ class Welcome extends BaseModule
{
public static function content(array $parameters = [])
{
- $config = self::getApp()->getConfig();
+ $config = DI::app()->getConfig();
$mail_disabled = ((function_exists('imap_open') &&
(!$config->get('system', 'imap_disabled'))));
diff --git a/src/Module/WellKnown/HostMeta.php b/src/Module/WellKnown/HostMeta.php
index cb344b695e..3b03567d71 100644
--- a/src/Module/WellKnown/HostMeta.php
+++ b/src/Module/WellKnown/HostMeta.php
@@ -4,6 +4,7 @@ namespace Friendica\Module\WellKnown;
use Friendica\BaseModule;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Protocol\Salmon;
use Friendica\Util\Crypto;
@@ -15,7 +16,7 @@ class HostMeta extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
header('Content-type: text/xml');
diff --git a/src/Module/WellKnown/NodeInfo.php b/src/Module/WellKnown/NodeInfo.php
index 7d87252edd..4f44e81d9c 100644
--- a/src/Module/WellKnown/NodeInfo.php
+++ b/src/Module/WellKnown/NodeInfo.php
@@ -4,6 +4,7 @@ namespace Friendica\Module\WellKnown;
use Friendica\App;
use Friendica\BaseModule;
+use Friendica\DI;
/**
* Standardized way of exposing metadata about a server running one of the distributed social networks.
@@ -13,7 +14,7 @@ class NodeInfo extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
self::printWellKnown($app);
}
diff --git a/src/Module/WellKnown/XSocialRelay.php b/src/Module/WellKnown/XSocialRelay.php
index 5d8f4e817c..2ddac3836d 100644
--- a/src/Module/WellKnown/XSocialRelay.php
+++ b/src/Module/WellKnown/XSocialRelay.php
@@ -3,6 +3,7 @@
namespace Friendica\Module\WellKnown;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Model\Search;
/**
@@ -13,7 +14,7 @@ class XSocialRelay extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
$config = $app->getConfig();
$subscribe = $config->get('system', 'relay_subscribe', false);
diff --git a/src/Module/Xrd.php b/src/Module/Xrd.php
index 79e0883a87..63b293daf4 100644
--- a/src/Module/Xrd.php
+++ b/src/Module/Xrd.php
@@ -6,6 +6,7 @@ use Friendica\BaseModule;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Photo;
use Friendica\Model\User;
use Friendica\Protocol\ActivityNamespace;
@@ -19,7 +20,7 @@ class Xrd extends BaseModule
{
public static function rawContent(array $parameters = [])
{
- $app = self::getApp();
+ $app = DI::app();
// @TODO: Replace with parameter from router
if ($app->argv[0] == 'xrd') {
diff --git a/src/Network/FKOAuth1.php b/src/Network/FKOAuth1.php
index a3dde38d26..da68410626 100644
--- a/src/Network/FKOAuth1.php
+++ b/src/Network/FKOAuth1.php
@@ -9,6 +9,7 @@ use Friendica\App\Authentication;
use Friendica\Core\Logger;
use Friendica\Core\Session;
use Friendica\Database\DBA;
+use Friendica\DI;
use OAuthServer;
use OAuthSignatureMethod_HMAC_SHA1;
use OAuthSignatureMethod_PLAINTEXT;
@@ -37,7 +38,7 @@ class FKOAuth1 extends OAuthServer
public function loginUser($uid)
{
Logger::log("FKOAuth1::loginUser $uid");
- $a = BaseObject::getApp();
+ $a = DI::app();
$record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
if (!DBA::isResult($record)) {
diff --git a/src/Object/Post.php b/src/Object/Post.php
index 259de94c0f..7697346390 100644
--- a/src/Object/Post.php
+++ b/src/Object/Post.php
@@ -18,6 +18,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Term;
@@ -121,7 +122,7 @@ class Post extends BaseObject
*/
public function getTemplateData(array $conv_responses, $thread_level = 1)
{
- $a = self::getApp();
+ $a = DI::app();
$item = $this->getData();
$edited = false;
@@ -815,7 +816,7 @@ class Post extends BaseObject
*/
private function getDefaultText()
{
- $a = self::getApp();
+ $a = DI::app();
if (!local_user()) {
return '';
@@ -862,7 +863,7 @@ class Post extends BaseObject
*/
private function getCommentBox($indent)
{
- $a = self::getApp();
+ $a = DI::app();
$comment_box = '';
$conv = $this->getThread();
@@ -945,7 +946,7 @@ class Post extends BaseObject
*/
protected function checkWallToWall()
{
- $a = self::getApp();
+ $a = DI::app();
$conv = $this->getThread();
$this->wall_to_wall = false;
diff --git a/src/Object/Thread.php b/src/Object/Thread.php
index 4eda1f8f7e..35f155ee1c 100644
--- a/src/Object/Thread.php
+++ b/src/Object/Thread.php
@@ -7,6 +7,7 @@ namespace Friendica\Object;
use Friendica\BaseObject;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
+use Friendica\DI;
use Friendica\Protocol\Activity;
use Friendica\Util\Security;
@@ -52,7 +53,7 @@ class Thread extends BaseObject
return;
}
- $a = self::getApp();
+ $a = DI::app();
switch ($mode) {
case 'network':
diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php
index 2afd54e47a..9bae638511 100644
--- a/src/Protocol/ActivityPub/Transmitter.php
+++ b/src/Protocol/ActivityPub/Transmitter.php
@@ -14,6 +14,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
@@ -204,7 +205,7 @@ class Transmitter
{
return ['type' => 'Service',
'name' => FRIENDICA_PLATFORM . " '" . FRIENDICA_CODENAME . "' " . FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
- 'url' => BaseObject::getApp()->getBaseURL()];
+ 'url' => DI::app()->getBaseURL()];
}
/**
diff --git a/src/Util/Images.php b/src/Util/Images.php
index c69c944c0e..ec9179147c 100644
--- a/src/Util/Images.php
+++ b/src/Util/Images.php
@@ -6,6 +6,7 @@ use Friendica\BaseObject;
use Friendica\Core\Cache;
use Friendica\Core\Logger;
use Friendica\Core\System;
+use Friendica\DI;
use Imagick;
/**
@@ -165,7 +166,7 @@ class Images
$stamp1 = microtime(true);
file_put_contents($tempfile, $img_str);
- BaseObject::getApp()->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::app()->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
$data = getimagesize($tempfile);
unlink($tempfile);
diff --git a/src/Util/Proxy.php b/src/Util/Proxy.php
index 9309887409..0c9c053d0a 100644
--- a/src/Util/Proxy.php
+++ b/src/Util/Proxy.php
@@ -5,6 +5,7 @@ namespace Friendica\Util;
use Friendica\BaseObject;
use Friendica\Core\Config;
use Friendica\Core\System;
+use Friendica\DI;
/**
* @brief Proxy utilities class
@@ -63,7 +64,7 @@ class Proxy
public static function proxifyUrl($url, $writemode = false, $size = '')
{
// Get application instance
- $a = BaseObject::getApp();
+ $a = DI::app();
// Trim URL first
$url = trim($url);
diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php
index 6928cb8d79..1a72db53f5 100644
--- a/src/Worker/Cron.php
+++ b/src/Worker/Cron.php
@@ -12,6 +12,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\DateTimeFormat;
@@ -19,7 +20,7 @@ class Cron
{
public static function execute()
{
- $a = BaseObject::getApp();
+ $a = DI::app();
$last = Config::get('system', 'last_cron');
diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php
index 311ec59a53..6c7154957f 100644
--- a/src/Worker/CronJobs.php
+++ b/src/Worker/CronJobs.php
@@ -14,6 +14,7 @@ use Friendica\Core\StorageManager;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Database\PostUpdate;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GServer;
@@ -29,7 +30,7 @@ class CronJobs
{
public static function execute($command = '')
{
- $a = BaseObject::getApp();
+ $a = DI::app();
// No parameter set? So return
if ($command == '') {
diff --git a/src/Worker/DBUpdate.php b/src/Worker/DBUpdate.php
index 001df25a81..84159eb433 100644
--- a/src/Worker/DBUpdate.php
+++ b/src/Worker/DBUpdate.php
@@ -8,6 +8,7 @@ namespace Friendica\Worker;
use Friendica\BaseObject;
use Friendica\Core\Config;
use Friendica\Core\Update;
+use Friendica\DI;
class DBUpdate extends BaseObject
{
@@ -15,7 +16,7 @@ class DBUpdate extends BaseObject
{
// Just in case the last update wasn't failed
if (Config::get('system', 'update', Update::SUCCESS, true) != Update::FAILED) {
- Update::run(self::getApp()->getBasePath());
+ Update::run(DI::app()->getBasePath());
}
}
}
diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php
index c364ce5e51..aebc74b185 100644
--- a/src/Worker/Delivery.php
+++ b/src/Worker/Delivery.php
@@ -11,6 +11,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora;
@@ -140,7 +141,7 @@ class Delivery extends BaseObject
// if $parent['wall'] == 1 we will already have the parent message in our array
// and we will relay the whole lot.
- $localhost = self::getApp()->getHostName();
+ $localhost = DI::app()->getHostName();
if (strpos($localhost, ':')) {
$localhost = substr($localhost, 0, strpos($localhost, ':'));
}
@@ -548,7 +549,7 @@ class Delivery extends BaseObject
$headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $local_user['email'] . '>' . "\n";
}
} else {
- $headers = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' getHostName() . '>' . "\n";
+ $headers = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' getHostName() . '>' . "\n";
}
$headers .= 'Message-Id: <' . Email::iri2msgid($target_item['uri']) . '>' . "\n";
diff --git a/src/Worker/Expire.php b/src/Worker/Expire.php
index cb6bdbacbc..16a68f6487 100644
--- a/src/Worker/Expire.php
+++ b/src/Worker/Expire.php
@@ -12,13 +12,14 @@ use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Item;
class Expire
{
public static function execute($param = '', $hook_function = '')
{
- $a = BaseObject::getApp();
+ $a = DI::app();
Hook::loadHooks();
diff --git a/src/Worker/ForkHook.php b/src/Worker/ForkHook.php
index 586d1496e6..002cad9853 100644
--- a/src/Worker/ForkHook.php
+++ b/src/Worker/ForkHook.php
@@ -6,12 +6,13 @@
namespace Friendica\Worker;
use Friendica\Core\Hook;
+use Friendica\DI;
Class ForkHook
{
public static function execute($name, $hook, $data)
{
- $a = \Friendica\BaseObject::getApp();
+ $a = DI::app();
Hook::callSingle($a, $name, $hook, $data);
}
diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php
index 19bd518856..91de60ef61 100644
--- a/src/Worker/Notifier.php
+++ b/src/Worker/Notifier.php
@@ -11,6 +11,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
@@ -41,7 +42,7 @@ class Notifier
{
public static function execute($cmd, $target_id)
{
- $a = BaseObject::getApp();
+ $a = DI::app();
Logger::info('Invoked', ['cmd' => $cmd, 'target' => $target_id]);
diff --git a/src/Worker/ProfileUpdate.php b/src/Worker/ProfileUpdate.php
index 808d47299f..b5ae51bd4b 100644
--- a/src/Worker/ProfileUpdate.php
+++ b/src/Worker/ProfileUpdate.php
@@ -9,6 +9,7 @@ namespace Friendica\Worker;
use Friendica\BaseObject;
use Friendica\Core\Logger;
use Friendica\Core\Worker;
+use Friendica\DI;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\ActivityPub;
@@ -18,7 +19,7 @@ class ProfileUpdate {
return;
}
- $a = BaseObject::getApp();
+ $a = DI::app();
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
diff --git a/tests/include/ApiTest.php b/tests/include/ApiTest.php
index c54135faee..4c9db07089 100644
--- a/tests/include/ApiTest.php
+++ b/tests/include/ApiTest.php
@@ -15,6 +15,7 @@ use Friendica\Core\Session;
use Friendica\Core\Session\ISession;
use Friendica\Core\System;
use Friendica\Database\Database;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Network\HTTPException;
use Friendica\Test\Util\Database\StaticDatabase;
@@ -87,7 +88,7 @@ class ApiTest extends DatabaseTest
$this->loadFixture(__DIR__ . '/../datasets/api.fixture.php', $dba);
/** @var App app */
- $this->app = BaseObject::getApp();
+ $this->app = DI::app();
$this->app->argc = 1;
$this->app->argv = ['home'];
diff --git a/tests/src/BaseObjectTest.php b/tests/src/BaseObjectTest.php
deleted file mode 100644
index 6935214527..0000000000
--- a/tests/src/BaseObjectTest.php
+++ /dev/null
@@ -1,36 +0,0 @@
-