]> git.mxchange.org Git - friendica.git/commitdiff
Deprecate Addon::DIRECTORY in favor of AddonHelper::getAddonPath()
authorArt4 <art4@wlabs.de>
Tue, 4 Feb 2025 13:13:57 +0000 (13:13 +0000)
committerArt4 <art4@wlabs.de>
Tue, 4 Feb 2025 13:13:57 +0000 (13:13 +0000)
src/Core/Addon.php
src/Core/Addon/AddonHelper.php
src/Core/Addon/AddonProxy.php
static/dependencies.config.php

index cdf161722fe98a98e73f1bd9828587bdb56acdaa..39a1737946e7a6d06d3e5fb9f96fcff9fecb0e40 100644 (file)
@@ -18,6 +18,9 @@ class Addon
 {
        /**
         * The addon sub-directory
+        *
+        * @deprecated 2025.02 Use `Friendica\Core\Addon\AddonHelper::getAddonPath()` instead
+        *
         * @var string
         */
        const DIRECTORY = 'addon';
index 0ac2f2ca00b962970fa6795051196573fee37072..47962692f8f256311b2ecf2ed5f8077de66dbcf2 100644 (file)
@@ -14,6 +14,13 @@ namespace Friendica\Core\Addon;
  */
 interface AddonHelper
 {
+       /**
+        * Returns the absolute path to the addon folder
+        *
+        * e.g. `/var/www/html/addon`
+        */
+       public function getAddonPath(): string;
+
        /**
         * Returns the list of available addons with their current status and info.
         * This list is made from scanning the addon/ folder.
index edba8af2f4218d0ccfb69bb61f1caf7d11c658f2..360a54ff06b875bb382e7782d5e2f07d7d15605e 100644 (file)
@@ -18,6 +18,23 @@ use Friendica\Core\Addon;
  */
 final class AddonProxy implements AddonHelper
 {
+       private string $addonPath;
+
+       public function __construct(string $addonPath)
+       {
+               $this->addonPath = $addonPath;
+       }
+
+       /**
+        * Returns the absolute path to the addon folder
+        *
+        * e.g. `/var/www/html/addon`
+        */
+       public function getAddonPath(): string
+       {
+               return $this->addonPath;
+       }
+
        /**
         * Returns the list of available addons with their current status and info.
         * This list is made from scanning the addon/ folder.
index c41200cb4eeed0ccfef08cece724d1f422f79972..d2de70d2082c80166a26dd98efb476d16b6c378e 100644 (file)
@@ -44,6 +44,9 @@ return (function(string $basepath, array $getVars, array $serverVars, array $coo
                ],
                \Friendica\Core\Addon\AddonHelper::class => [
                        'instanceOf' => \Friendica\Core\Addon\AddonProxy::class,
+                       'constructParams' => [
+                               $basepath . '/addon',
+                       ],
                ],
                \Friendica\Util\BasePath::class => [
                        'constructParams' => [