From 0da524fefe93b3028392e9014550eea3324d3a22 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 23 Jun 2025 00:21:41 +0200 Subject: [PATCH 01/11] Fix plugin install:install command --- system/src/Plugins.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/src/Plugins.php b/system/src/Plugins.php index 85f0a2ba..37a1af3c 100644 --- a/system/src/Plugins.php +++ b/system/src/Plugins.php @@ -781,15 +781,15 @@ class Plugins { return false; } - if(!isset($plugin_json['install'])) { - self::$error = "Plugin doesn't have install options defined. Skipping..."; - return false; + $install = $plugin_json['install'] ?? ''; + if (self::getAutoLoadOption($plugin_json, 'install', true) && is_file(PLUGINS . $plugin_name . '/install.php')) { + $install = 'plugins/' . $plugin_name . '/install.php'; } global $db; - if (file_exists(BASE . $plugin_json['install'])) { + if (file_exists(BASE . $install)) { $db->revalidateCache(); - require BASE . $plugin_json['install']; + require BASE . $install; $db->revalidateCache(); } else { From 181131f7f3402b324747fdb2e7a32d1d9d9179ee Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 24 Jun 2025 12:44:34 +0200 Subject: [PATCH 02/11] Use __DIR__ instead of template path --- templates/tibiacom/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/tibiacom/index.php b/templates/tibiacom/index.php index 6d0d1e63..46ef0698 100644 --- a/templates/tibiacom/index.php +++ b/templates/tibiacom/index.php @@ -454,7 +454,7 @@ foreach($config['menu_categories'] as $id => $cat) { foreach($config['boxes'] as $box) { /** @var string $template_name */ - $file = TEMPLATES . $template_name . '/boxes/' . $box . '.php'; + $file = __DIR__ . '/boxes/' . $box . '.php'; if(file_exists($file)) { include($file); ?> Date: Tue, 24 Jun 2025 12:44:43 +0200 Subject: [PATCH 03/11] Fix polls link --- templates/tibiacom/boxes/templates/poll.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/tibiacom/boxes/templates/poll.html.twig b/templates/tibiacom/boxes/templates/poll.html.twig index 0b643ee5..25f10865 100644 --- a/templates/tibiacom/boxes/templates/poll.html.twig +++ b/templates/tibiacom/boxes/templates/poll.html.twig @@ -1,6 +1,6 @@
{{ poll.question }}
-
+
From f78ebad136c36ddeace2f90d714d1190af89262e Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 24 Jun 2025 14:57:01 +0200 Subject: [PATCH 04/11] Remove error number from 404 & 405 pages --- system/pages/404.php | 2 +- system/pages/405.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/pages/404.php b/system/pages/404.php index 90a8921a..60fb66aa 100644 --- a/system/pages/404.php +++ b/system/pages/404.php @@ -8,7 +8,7 @@ * @link https://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); -$title = '404 Not Found'; +$title = 'Not Found'; header('HTTP/1.0 404 Not Found'); ?> diff --git a/system/pages/405.php b/system/pages/405.php index 3d585f59..d1eee43a 100644 --- a/system/pages/405.php +++ b/system/pages/405.php @@ -8,7 +8,7 @@ * @link https://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); -$title = '405 Method Not Allowed'; +$title = 'Method Not Allowed'; header('HTTP/1.0 405 Method Not Allowed'); ?> From 13d33822b59df349199e885a78a3d6beb0863d0b Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 25 Jun 2025 17:36:02 +0200 Subject: [PATCH 05/11] Rename to plugin:setup, also add alias to previous command --- system/src/Commands/PluginInstallInstallCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/src/Commands/PluginInstallInstallCommand.php b/system/src/Commands/PluginInstallInstallCommand.php index fe1b4f14..116eeb13 100644 --- a/system/src/Commands/PluginInstallInstallCommand.php +++ b/system/src/Commands/PluginInstallInstallCommand.php @@ -12,7 +12,8 @@ class PluginInstallInstallCommand extends Command { protected function configure(): void { - $this->setName('plugin:install:install') + $this->setName('plugin:setup') + ->setAliases(['plugin:install:install']) ->setDescription('This command executes the "install" part of the plugin') ->addArgument('plugin', InputArgument::REQUIRED, 'Plugin name'); } From 6d43fc181fce9a40a78954689a3d0f744a6eea3b Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 25 Jun 2025 17:36:43 +0200 Subject: [PATCH 06/11] In case the script don't have install option, inform the user --- system/src/Plugins.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/src/Plugins.php b/system/src/Plugins.php index 37a1af3c..c880dd90 100644 --- a/system/src/Plugins.php +++ b/system/src/Plugins.php @@ -786,6 +786,11 @@ class Plugins { $install = 'plugins/' . $plugin_name . '/install.php'; } + if (empty($install)) { + self::$error = "This plugin doesn't seem to have install script defined."; + return false; + } + global $db; if (file_exists(BASE . $install)) { $db->revalidateCache(); From 0bff910a056974d4698a02f5a9398d6a2be1f3be Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 25 Jun 2025 19:43:40 +0200 Subject: [PATCH 07/11] adjust command email:send + mail:send (alias) --- system/src/Commands/MailSendCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system/src/Commands/MailSendCommand.php b/system/src/Commands/MailSendCommand.php index ff1450e6..983e6fc5 100644 --- a/system/src/Commands/MailSendCommand.php +++ b/system/src/Commands/MailSendCommand.php @@ -12,9 +12,10 @@ class MailSendCommand extends Command { protected function configure(): void { - $this->setName('mail:send') + $this->setName('email:send') + ->setAliases(['mail:send']) ->setDescription('This command sends E-Mail to single user. Message can be provided as follows: ' . PHP_EOL - . ' echo "Hello World" | php sa email:send --subject="This is the subject" test@test.com') + . ' echo "Hello World" | php aac email:send --subject="This is the subject" test@test.com') ->addArgument('recipient', InputArgument::REQUIRED, 'Email, Account Name, Account id or Player Name') ->addOption('subject', 's', InputOption::VALUE_REQUIRED, 'Subject'); } From fe8281594e989f00280ba1adc734a9198c6b5cc1 Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 27 Jun 2025 07:13:33 +0200 Subject: [PATCH 08/11] Fix cache:clear command (missing init) --- system/src/Commands/CacheClearCommand.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/src/Commands/CacheClearCommand.php b/system/src/Commands/CacheClearCommand.php index 3b052995..5b1715b5 100644 --- a/system/src/Commands/CacheClearCommand.php +++ b/system/src/Commands/CacheClearCommand.php @@ -17,10 +17,7 @@ class CacheClearCommand extends Command protected function execute(InputInterface $input, OutputInterface $output): int { - global $hooks; - $hooks = new Hooks(); - $hooks->load(); - $hooks->trigger(HOOK_INIT); + require SYSTEM . 'init.php'; $io = new SymfonyStyle($input, $output); From 047742848bf1a14282ceac2af7cc397ce5ae6725 Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 27 Jun 2025 07:15:13 +0200 Subject: [PATCH 09/11] Delete clearRouteCache, was useless Directory is cleaned already --- system/functions.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/system/functions.php b/system/functions.php index 3ef7a8a2..a3c302c3 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1275,23 +1275,12 @@ function clearCache() deleteDirectory(CACHE . 'plugins', ['index.html'], true); deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html', 'persistent'], true); - // routes cache - clearRouteCache(); - global $hooks; $hooks->trigger(HOOK_CACHE_CLEAR, ['cache' => Cache::getInstance()]); return true; } -function clearRouteCache(): void -{ - $routeCacheFile = CACHE . 'route.cache'; - if (file_exists($routeCacheFile)) { - unlink($routeCacheFile); - } -} - function getCustomPageInfo($name) { global $logged_access; From b4b62442fe9470e94c94812c533cc132e165003f Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 27 Jun 2025 07:21:19 +0200 Subject: [PATCH 10/11] Release v1.7.1 --- CHANGELOG-1.x.md | 9 +++++++++ common.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-1.x.md b/CHANGELOG-1.x.md index 34439313..28c946ec 100644 --- a/CHANGELOG-1.x.md +++ b/CHANGELOG-1.x.md @@ -1,5 +1,14 @@ # Changelog +## [1.7.1 - 27.06.2025] + +### Changed +* Rename plugin:install:install to plugin:setup, also add alias to previous command (https://github.com/slawkens/myaac/commit/13d33822b59df349199e885a78a3d6beb0863d0b) + +### Fixed +* Fix commands: setup + cache:clear (https://github.com/slawkens/myaac/commit/0da524fefe93b3028392e9014550eea3324d3a22, https://github.com/slawkens/myaac/commit/fe8281594e989f00280ba1adc734a9198c6b5cc1) +* Fix polls link in tibiacom template (https://github.com/slawkens/myaac/commit/d90fa323d7c77d81768df60feeb1c374b1650a0c) + ## [1.7 - 22.06.2025] ### Added diff --git a/common.php b/common.php index e07242b6..94395409 100644 --- a/common.php +++ b/common.php @@ -26,7 +26,7 @@ if (version_compare(phpversion(), '8.1', '<')) die('PHP version 8.1 or higher is required.'); const MYAAC = true; -const MYAAC_VERSION = '1.7.1-dev'; +const MYAAC_VERSION = '1.7.1'; const DATABASE_VERSION = 45; const TABLE_PREFIX = 'myaac_'; define('START_TIME', microtime(true)); From c92148d467e9c19fdf68d0f77dacec9cfe2e34cf Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 27 Jun 2025 07:23:22 +0200 Subject: [PATCH 11/11] Revert delete clearRouteCache, is used somewhere else --- system/functions.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/system/functions.php b/system/functions.php index a3c302c3..540c9af3 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1281,6 +1281,14 @@ function clearCache() return true; } +function clearRouteCache(): void +{ + $routeCacheFile = CACHE . 'route.cache'; + if (file_exists($routeCacheFile)) { + unlink($routeCacheFile); + } +} + function getCustomPageInfo($name) { global $logged_access;