diff --git a/.gitignore b/.gitignore index 53cd9d092b..b9ce883dc4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,3 @@ !.php_cs /.php_cs.cache ###< friendsofphp/php-cs-fixer ### - -plugins/available \ No newline at end of file diff --git a/plugins/Test/Controller/TestController.php b/plugins/Test/Controller/TestController.php new file mode 100644 index 0000000000..a9b6fdee6d --- /dev/null +++ b/plugins/Test/Controller/TestController.php @@ -0,0 +1,14 @@ + Test controller '); + } +} diff --git a/plugins/available/Test/Test.php b/plugins/Test/Test.php similarity index 100% rename from plugins/available/Test/Test.php rename to plugins/Test/Test.php diff --git a/plugins/Test/manifest.yaml b/plugins/Test/manifest.yaml new file mode 100644 index 0000000000..164690bfac --- /dev/null +++ b/plugins/Test/manifest.yaml @@ -0,0 +1,15 @@ +info: + name: 'Example' + version: '0.1' + author: 'Hugo Sales' + homepage: '{project_url}' + description: | + Test plugin + Description can use multiple lines + +permissions: + database: + - 'table1': 'r' + - 'table2': 'rw' + filesystem: + - 'folder': 'rw' diff --git a/plugins/enabled/Test b/plugins/enabled/Test deleted file mode 120000 index 8a972074b2..0000000000 --- a/plugins/enabled/Test +++ /dev/null @@ -1 +0,0 @@ -../available/Test/ \ No newline at end of file diff --git a/src/Kernel.php b/src/Kernel.php index c63833381d..b651992f3a 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -49,21 +49,21 @@ class Kernel extends BaseKernel { parent::__construct($environment, $debug); - if (!\defined('INSTALLDIR')) { + if (!defined('INSTALLDIR')) { define('INSTALLDIR', dirname(__DIR__)); define('SRCDIR', INSTALLDIR . '/src'); define('PUBLICDIR', INSTALLDIR . '/public'); - define('GNUSOCIAL_ENGINE', 'GNU social'); + define('GS_ENGINE_NAME', 'GNU social'); // MERGE Change to https://gnu.io/social/ - define('GNUSOCIAL_ENGINE_URL', 'https://gnusocial.network/'); + define('GS_PROJECT_URL', 'https://gnusocial.network/'); // MERGE Change to https://git.gnu.io/gnu/gnu-social - define('GNUSOCIAL_ENGINE_REPO_URL', 'https://notabug.org/diogo/gnu-social/'); + define('GS_REPOSITORY_URL', 'https://notabug.org/diogo/gnu-social/'); // Current base version, major.minor.patch - define('GNUSOCIAL_BASE_VERSION', '3.0.0'); + define('GS_BASE_VERSION', '3.0.0'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release' - define('GNUSOCIAL_LIFECYCLE', 'dev'); - define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE); - define('GNUSOCIAL_CODENAME', 'Big bang'); + define('GS_LIFECYCLE', 'dev'); + define('GS_VERSION', GS_BASE_VERSION . '-' . GS_LIFECYCLE); + define('GS_CODENAME', 'Big bang'); // Work internally in UTC date_default_timezone_set('UTC'); diff --git a/src/Util/GNUsocial.php b/src/Util/GNUsocial.php index 85a8608098..b5abdc955b 100644 --- a/src/Util/GNUsocial.php +++ b/src/Util/GNUsocial.php @@ -68,14 +68,14 @@ class GNUsocial implements EventSubscriberInterface } /** - * Store these services to be accessed statically and load extensions + * Store these services to be accessed statically and load modules */ public function register(EventDispatcherInterface $event_dispatcher): void { Log::setLogger($this->logger); GSEvent::setDispatcher($event_dispatcher); I18n::setTranslator($this->translator); - ExtensionManager::loadExtensions(); + ModulesManager::loadModules(); } /** diff --git a/src/Util/ExtensionManager.php b/src/Util/ModulesManager.php similarity index 82% rename from src/Util/ExtensionManager.php rename to src/Util/ModulesManager.php index b214dfbf1f..f0b2aed97b 100644 --- a/src/Util/ExtensionManager.php +++ b/src/Util/ModulesManager.php @@ -18,13 +18,13 @@ */ /** - * Extension loader code, one of the main features of GNU social + * Module and plugin loader code, one of the main features of GNU social * * Loads plugins from `plugins/enabled`, instances them * and hooks its events * * @package GNUsocial - * @category Extensions + * @category Modules * * @author Hugo Sales * @copyright 2020 Free Software Foundation, Inc http://www.fsf.org @@ -36,21 +36,21 @@ namespace App\Util; use App\Util\GSEvent as Event; use Functional as F; -abstract class ExtensionManager +abstract class ModulesManager { - public static array $extensions = []; + public static array $modules = []; - public static function loadExtensions() + public static function loadModules() { - $plugins_paths = glob(INSTALLDIR . '/plugins/enabled/*'); + $plugins_paths = glob(INSTALLDIR . '/plugins/*'); foreach ($plugins_paths as $plugin_path) { $class_name = basename($plugin_path); $qualified = 'Plugin\\' . $class_name . '\\' . $class_name; require_once $plugin_path . '/' . $class_name . '.php'; - $class = new $qualified; - self::$extensions[] = $class; + $class = new $qualified; + self::$modules[] = $class; // Register event handlers $methods = get_class_methods($class);