Replace obsolete references to App baseURL and getApp by DI
This commit is contained in:
parent
3c76826793
commit
015db25d9f
|
@ -4,6 +4,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Api\Mastodon\Account;
|
||||||
use Friendica\Api\Mastodon\Stats;
|
use Friendica\Api\Mastodon\Stats;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\APContact;
|
use Friendica\Model\APContact;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Module\Register;
|
use Friendica\Module\Register;
|
||||||
|
@ -53,18 +54,19 @@ class Instance
|
||||||
* @return Instance
|
* @return Instance
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function get(App $app) {
|
public static function get()
|
||||||
|
{
|
||||||
$register_policy = intval(Config::get('config', 'register_policy'));
|
$register_policy = intval(Config::get('config', 'register_policy'));
|
||||||
|
|
||||||
$instance = new Instance();
|
$instance = new Instance();
|
||||||
$instance->uri = $app->getBaseURL();
|
$instance->uri = DI::baseUrl()->get();
|
||||||
$instance->title = Config::get('config', 'sitename');
|
$instance->title = Config::get('config', 'sitename');
|
||||||
$instance->description = Config::get('config', 'info');
|
$instance->description = Config::get('config', 'info');
|
||||||
$instance->email = Config::get('config', 'admin_email');
|
$instance->email = Config::get('config', 'admin_email');
|
||||||
$instance->version = FRIENDICA_VERSION;
|
$instance->version = FRIENDICA_VERSION;
|
||||||
$instance->urls = []; // Not supported
|
$instance->urls = []; // Not supported
|
||||||
$instance->stats = Stats::get();
|
$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->languages = [Config::get('system', 'language')];
|
||||||
$instance->max_toot_chars = (int)Config::get('config', 'api_import_size', Config::get('config', 'max_import_size'));
|
$instance->max_toot_chars = (int)Config::get('config', 'api_import_size', Config::get('config', 'max_import_size'));
|
||||||
$instance->registrations = ($register_policy != Register::CLOSED);
|
$instance->registrations = ($register_policy != Register::CLOSED);
|
||||||
|
|
|
@ -17,6 +17,6 @@ class Instance extends Api
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
System::jsonExit(InstanceEntity::get(self::getApp()));
|
System::jsonExit(InstanceEntity::get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class HoverCard extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = DI::app();
|
||||||
|
|
||||||
if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
|
if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
|
||||||
// A logged in user views a profile of a user
|
// A logged in user views a profile of a user
|
||||||
|
|
|
@ -52,7 +52,7 @@ class OpenID extends BaseModule
|
||||||
// successful OpenID login
|
// successful OpenID login
|
||||||
$session->remove('openid');
|
$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
|
// just in case there was no return url set
|
||||||
// and we fell through
|
// and we fell through
|
||||||
|
|
Loading…
Reference in a new issue