Replace obsolete references to App baseURL and getApp by DI

This commit is contained in:
Hypolite Petovan 2019-12-29 21:50:15 -05:00
parent 3c76826793
commit 015db25d9f
5 changed files with 9 additions and 6 deletions

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;

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);

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());
}
}

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

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