mirror of
https://github.com/friendica/friendica
synced 2025-04-28 23:44:23 +02:00
Replace Addon class with AddonHelper in addon index
This commit is contained in:
parent
fda70f3fe3
commit
31f62b807a
1 changed files with 7 additions and 7 deletions
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Module\Admin\Addons;
|
namespace Friendica\Module\Admin\Addons;
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\BaseAdmin;
|
use Friendica\Module\BaseAdmin;
|
||||||
|
@ -24,24 +23,25 @@ class Index extends BaseAdmin
|
||||||
{
|
{
|
||||||
parent::content();
|
parent::content();
|
||||||
|
|
||||||
|
$addonHelper = DI::addonHelper();
|
||||||
|
|
||||||
// reload active themes
|
// reload active themes
|
||||||
if (!empty($_GET['action'])) {
|
if (!empty($_GET['action'])) {
|
||||||
self::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
|
self::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
|
||||||
|
|
||||||
switch ($_GET['action']) {
|
switch ($_GET['action']) {
|
||||||
case 'reload':
|
case 'reload':
|
||||||
Addon::reload();
|
$addonHelper->reloadAddons();
|
||||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addons reloaded'));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Addons reloaded'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'toggle':
|
case 'toggle':
|
||||||
$addonHelper = DI::addonHelper();
|
|
||||||
|
|
||||||
$addon = $_GET['addon'] ?? '';
|
$addon = $_GET['addon'] ?? '';
|
||||||
|
|
||||||
if ($addonHelper->isAddonEnabled($addon)) {
|
if ($addonHelper->isAddonEnabled($addon)) {
|
||||||
Addon::uninstall($addon);
|
$addonHelper->uninstallAddon($addon);
|
||||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||||
} elseif (Addon::install($addon)) {
|
} elseif ($addonHelper->installAddon($addon)) {
|
||||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||||
} else {
|
} else {
|
||||||
DI::sysmsg()->addNotice(DI::l10n()->t('Addon %s failed to install.', $addon));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Addon %s failed to install.', $addon));
|
||||||
|
@ -54,7 +54,7 @@ class Index extends BaseAdmin
|
||||||
DI::baseUrl()->redirect('admin/addons');
|
DI::baseUrl()->redirect('admin/addons');
|
||||||
}
|
}
|
||||||
|
|
||||||
$addons = Addon::getAvailableList();
|
$addons = $addonHelper->getAvailableAddons();
|
||||||
|
|
||||||
$t = Renderer::getMarkupTemplate('admin/addons/index.tpl');
|
$t = Renderer::getMarkupTemplate('admin/addons/index.tpl');
|
||||||
return Renderer::replaceMacros($t, [
|
return Renderer::replaceMacros($t, [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue