Browse Source

Replace obsolete references to App baseURL and getApp by DI

pull/8034/head
Hypolite Petovan 1 year ago
parent
commit
015db25d9f
5 changed files with 9 additions and 6 deletions
  1. +1
    -0
      mod/pubsub.php
  2. +5
    -3
      src/Api/Mastodon/Instance.php
  3. +1
    -1
      src/Module/Api/Mastodon/Instance.php
  4. +1
    -1
      src/Module/HoverCard.php
  5. +1
    -1
      src/Module/Security/OpenID.php

+ 1
- 0
mod/pubsub.php View File

@ -4,6 +4,7 @@ use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Protocol\OStatus;
use Friendica\Util\Strings;

+ 5
- 3
src/Api/Mastodon/Instance.php View File

@ -7,6 +7,7 @@ use Friendica\Api\Mastodon\Account;
use Friendica\Api\Mastodon\Stats;
use Friendica\Core\Config;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\User;
use Friendica\Module\Register;
@ -53,18 +54,19 @@ class Instance
* @return Instance
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function get(App $app) {
public static function get()
{
$register_policy = intval(Config::get('config', 'register_policy'));
$instance = new Instance();
$instance->uri = $app->getBaseURL();
$instance->uri = DI::baseUrl()->get();
$instance->title = Config::get('config', 'sitename');
$instance->description = Config::get('config', 'info');
$instance->email = Config::get('config', 'admin_email');
$instance->version = FRIENDICA_VERSION;
$instance->urls = []; // Not supported
$instance->stats = Stats::get();
$instance->thumbnail = $app->getBaseURL() . (Config::get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
$instance->thumbnail = DI::baseUrl()->get() . (Config::get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
$instance->languages = [Config::get('system', 'language')];
$instance->max_toot_chars = (int)Config::get('config', 'api_import_size', Config::get('config', 'max_import_size'));
$instance->registrations = ($register_policy != Register::CLOSED);

+ 1
- 1
src/Module/Api/Mastodon/Instance.php View File

@ -17,6 +17,6 @@ class Instance extends Api
*/
public static function rawContent(array $parameters = [])
{
System::jsonExit(InstanceEntity::get(self::getApp()));
System::jsonExit(InstanceEntity::get());
}
}

+ 1
- 1
src/Module/HoverCard.php View File

@ -16,7 +16,7 @@ class HoverCard extends BaseModule
{
public static function rawContent(array $parameters = [])
{
$a = self::getApp();
$a = DI::app();
if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
// A logged in user views a profile of a user

+ 1
- 1
src/Module/Security/OpenID.php View File

@ -52,7 +52,7 @@ class OpenID extends BaseModule
// successful OpenID login
$session->remove('openid');
DI::auth()->setForUser(self::getApp(), $user, true, true);
DI::auth()->setForUser(DI::app(), $user, true, true);
// just in case there was no return url set
// and we fell through

Loading…
Cancel
Save