Hard deprecate Friendica\Core\Addon class

This commit is contained in:
Art4 2025-05-15 07:34:17 +00:00
parent 7b7d542c8f
commit 638496e553

View file

@ -12,6 +12,8 @@ use Friendica\Util\Strings;
/** /**
* Some functions to handle addons * Some functions to handle addons
*
* @deprecated 2025.02 Use implementation of `Friendica\Core\Addon\AddonHelper` instead
*/ */
class Addon class Addon
{ {
@ -43,6 +45,8 @@ class Addon
*/ */
public static function getAvailableList(): array public static function getAvailableList(): array
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
$addons = []; $addons = [];
$files = glob('addon/*/'); $files = glob('addon/*/');
if (is_array($files)) { if (is_array($files)) {
@ -75,6 +79,8 @@ class Addon
*/ */
public static function getAdminList(): array public static function getAdminList(): array
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
$addons_admin = []; $addons_admin = [];
$addons = array_filter(DI::config()->get('addons') ?? []); $addons = array_filter(DI::config()->get('addons') ?? []);
@ -109,6 +115,8 @@ class Addon
*/ */
public static function loadAddons() public static function loadAddons()
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
self::$addons = array_keys(array_filter(DI::config()->get('addons') ?? [])); self::$addons = array_keys(array_filter(DI::config()->get('addons') ?? []));
} }
@ -123,6 +131,8 @@ class Addon
*/ */
public static function uninstall(string $addon) public static function uninstall(string $addon)
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
$addon = Strings::sanitizeFilePathItem($addon); $addon = Strings::sanitizeFilePathItem($addon);
DI::logger()->debug("Addon {addon}: {action}", ['action' => 'uninstall', 'addon' => $addon]); DI::logger()->debug("Addon {addon}: {action}", ['action' => 'uninstall', 'addon' => $addon]);
@ -151,6 +161,8 @@ class Addon
*/ */
public static function install(string $addon): bool public static function install(string $addon): bool
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
$addon = Strings::sanitizeFilePathItem($addon); $addon = Strings::sanitizeFilePathItem($addon);
$addon_file_path = 'addon/' . $addon . '/' . $addon . '.php'; $addon_file_path = 'addon/' . $addon . '/' . $addon . '.php';
@ -191,6 +203,8 @@ class Addon
*/ */
public static function reload() public static function reload()
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
$addons = array_filter(DI::config()->get('addons') ?? []); $addons = array_filter(DI::config()->get('addons') ?? []);
foreach ($addons as $name => $data) { foreach ($addons as $name => $data) {
@ -230,6 +244,8 @@ class Addon
*/ */
public static function getInfo(string $addon): array public static function getInfo(string $addon): array
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
$addon = Strings::sanitizeFilePathItem($addon); $addon = Strings::sanitizeFilePathItem($addon);
$info = [ $info = [
@ -291,6 +307,8 @@ class Addon
*/ */
public static function isEnabled(string $addon): bool public static function isEnabled(string $addon): bool
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
return in_array($addon, self::$addons); return in_array($addon, self::$addons);
} }
@ -303,6 +321,8 @@ class Addon
*/ */
public static function getEnabledList(): array public static function getEnabledList(): array
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
return self::$addons; return self::$addons;
} }
@ -316,6 +336,8 @@ class Addon
*/ */
public static function getVisibleList(): array public static function getVisibleList(): array
{ {
@trigger_error('Class `' . __CLASS__ . '` is deprecated since 2025.02 and will be removed after 5 months, use implementation of `Friendica\Core\Addon\AddonHelper` instead.', E_USER_DEPRECATED);
$visible_addons = []; $visible_addons = [];
$addons = array_filter(DI::config()->get('addons') ?? []); $addons = array_filter(DI::config()->get('addons') ?? []);