load('com_admintools', $paths[0], 'en-GB', true); $jlang->load('com_admintools', $paths[1], 'en-GB', true); $jlang->load('com_admintools' . '.override', $paths[0], 'en-GB', true); $jlang->load('com_admintools' . '.override', $paths[1], 'en-GB', true); $debugmessage = ''; if ($this->input->get('debug', -1, 'int') != -1) { if (!defined('AKEEBADEBUG')) { define('AKEEBADEBUG', 1); } $debugmessage = "*** DEBUG MODE ENABLED ***\n"; ini_set('display_errors', 1); } $version = ADMINTOOLS_VERSION; $date = ADMINTOOLS_DATE; $phpversion = PHP_VERSION; $phpenvironment = PHP_SAPI; if ($this->input->get('quiet', -1, 'int') == -1) { $year = gmdate('Y'); echo <<out('You cannot run this script on Joomla 4.'); $this->out(''); $this->out('Joomla 4 currently does not support executing table maintenance commands through'); $this->out('its database interface. As a result Admin Tools cannot support this feature on'); $this->out('sites using Joomla 4.'); $this->out(''); $this->out('This feature will completely go away when we remove Joomla 3 support.'); $this->close(127); } // Attempt to use an infinite time limit, in case you are using the PHP CGI binary instead // of the PHP CLI binary. This will not work with Safe Mode, though. $safe_mode = true; if (function_exists('ini_get')) { $safe_mode = ini_get('safe_mode'); } if (!$safe_mode && function_exists('set_time_limit')) { if ($this->input->get('quiet', -1, 'int') == -1) { echo "Unsetting time limit restrictions.\n"; } @set_time_limit(0); } elseif (!$safe_mode) { if ($this->input->get('quiet', -1, 'int') == -1) { echo "Could not unset time limit restrictions; you may get a timeout error\n"; } } else { if ($this->input->get('quiet', -1, 'int') == -1) { echo "You are using PHP's Safe Mode; you may get a timeout error\n"; } } if ($this->input->get('quiet', -1, 'int') == -1) { echo "\n"; } // Work around some misconfigured servers which print out notices if (function_exists('error_reporting')) { $oldLevel = error_reporting(0); } $container = \FOF40\Container\Container::getInstance('com_admintools', [], 'admin'); if (function_exists('error_reporting')) { error_reporting($oldLevel); } /** @var \Akeeba\AdminTools\Admin\Model\DatabaseTools $model */ $model = $container->factory->model('DatabaseTools')->tmpInstance(); $table = ''; do { $table = $model->repairAndOptimise($table, true); } while ($table); $dbType = $container->db->name; $isMySQL = strpos($dbType, 'mysql') !== false; if (!$isMySQL) { $this->out("You are not using a MySQL database, there's nothing to do here."); $this->close(); } $this->out("Table optimization is now complete."); } } // Instanciate and run the application FOFApplicationCLI::getInstance('AdmintoolsDbrepair')->execute();