mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 00:04:27 +02:00
Replace Addon class with AddonHelper in Nodeinfo Model
This commit is contained in:
parent
2e50e93872
commit
2ccb62bbd8
1 changed files with 20 additions and 18 deletions
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Model;
|
namespace Friendica\Model;
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
@ -28,11 +27,12 @@ class Nodeinfo
|
||||||
{
|
{
|
||||||
$config = DI::config();
|
$config = DI::config();
|
||||||
$logger = DI::logger();
|
$logger = DI::logger();
|
||||||
|
$addonHelper = DI::addonHelper();
|
||||||
|
|
||||||
// If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
|
// If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
|
||||||
if (Addon::isEnabled('statistics_json')) {
|
if ($addonHelper->isAddonEnabled('statistics_json')) {
|
||||||
$config->set('system', 'nodeinfo', true);
|
$config->set('system', 'nodeinfo', true);
|
||||||
Addon::uninstall('statistics_json');
|
$addonHelper->uninstallAddon('statistics_json');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($config->get('system', 'nodeinfo'))) {
|
if (empty($config->get('system', 'nodeinfo'))) {
|
||||||
|
@ -66,14 +66,14 @@ class Nodeinfo
|
||||||
/**
|
/**
|
||||||
* Return the supported services
|
* Return the supported services
|
||||||
*
|
*
|
||||||
* @return Object with supported services
|
* @return stdClass with supported services
|
||||||
*/
|
*/
|
||||||
public static function getUsage(bool $version2 = false)
|
public static function getUsage(bool $version2 = false): stdClass
|
||||||
{
|
{
|
||||||
$config = DI::config();
|
$config = DI::config();
|
||||||
|
|
||||||
$usage = new stdClass();
|
$usage = new stdClass();
|
||||||
$usage->users = new \stdClass;
|
$usage->users = new stdClass;
|
||||||
|
|
||||||
if (!empty($config->get('system', 'nodeinfo'))) {
|
if (!empty($config->get('system', 'nodeinfo'))) {
|
||||||
$usage->users->total = intval(DI::keyValue()->get('nodeinfo_total_users'));
|
$usage->users->total = intval(DI::keyValue()->get('nodeinfo_total_users'));
|
||||||
|
@ -97,45 +97,47 @@ class Nodeinfo
|
||||||
*/
|
*/
|
||||||
public static function getServices(): array
|
public static function getServices(): array
|
||||||
{
|
{
|
||||||
|
$addonHelper = DI::addonHelper();
|
||||||
|
|
||||||
$services = [
|
$services = [
|
||||||
'inbound' => [],
|
'inbound' => [],
|
||||||
'outbound' => [],
|
'outbound' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
if (Addon::isEnabled('bluesky')) {
|
if ($addonHelper->isAddonEnabled('bluesky')) {
|
||||||
$services['inbound'][] = 'bluesky';
|
$services['inbound'][] = 'bluesky';
|
||||||
$services['outbound'][] = 'bluesky';
|
$services['outbound'][] = 'bluesky';
|
||||||
}
|
}
|
||||||
if (Addon::isEnabled('dwpost')) {
|
if ($addonHelper->isAddonEnabled('dwpost')) {
|
||||||
$services['outbound'][] = 'dreamwidth';
|
$services['outbound'][] = 'dreamwidth';
|
||||||
}
|
}
|
||||||
if (Addon::isEnabled('statusnet')) {
|
if ($addonHelper->isAddonEnabled('statusnet')) {
|
||||||
$services['inbound'][] = 'gnusocial';
|
$services['inbound'][] = 'gnusocial';
|
||||||
$services['outbound'][] = 'gnusocial';
|
$services['outbound'][] = 'gnusocial';
|
||||||
}
|
}
|
||||||
if (Addon::isEnabled('ijpost')) {
|
if ($addonHelper->isAddonEnabled('ijpost')) {
|
||||||
$services['outbound'][] = 'insanejournal';
|
$services['outbound'][] = 'insanejournal';
|
||||||
}
|
}
|
||||||
if (Addon::isEnabled('libertree')) {
|
if ($addonHelper->isAddonEnabled('libertree')) {
|
||||||
$services['outbound'][] = 'libertree';
|
$services['outbound'][] = 'libertree';
|
||||||
}
|
}
|
||||||
if (Addon::isEnabled('ljpost')) {
|
if ($addonHelper->isAddonEnabled('ljpost')) {
|
||||||
$services['outbound'][] = 'livejournal';
|
$services['outbound'][] = 'livejournal';
|
||||||
}
|
}
|
||||||
if (Addon::isEnabled('pumpio')) {
|
if ($addonHelper->isAddonEnabled('pumpio')) {
|
||||||
$services['inbound'][] = 'pumpio';
|
$services['inbound'][] = 'pumpio';
|
||||||
$services['outbound'][] = 'pumpio';
|
$services['outbound'][] = 'pumpio';
|
||||||
}
|
}
|
||||||
|
|
||||||
$services['outbound'][] = 'smtp';
|
$services['outbound'][] = 'smtp';
|
||||||
|
|
||||||
if (Addon::isEnabled('tumblr')) {
|
if ($addonHelper->isAddonEnabled('tumblr')) {
|
||||||
$services['outbound'][] = 'tumblr';
|
$services['outbound'][] = 'tumblr';
|
||||||
}
|
}
|
||||||
if (Addon::isEnabled('twitter')) {
|
if ($addonHelper->isAddonEnabled('twitter')) {
|
||||||
$services['outbound'][] = 'twitter';
|
$services['outbound'][] = 'twitter';
|
||||||
}
|
}
|
||||||
if (Addon::isEnabled('wppost')) {
|
if ($addonHelper->isAddonEnabled('wppost')) {
|
||||||
$services['outbound'][] = 'wordpress';
|
$services['outbound'][] = 'wordpress';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue