diff --git a/astroid.xml b/astroid.xml
index e14f1dba..3a2205ca 100644
--- a/astroid.xml
+++ b/astroid.xml
@@ -4,7 +4,7 @@
astroid
Astroid Framework Team
November 2024
- 3.1.8-rc1
+ 3.1.8-rc2
https://astroidframe.work/
Copyright (C) 2024 TemPlaza, Inc. All rights reserved.
GNU General Public License version 3 or later; see LICENSE.txt
diff --git a/astroid_framework.xml b/astroid_framework.xml
index 413ee41f..921c766d 100644
--- a/astroid_framework.xml
+++ b/astroid_framework.xml
@@ -1,13 +1,13 @@
Astroid Framework
- 3.1.7
+ 3.1.8
https://astroidframe.work/
astroid
library
0
- https://github.com/templaza/astroid-framework/releases/download/v3.1.7/astroid-framework-3.1.7.zip
+ https://github.com/templaza/astroid-framework/releases/download/v3.1.8/astroid-framework-3.1.8.zip
stable
diff --git a/framework/library/astroid/Helper/Constants.php b/framework/library/astroid/Helper/Constants.php
index 0450fe4b..a82e0286 100644
--- a/framework/library/astroid/Helper/Constants.php
+++ b/framework/library/astroid/Helper/Constants.php
@@ -18,7 +18,7 @@
class Constants
{
- public static $astroid_version = '3.1.8-rc1';
+ public static $astroid_version = '3.1.8';
public static $fontawesome_version = '6.6.0';
public static $fancybox_version = '5.0';
public static $animatecss_version = '3.7.0';
diff --git a/script.php b/script.php
index 92e52ff5..f64dfc5e 100644
--- a/script.php
+++ b/script.php
@@ -3,168 +3,207 @@
/**
* @package Astroid Framework
* @author Astroid Framework Team https://astroidframe.work
- * @copyright Copyright (C) 2023 AstroidFrame.work
+ * @copyright Copyright (C) 2024 AstroidFrame.work
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/
-use Joomla\CMS\Factory;
-use Joomla\CMS\Installer\Installer;
-use Astroid\Helper\Overrides;
-use Joomla\Database\DatabaseInterface;
// no direct access
-defined('_JEXEC') or die;
+use Joomla\CMS\Application\AdministratorApplication;
+use Joomla\CMS\Installer\InstallerAdapter;
+use Joomla\CMS\Installer\InstallerScriptInterface;
+use Joomla\CMS\Language\Text;
+use Joomla\Database\DatabaseInterface;
+use Joomla\DI\Container;
+use Joomla\DI\ServiceProviderInterface;
+use Joomla\Filesystem\File;
+use Joomla\Filesystem\Exception\FilesystemException;
+use Astroid\Helper\Overrides;
+use Joomla\CMS\Installer\Installer;
-if (!class_exists('astroidInstallerScript')) {
- class astroidInstallerScript
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+return new class () implements ServiceProviderInterface {
+ public function register(Container $container)
{
- /**
- *
- * Function to run before installing the component
- */
- public function preflight($type, $parent)
- {
- $plugin_dir = JPATH_LIBRARIES . '/' . 'astroid' . '/' . 'plugins' . '/';
- $plugins = array_filter(glob($plugin_dir . '*'), 'is_dir');
- foreach ($plugins as $plugin) {
- if ($type == "uninstall") {
- $this->uninstallPlugin($plugin, $plugin_dir);
+ $container->set(
+ InstallerScriptInterface::class,
+ new class (
+ $container->get(AdministratorApplication::class),
+ $container->get(DatabaseInterface::class)
+ ) implements InstallerScriptInterface {
+ private AdministratorApplication $app;
+ private DatabaseInterface $db;
+
+ public function __construct(AdministratorApplication $app, DatabaseInterface $db)
+ {
+ $this->app = $app;
+ $this->db = $db;
+ }
+
+ public function install(InstallerAdapter $parent): bool
+ {
+ $this->app->enqueueMessage('Successful installed.');
+
+ return true;
}
- }
- if (JVERSION >= 4) {
- $module_dir = JPATH_LIBRARIES . '/' . 'astroid' . '/' . 'modules' . '/';
- $modules = array_filter(glob($module_dir . '*'), 'is_dir');
- foreach ($modules as $module) {
- if ($type == "uninstall") {
- $this->uninstallModule($module, $module_dir);
+ public function update(InstallerAdapter $parent): bool
+ {
+ $this->app->enqueueMessage('Successful updated.');
+
+ return true;
+ }
+
+ public function uninstall(InstallerAdapter $parent): bool
+ {
+ $this->app->enqueueMessage('Successful uninstalled.');
+
+ return true;
+ }
+
+ public function preflight(string $type, InstallerAdapter $parent): bool
+ {
+ $plugin_dir = JPATH_LIBRARIES . '/' . 'astroid' . '/' . 'plugins' . '/';
+ $plugins = array_filter(glob($plugin_dir . '*'), 'is_dir');
+ foreach ($plugins as $plugin) {
+ if ($type == "uninstall") {
+ $this->uninstallPlugin($plugin, $plugin_dir);
+ }
}
+
+ $module_dir = JPATH_LIBRARIES . '/' . 'astroid' . '/' . 'modules' . '/';
+ $modules = array_filter(glob($module_dir . '*'), 'is_dir');
+ foreach ($modules as $module) {
+ if ($type == "uninstall") {
+ $this->uninstallModule($module, $module_dir);
+ }
+ }
+ return true;
}
- }
- }
-
- /**
- *
- * Function to run after installing the component
- */
- public function postflight($type, $parent)
- {
- $plugin_dir = JPATH_LIBRARIES . '/' . 'astroid' . '/' . 'plugins' . '/';
- $plugins = array_filter(glob($plugin_dir . '*'), 'is_dir');
- foreach ($plugins as $plugin) {
- if ($type == "install" || $type == "update") {
- $this->installPlugin($plugin, $plugin_dir);
+
+ public function postflight(string $type, InstallerAdapter $parent): bool
+ {
+ $plugin_dir = JPATH_LIBRARIES . '/' . 'astroid' . '/' . 'plugins' . '/';
+ $plugins = array_filter(glob($plugin_dir . '*'), 'is_dir');
+ foreach ($plugins as $plugin) {
+ if ($type == "install" || $type == "update") {
+ $this->installPlugin($plugin, $plugin_dir);
+ }
+ }
+
+ $module_dir = JPATH_LIBRARIES . '/' . 'astroid' . '/' . 'modules' . '/';
+ $modules = array_filter(glob($module_dir . '*'), 'is_dir');
+ foreach ($modules as $module) {
+ if ($type == "install" || $type == "update") {
+ $this->installModule($module, $module_dir);
+ }
+ }
+
+ if ($type == "update") {
+ Overrides::fix();
+ }
+
+ return true;
+ }
+
+ private function installPlugin($plugin, $plugin_dir)
+ {
+ $db = $this->db;
+ $plugin_name = str_replace($plugin_dir, '', $plugin);
+
+ $installer = new Installer;
+ $installer->install($plugin);
+
+ $query = $db->getQuery(true);
+ $query->update('#__extensions');
+ $query->set($db->quoteName('enabled') . ' = 1');
+ $query->where($db->quoteName('element') . ' = ' . $db->quote($plugin_name));
+ $query->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
+ $db->setQuery($query);
+ $db->execute();
+ return true;
}
- }
- if (JVERSION >= 4) {
- $module_dir = JPATH_LIBRARIES . '/' . 'astroid' . '/' . 'modules' . '/';
- $modules = array_filter(glob($module_dir . '*'), 'is_dir');
- foreach ($modules as $module) {
- if ($type == "install" || $type == "update") {
- $this->installModule($module, $module_dir);
+ private function installModule($module, $module_dir)
+ {
+ $db = $this->db;
+ $module_name = str_replace($module_dir, '', $module);
+
+ $installer = new Installer;
+ $installer->install($module);
+
+ $query = $db->getQuery(true);
+ $query->update('#__extensions');
+ $query->set($db->quoteName('enabled') . ' = 1');
+ $query->where($db->quoteName('element') . ' = ' . $db->quote($module_name));
+ $query->where($db->quoteName('type') . ' = ' . $db->quote('module'));
+ $db->setQuery($query);
+ $db->execute();
+
+ if ($module_name === 'mod_astroid_clear_cache') {
+ $query = $db->getQuery(true);
+ $query->update('#__modules');
+ $query->set($db->quoteName('published') . ' = 1');
+ $query->set($db->quoteName('position') . ' = ' . $db->quote('status'));
+ $query->set($db->quoteName('params') . ' = ' . $db->quote('{"layout":"_:default","moduleclass_sfx":"","style":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":""}'));
+ $query->where($db->quoteName('module') . ' = ' . $db->quote($module_name));
+ $db->setQuery($query);
+ $db->execute();
+ }
+
+ // Retrieve ID
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName('id'));
+ $query->from($db->quoteName('#__modules'));
+ $query->where($db->quoteName('module') . ' = ' . $db->quote($module_name));
+ $db->setQuery($query);
+ $id = (int) $db->loadResult();
+
+ if ($id) {
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName('moduleid'));
+ $query->from($db->quoteName('#__modules_menu'));
+ $query->where($db->quoteName('moduleid') . ' = ' . $id);
+ $db->setQuery($query);
+ if (!$db->loadResult()) {
+ $db->getQuery(true);
+ $db->setQuery("INSERT INTO #__modules_menu (`moduleid`,`menuid`) VALUES (".$id.", 0)");
+ $db->execute();
+ }
}
+ return true;
}
- }
- if ($type == "update") {
- Overrides::fix();
- }
- }
-
- public function installPlugin($plugin, $plugin_dir)
- {
- $db = Factory::getContainer()->get(DatabaseInterface::class);
- $plugin_name = str_replace($plugin_dir, '', $plugin);
-
- $installer = new Installer;
- $installer->install($plugin);
-
- $query = $db->getQuery(true);
- $query->update('#__extensions');
- $query->set($db->quoteName('enabled') . ' = 1');
- $query->where($db->quoteName('element') . ' = ' . $db->quote($plugin_name));
- $query->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
- $db->setQuery($query);
- $db->execute();
- return true;
- }
-
- public function installModule($module, $module_dir)
- {
- $db = Factory::getContainer()->get(DatabaseInterface::class);
- $module_name = str_replace($module_dir, '', $module);
-
- $installer = new Installer;
- $installer->install($module);
-
- $query = $db->getQuery(true);
- $query->update('#__extensions');
- $query->set($db->quoteName('enabled') . ' = 1');
- $query->where($db->quoteName('element') . ' = ' . $db->quote($module_name));
- $query->where($db->quoteName('type') . ' = ' . $db->quote('module'));
- $db->setQuery($query);
- $db->execute();
-
- if ($module_name === 'mod_astroid_clear_cache') {
- $query = $db->getQuery(true);
- $query->update('#__modules');
- $query->set($db->quoteName('published') . ' = 1');
- $query->set($db->quoteName('position') . ' = ' . $db->quote('status'));
- $query->set($db->quoteName('params') . ' = ' . $db->quote('{"layout":"_:default","moduleclass_sfx":"","style":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":""}'));
- $query->where($db->quoteName('module') . ' = ' . $db->quote($module_name));
- $db->setQuery($query);
- $db->execute();
- }
+ private function uninstallPlugin($plugin, $plugin_dir)
+ {
+ $db = $this->db;
+ $plugin_name = str_replace($plugin_dir, '', $plugin);
+ $query = $db->getQuery(true);
+ $query->update('#__extensions');
+ $query->set($db->quoteName('enabled') . ' = 0');
+ $query->where($db->quoteName('element') . ' = ' . $db->quote($plugin_name));
+ $query->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
+ $db->setQuery($query);
+ $db->execute();
+ return true;
+ }
- // Retrieve ID
- $query = $db->getQuery(true);
- $query->select($db->quoteName('id'));
- $query->from($db->quoteName('#__modules'));
- $query->where($db->quoteName('module') . ' = ' . $db->quote($module_name));
- $db->setQuery($query);
- $id = (int) $db->loadResult();
-
- if ($id) {
- $query = $db->getQuery(true);
- $query->select($db->quoteName('moduleid'));
- $query->from($db->quoteName('#__modules_menu'));
- $query->where($db->quoteName('moduleid') . ' = ' . $id);
- $db->setQuery($query);
- if (!$db->loadResult()) {
- $db->getQuery(true);
- $db->setQuery("INSERT INTO #__modules_menu (`moduleid`,`menuid`) VALUES (".$id.", 0)");
+ private function uninstallModule($module, $module_dir)
+ {
+ $db = $this->db;
+ $module_name = str_replace($module_dir, '', $module);
+ $query = $db->getQuery(true);
+ $query->update('#__extensions');
+ $query->set($db->quoteName('enabled') . ' = 0');
+ $query->where($db->quoteName('element') . ' = ' . $db->quote($module_name));
+ $query->where($db->quoteName('type') . ' = ' . $db->quote('module'));
+ $db->setQuery($query);
$db->execute();
+ return true;
}
}
- return true;
- }
-
- public function uninstallPlugin($plugin, $plugin_dir)
- {
- $db = Factory::getContainer()->get(DatabaseInterface::class);
- $plugin_name = str_replace($plugin_dir, '', $plugin);
- $query = $db->getQuery(true);
- $query->update('#__extensions');
- $query->set($db->quoteName('enabled') . ' = 0');
- $query->where($db->quoteName('element') . ' = ' . $db->quote($plugin_name));
- $query->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
- $db->setQuery($query);
- $db->execute();
- return true;
- }
-
- public function uninstallModule($module, $module_dir)
- {
- $db = Factory::getContainer()->get(DatabaseInterface::class);
- $module_name = str_replace($module_dir, '', $module);
- $query = $db->getQuery(true);
- $query->update('#__extensions');
- $query->set($db->quoteName('enabled') . ' = 0');
- $query->where($db->quoteName('element') . ' = ' . $db->quote($module_name));
- $query->where($db->quoteName('type') . ' = ' . $db->quote('module'));
- $db->setQuery($query);
- $db->execute();
- return true;
- }
+ );
}
-}
\ No newline at end of file
+};
\ No newline at end of file