diff --git a/src/Core/Addon.php b/src/Core/Addon.php index f798021252..96f3fbc6f5 100644 --- a/src/Core/Addon.php +++ b/src/Core/Addon.php @@ -12,6 +12,8 @@ use Friendica\Util\Strings; /** * Some functions to handle addons + * + * @deprecated 2025.02 Use implementation of `Friendica\Core\Addon\AddonHelper` instead */ class Addon { @@ -43,6 +45,8 @@ class Addon */ 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 = []; $files = glob('addon/*/'); if (is_array($files)) { @@ -75,6 +79,8 @@ class Addon */ 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 = array_filter(DI::config()->get('addons') ?? []); @@ -109,6 +115,8 @@ class Addon */ 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') ?? [])); } @@ -123,6 +131,8 @@ class 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); DI::logger()->debug("Addon {addon}: {action}", ['action' => 'uninstall', 'addon' => $addon]); @@ -151,6 +161,8 @@ class Addon */ 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_file_path = 'addon/' . $addon . '/' . $addon . '.php'; @@ -191,6 +203,8 @@ class Addon */ 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') ?? []); foreach ($addons as $name => $data) { @@ -230,6 +244,8 @@ class Addon */ 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); $info = [ @@ -291,6 +307,8 @@ class Addon */ 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); } @@ -303,6 +321,8 @@ class Addon */ 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; } @@ -316,6 +336,8 @@ class Addon */ 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 = []; $addons = array_filter(DI::config()->get('addons') ?? []);