uawdijnntqw1x1x1
IP : 216.73.217.142
Hostname : localhost.localdomain
Kernel : Linux localhost.localdomain 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
OS : Linux
PATH:
/
var
/
www
/
consult-e-syn
/
public_html
/
.
/
00a80
/
cli.tar
/
/
update_cron.php000064400000003276152160445070007574 0ustar00<?php /** * @package Joomla.Cli * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * This is a CRON script which should be called from the command-line, not the * web. For example something like: * /usr/bin/php /path/to/site/cli/update_cron.php */ // Set flag that this is a parent file. const _JEXEC = 1; error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', 1); // Load system defines if (file_exists(dirname(__DIR__) . '/defines.php')) { require_once dirname(__DIR__) . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } require_once JPATH_LIBRARIES . '/import.legacy.php'; require_once JPATH_LIBRARIES . '/cms.php'; // Load the configuration require_once JPATH_CONFIGURATION . '/configuration.php'; /** * This script will fetch the update information for all extensions and store * them in the database, speeding up your administrator. * * @since 2.5 */ class Updatecron extends JApplicationCli { /** * Entry point for the script * * @return void * * @since 2.5 */ public function doExecute() { // Get the update cache time $component = JComponentHelper::getComponent('com_installer'); $params = $component->params; $cache_timeout = $params->get('cachetimeout', 6, 'int'); $cache_timeout = 3600 * $cache_timeout; // Find all updates $this->out('Fetching updates...'); $updater = JUpdater::getInstance(); $updater->findUpdates(0, $cache_timeout); $this->out('Finished fetching updates'); } } JApplicationCli::getInstance('Updatecron')->execute(); akeeba-check-failed.php000077500000012255152160445070011000 0ustar00<?php /** * @package akeebabackup * @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ use Akeeba\Backup\Site\Model\Statistics; use Akeeba\Engine\Platform; use FOF40\Container\Container; // Enable and include Akeeba Engine define('AKEEBAENGINE', 1); // Setup and import the base CLI script $minphp = '7.2.0'; // Boilerplate -- START define('_JEXEC', 1); foreach ([__DIR__, getcwd()] as $curdir) { if (file_exists($curdir . '/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/defines.php'; break; } if (file_exists($curdir . '/../includes/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/../includes/defines.php'; break; } } defined('JPATH_LIBRARIES') || die ('This script must be placed in or run from the cli folder of your site.'); require_once JPATH_LIBRARIES . '/fof40/Cli/Application.php'; // Boilerplate -- END // Load the version file require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/version.php'; // Set up the cacert.pem location $caCertPath = class_exists('\\Composer\\CaBundle\\CaBundle') ? \Composer\CaBundle\CaBundle::getBundledCaBundlePath() : JPATH_LIBRARIES . '/src/Http/Transport/cacert.pem'; define('AKEEBA_CACERT_PEM', $caCertPath); /** * Akeeba Backup Check failed application */ class AkeebaBackupCheckfailed extends FOFApplicationCLI { public function doExecute() { // Load the language files $paths = [JPATH_ADMINISTRATOR, JPATH_ROOT]; $jlang = JFactory::getLanguage(); $jlang->load('com_akeeba', $paths[0], 'en-GB', true); $jlang->load('com_akeeba', $paths[1], 'en-GB', true); $jlang->load('com_akeeba' . '.override', $paths[0], 'en-GB', true); $jlang->load('com_akeeba' . '.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"; } $version = AKEEBA_VERSION; $date = AKEEBA_DATE; $phpversion = PHP_VERSION; $phpenvironment = PHP_SAPI; $verboseOutput = $this->input->get('quiet', -1, 'int') == -1; if ($verboseOutput) { $year = gmdate('Y'); echo <<<ENDBLOCK Akeeba Backup Check failed backups CLI $version ($date) Copyright (c) 2006-$year Akeeba Ltd / Nicholas K. Dionysopoulos ------------------------------------------------------------------------------- Akeeba Backup is Free Software, distributed under the terms of the GNU General Public License version 3 or, at your option, any later version. This program comes with ABSOLUTELY NO WARRANTY as per sections 15 & 16 of the license. See http://www.gnu.org/licenses/gpl-3.0.html for details. ------------------------------------------------------------------------------- You are using PHP $phpversion ($phpenvironment) $debugmessage Checking for failed backups ENDBLOCK; } if (class_exists('Joomla\CMS\Component\ComponentHelper') && \Joomla\CMS\Component\ComponentHelper::isEnabled('com_akeebabackup')) { echo "ERROR!\n"; echo "Please finish upgrading to Akeeba Backup 9 and uninstall Akeeba Backup 8\n"; echo "per the instructions shown on your site's backend, Components, Akeeba Backup\n"; echo "\n"; echo "This script will refuse to continue.\n"; die("\n"); } // Load the engine $factoryPath = JPATH_ADMINISTRATOR . '/components/com_akeeba/BackupEngine/Factory.php'; define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_akeeba'); define('AKEEBAROOT', JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba'); if (!file_exists($factoryPath)) { echo "ERROR!\n"; echo "Could not load the backup engine; file does not exist. Technical information:\n"; echo "Path to " . basename(__FILE__) . ": " . __DIR__ . "\n"; echo "Path to factory file: $factoryPath\n"; die("\n"); } else { try { require_once $factoryPath; } catch (Exception $e) { echo "ERROR!\n"; echo "Backup engine returned an error. Technical information:\n"; echo "Error message:\n\n"; echo $e->getMessage() . "\n\n"; echo "Path to " . basename(__FILE__) . ":" . __DIR__ . "\n"; echo "Path to factory file: $factoryPath\n"; die("\n"); } } // Assign the correct platform Platform::addPlatform('joomla3x', JPATH_COMPONENT_ADMINISTRATOR . '/BackupPlatform/Joomla3x'); define('AKEEBA_BACKUP_ORIGIN', 'cli'); // Work around some misconfigured servers which print out notices if (function_exists('error_reporting')) { $oldLevel = error_reporting(0); } $container = Container::getInstance('com_akeeba', [ 'input' => $this->input, ]); if (function_exists('error_reporting')) { error_reporting($oldLevel); } // JDEBUG needs to always be defined if (!defined('JDEBUG')) { define('JDEBUG', $verboseOutput ? 1 : 0); } /** @var Statistics $model */ $model = $container->factory->model('Statistics')->tmpInstance(); $result = $model->notifyFailed(); echo implode("\n", $result['message']); exit(); } } // Instantiate and run the application FOFApplicationCLI::getInstance('AkeebaBackupCheckfailed')->execute(); sessionMetadataGc.php000064400000002612152160445070010660 0ustar00<?php /** * @package Joomla.Cli * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * This is a CRON script to delete expired optional session metadata which should be called from the command-line, not the * web. For example something like: * /usr/bin/php /path/to/site/cli/sessionMetadataGc.php */ // Initialize Joomla framework const _JEXEC = 1; // Load system defines if (file_exists(dirname(__DIR__) . '/defines.php')) { require_once dirname(__DIR__) . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } // Get the framework. require_once JPATH_LIBRARIES . '/import.legacy.php'; // Bootstrap the CMS libraries. require_once JPATH_LIBRARIES . '/cms.php'; /** * Cron job to trash expired session metadata. * * @since 3.8.6 */ class SessionMetadataGc extends JApplicationCli { /** * Entry point for the script * * @return void * * @since 3.8.6 */ public function doExecute() { $metadataManager = new \Joomla\CMS\Session\MetadataManager($this, \Joomla\CMS\Factory::getDbo()); $sessionExpire = \Joomla\CMS\Factory::getSession()->getExpire(); $metadataManager->deletePriorTo(time() - $sessionExpire); } } JApplicationCli::getInstance('SessionMetadataGc')->execute(); sessionGc.php000064400000002233152160445070007216 0ustar00<?php /** * @package Joomla.Cli * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * This is a CRON script to delete expired session data which should be called from the command-line, not the * web. For example something like: * /usr/bin/php /path/to/site/cli/sessionGc.php */ // Initialize Joomla framework const _JEXEC = 1; // Load system defines if (file_exists(dirname(__DIR__) . '/defines.php')) { require_once dirname(__DIR__) . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } // Get the framework. require_once JPATH_LIBRARIES . '/import.legacy.php'; // Bootstrap the CMS libraries. require_once JPATH_LIBRARIES . '/cms.php'; /** * Cron job to trash expired session data. * * @since 3.8.6 */ class SessionGc extends JApplicationCli { /** * Entry point for the script * * @return void * * @since 3.8.6 */ public function doExecute() { JFactory::getSession()->gc(); } } JApplicationCli::getInstance('SessionGc')->execute(); index.html000064400000000037152160445070006545 0ustar00<!DOCTYPE html><title></title> admintools-filescanner.php000064400000012742152160445070011727 0ustar00<?php /** * @package admintools * @copyright Copyright (c)2010-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ // Define ourselves as a parent file use Akeeba\AdminTools\Site\Model\Scans; use FOF40\Container\Container; use Joomla\CMS\Factory; // Boilerplate -- START define('_JEXEC', 1); foreach ([__DIR__, getcwd()] as $curdir) { if (file_exists($curdir . '/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/defines.php'; break; } if (file_exists($curdir . '/../includes/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/../includes/defines.php'; break; } } defined('JPATH_LIBRARIES') || die ('This script must be placed in or run from the cli folder of your site.'); require_once JPATH_LIBRARIES . '/fof40/Cli/Application.php'; // Boilerplate -- END // Enable Akeeba Engine define('AKEEBAENGINE', 1); // Load the version file require_once JPATH_ADMINISTRATOR . '/components/com_admintools/version.php'; /** * Admin Tools File Alteration Monitor (PHP File Change Scanner) CLI application */ class AdminToolsFAM extends FOFApplicationCLI { /** * The main entry point of the application */ public function doExecute() { // Load the language files $paths = [JPATH_ADMINISTRATOR, JPATH_ROOT]; $jlang = Factory::getLanguage(); $jlang->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; $verboseMode = $this->input->get('quiet', -1, 'int') == -1; if ($verboseMode) { $year = gmdate('Y'); $header = <<<ENDBLOCK Admin Tools PHP File Scanner CLI $version ($date) Copyright (c) 2010-$year Akeeba Ltd / Nicholas K. Dionysopoulos ------------------------------------------------------------------------------- Admin Tools is Free Software, distributed under the terms of the GNU General Public License version 3 or, at your option, any later version. This program comes with ABSOLUTELY NO WARRANTY as per sections 15 & 16 of the license. See http://www.gnu.org/licenses/gpl-3.0.html for details. ------------------------------------------------------------------------------- You are using PHP $phpversion ($phpenvironment) $debugmessage ENDBLOCK; $this->out($header); } $start_scan = time(); if (function_exists('set_time_limit')) { if ($verboseMode) { $this->out("Unsetting time limit restrictions."); } @set_time_limit(0); } else { if ($verboseMode) { $this->out("Could not unset time limit restrictions; you may get a timeout error"); } } if ($verboseMode) { $this->out(''); } // Log some paths if ($verboseMode) { $this->out('Site paths determined by this script:'); $this->out(sprintf("JPATH_BASE : %s", JPATH_BASE)); $this->out(sprintf("JPATH_ADMINISTRATOR : %s", JPATH_ADMINISTRATOR)); $this->out(''); } $container = Container::getInstance('com_admintools'); /** @var Scans $model */ $model = $container->factory->model('Scans')->tmpInstance(); $model->removeIncompleteScans(); $this->out("Starting file scanning"); $this->out(""); $warnings_flag = false; $ret = $model->startScan('cli'); while ($ret['status'] && !$ret['done'] && empty($ret['error'])) { $time = date('Y-m-d H:i:s \G\M\TO (T)'); $memusage = $this->memUsage(); $warnings = "no warnings issued (good)"; $stepWarnings = false; if (!empty($ret['warnings'])) { $warnings_flag = true; $stepWarnings = true; $warnings = sprintf("POTENTIAL PROBLEMS DETECTED; %s warnings issued (see below).\n", count($ret['warnings'])); foreach ($ret['Warnings'] as $line) { $warnings .= "\t$line\n"; } } if (($verboseMode) || $stepWarnings) { $stepInfo = <<<ENDSTEPINFO Last Tick : $time Memory used : $memusage Warnings : $warnings ENDSTEPINFO; $this->out($stepInfo); } $ret = $model->stepScan(); } if (!empty($ret['error'])) { $this->out('An error has occurred:'); $this->out($ret['error']); $this->out(); $exitCode = 2; } else { if ($verboseMode) { $this->out(sprintf("File scanning job finished successfully after approximately %s", $this->timeago($start_scan, time(), '', false))); } $exitCode = 0; } if ($warnings_flag) { $exitCode = 1; if ($verboseMode) { $exitCode = 1; $this->out(''); $this->out(str_repeat('=', 79)); $this->out(''); $this->out('!!!!! W A R N I N G !!!!!'); $this->out(''); $this->out('Admin Tools issued warnings during the scanning process. You have to review them'); $this->out('and make sure that your scan has completed successfully.'); $this->out(''); $this->out(str_repeat('=', 79)); $this->out(''); } } if ($verboseMode) { $this->out(sprintf("Peak memory usage: %s", $this->peakMemUsage())); $this->out(); } $this->close($exitCode); } } FOFApplicationCLI::getInstance('AdminToolsFAM')->execute(); ats-mail-fetch.php000077500000003210152160445070010060 0ustar00<?php /** * @package ats * @copyright Copyright (c)2011-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ define('AKEEBA_ATS_CRON_CALLED_FROM_LEGACY', 1); require_once 'ats-cron.php'; /** * Akeeba Ticket System auto-reply CLI app */ class ATSAutoreplyApp extends ATSCron { /** * The main entry point of the application */ public function doExecute() { // Write the application header $this->out('Akeeba Ticket System -- Fetch email for the Reply By Email feature'); $this->out('Copyright 2011-' . gmdate('Y') . ' Akeeba Ltd'); $this->out(str_repeat('=', 79)); $this->out(); global $argv; $this->out(str_repeat('~', 79)); $this->out('ATTENTION!'); $this->out(str_repeat('~', 79)); $this->out(); $this->out('This script has been deprecated. Instead you need to use the ats-cron.php'); $this->out('script e.g.'); $this->out(); $this->out(PHP_BINARY . ' ats-cron.php --command=mailfetch'); $this->out(); $this->out('You will also need to enable the "Akeeba Ticket System - Fetch Email".'); $this->out(); $this->out('For a limited amount of time this script will call ats-cron.php for you'); $this->out('automatically, preserving compatibility with previous versions of Akeeba'); $this->out('Ticket System. Eventually it will be removed, meaning you need to make the'); $this->out('aforementioned change sooner rather than later.'); $this->out(str_repeat('~', 79)); $this->out(); $this->input->set('command', 'mailfetch'); $this->input->set('verbose', '1'); parent::doExecute(); } } FOFApplicationCLI::getInstance('ATSAutoreplyApp')->execute(); deletefiles.php000064400000004043152160445070007547 0ustar00<?php /** * @package Joomla.Cli * * @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * A command line cron job to attempt to remove files that should have been deleted at update. */ // We are a valid entry point. const _JEXEC = 1; // Load system defines if (file_exists(dirname(__DIR__) . '/defines.php')) { require_once dirname(__DIR__) . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } // Get the framework. require_once JPATH_LIBRARIES . '/import.legacy.php'; // Bootstrap the CMS libraries. require_once JPATH_LIBRARIES . '/cms.php'; // Configure error reporting to maximum for CLI output. error_reporting(E_ALL); ini_set('display_errors', 1); // Load Library language $lang = JFactory::getLanguage(); // Try the files_joomla file in the current language (without allowing the loading of the file in the default language) $lang->load('files_joomla.sys', JPATH_SITE, null, false, false) // Fallback to the files_joomla file in the default language || $lang->load('files_joomla.sys', JPATH_SITE, null, true); /** * A command line cron job to attempt to remove files that should have been deleted at update. * * @since 3.0 */ class DeletefilesCli extends JApplicationCli { /** * Entry point for CLI script * * @return void * * @since 3.0 */ public function doExecute() { // Import the dependencies jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); // We need the update script JLoader::register('JoomlaInstallerScript', JPATH_ADMINISTRATOR . '/components/com_admin/script.php'); // Instantiate the class $class = new JoomlaInstallerScript; // Run the delete method $class->deleteUnexistingFiles(); } } // Instantiate the application object, passing the class name to JCli::getInstance // and use chaining to execute the application. JApplicationCli::getInstance('DeletefilesCli')->execute(); akeeba-altbackup.php000077500000032711152160445070010446 0ustar00<?php /** * @package akeebabackup * @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ use Akeeba\Engine\Platform; // Enable and include Akeeba Engine define('AKEEBAENGINE', 1); // Setup and import the base CLI script $minphp = '7.2.0'; // Boilerplate -- START define('_JEXEC', 1); foreach ([__DIR__, getcwd()] as $curdir) { if (file_exists($curdir . '/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/defines.php'; break; } if (file_exists($curdir . '/../includes/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/../includes/defines.php'; break; } } defined('JPATH_LIBRARIES') || die ('This script must be placed in or run from the cli folder of your site.'); require_once JPATH_LIBRARIES . '/fof40/Cli/Application.php'; // Boilerplate -- END // Load the version file require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/version.php'; // Set up the cacert.pem location $caCertPath = class_exists('\\Composer\\CaBundle\\CaBundle') ? \Composer\CaBundle\CaBundle::getBundledCaBundlePath() : JPATH_LIBRARIES . '/src/Http/Transport/cacert.pem'; define('AKEEBA_CACERT_PEM', $caCertPath); /** * Akeeba Backup CLI application */ class AkeebaBackupAltCLI extends FOFApplicationCLI { /** * When making HTTPS connections, should we verify the certificate validity and that the hostname matches the one * in the certificate? Turned on by default. You can disable with the --no-verify CLI option. * * @var bool */ private $verifySSL = true; public function doExecute() { // Has the user set the --no-verify option? $noVerifyValue = $this->input->get('no-verify', 999); $this->verifySSL = $noVerifyValue != 999; // Get the backup profile and description $profile = $this->input->get('profile', 1, 'int'); if ($profile <= 0) { $profile = 1; } $version = AKEEBA_VERSION; $date = AKEEBA_DATE; $quietMode = $this->input->get('quiet', -1, 'int'); if ($quietMode == -1) { $year = gmdate('Y'); echo <<<ENDBLOCK Akeeba Backup Alternate CRON Helper Script version $version ($date) Copyright (c) 2006-$year Akeeba Ltd / Nicholas K. Dionysopoulos ------------------------------------------------------------------------------- Akeeba Backup is Free Software, distributed under the terms of the GNU General Public License version 3 or, at your option, any later version. This program comes with ABSOLUTELY NO WARRANTY as per sections 15 & 16 of the license. See http://www.gnu.org/licenses/gpl-3.0.html for details. ------------------------------------------------------------------------------- ENDBLOCK; } if (function_exists('set_time_limit')) { if ($quietMode == -1) { echo "Unsetting time limit restrictions.\n"; } @set_time_limit(0); } else { if ($quietMode == -1) { echo "Could not unset time limit restrictions; you may get a timeout error\n"; } } if ($quietMode == -1) { echo "\n"; } // Log some paths if ($quietMode == -1) { echo "Site paths determined by this script:\n"; echo "JPATH_BASE : " . JPATH_BASE . "\n"; echo "JPATH_ADMINISTRATOR : " . JPATH_ADMINISTRATOR . "\n\n"; } if (class_exists('Joomla\CMS\Component\ComponentHelper') && \Joomla\CMS\Component\ComponentHelper::isEnabled('com_akeebabackup')) { echo "ERROR!\n"; echo "Please finish upgrading to Akeeba Backup 9 and uninstall Akeeba Backup 8\n"; echo "per the instructions shown on your site's backend, Components, Akeeba Backup\n"; echo "\n"; echo "This script will refuse to continue.\n"; die("\n"); } // Load the engine $factoryPath = JPATH_ADMINISTRATOR . '/components/com_akeeba/BackupEngine/Factory.php'; define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_akeeba'); if (!file_exists($factoryPath)) { echo "ERROR!\n"; echo "Could not load the backup engine; file does not exist. Technical information:\n"; echo "Path to " . basename(__FILE__) . ": " . __DIR__ . "\n"; echo "Path to factory file: $factoryPath\n"; die("\n"); } else { try { require_once $factoryPath; } catch (Exception $e) { echo "ERROR!\n"; echo "Backup engine returned an error. Technical information:\n"; echo "Error message:\n\n"; echo $e->getMessage() . "\n\n"; echo "Path to " . basename(__FILE__) . ":" . __DIR__ . "\n"; echo "Path to factory file: $factoryPath\n"; die("\n"); } } $startup_check = true; // Assign the correct platform Platform::addPlatform('joomla3x', JPATH_COMPONENT_ADMINISTRATOR . '/BackupPlatform/Joomla3x'); // Get the live site's URL $url = Platform::getInstance()->get_platform_configuration_option('siteurl', ''); if (empty($url)) { echo <<<ENDTEXT ERROR: This script could not detect your live site's URL. Please visit Akeeba Backup's Control Panel page at least once before running this script, so that this information can be stored for use by this script. ENDTEXT; $startup_check = false; } // Get the front-end backup settings $frontend_enabled = Platform::getInstance()->get_platform_configuration_option('akeebabackup', 'legacyapi_enabled'); $secret = Platform::getInstance()->get_platform_configuration_option('frontend_secret_word', ''); if (!$frontend_enabled) { echo <<<ENDTEXT ERROR: Your Akeeba Backup installation's front-end backup feature is currently disabled. Please log in to your site's back-end as a Super User, go to Akeeba Backup's Control Panel, click on the Options icon in the top right corner and enable the front-end backup feature. Do not forget to also set a Secret Word! ENDTEXT; $startup_check = false; } elseif (empty($secret)) { echo <<<ENDTEXT ERROR: You have enabled the front-end backup feature, but you forgot to set a secret word. Without a valid secret word this script can not continue. Please log in to your site's back-end as a Super Administrator, go to Akeeba Backup's Control Panel, click on the Options icon in the top right corner set a Secret Word. ENDTEXT; $startup_check = false; } // Detect cURL or fopen URL $method = null; if (function_exists('curl_init')) { $method = 'curl'; } elseif (function_exists('fsockopen')) { $method = 'fsockopen'; } if (empty($method)) { if (function_exists('ini_get')) { if (ini_get('allow_url_fopen')) { $method = 'fopen'; } } } $overridemethod = $this->input->get('method', '', 'cmd'); if (!empty($overridemethod)) { $method = $overridemethod; } if (empty($method)) { echo <<<ENDTEXT ERROR: Could not find any supported method for running the front-end backup feature of Akeeba Backup. Please check with your host that at least one of the following features are supported in your PHP configuration: 1. The cURL extension 2. The fsockopen() function 3. The fopen() URL wrappers, i.e. allow_url_fopen is enabled If neither method is available you will not be able to backup your site using this CRON helper script. ENDTEXT; $startup_check = false; } if (!$startup_check) { echo "\n\nBACKUP ABORTED DUE TO CONFIGURATION ERRORS\n\n"; $this->close(255); } echo <<<ENDBLOCK Starting a new backup with the following parameters: Profile ID : $profile Backup Method : $method ENDBLOCK; // Perform the backup $url = rtrim($url, '/'); $secret = urlencode($secret); $url .= "/index.php?option=com_akeeba&view=Backup&key={$secret}&noredirect=1&profile=$profile"; $prototypeURL = ''; $inLoop = true; $step = 0; $timestamp = date('Y-m-d H:i:s'); echo "[{$timestamp}] Beginning backing up\n"; while ($inLoop) { $timestamp = date('Y-m-d H:i:s'); $result = $this->fetchURL($url, $method); //echo "[{$timestamp}] Got $result\n"; if (empty($result) || ($result === false)) { echo "[{$timestamp}] No message received\n"; echo <<<ENDTEXT ERROR: Your backup attempt has timed out, or a fatal PHP error has occurred. Please check the backup log and your server's error log for more information. Backup failed. ENDTEXT; $this->close(100); } elseif (strpos($result, '301 More work required') !== false) { // Extract the backup ID $backupId = null; $startPos = strpos($result, 'BACKUPID ###'); $endPos = false; if ($startPos !== false) { $endPos = strpos($result, '###', $startPos + 11); } if ($endPos !== false) { $backupId = substr($result, $startPos + 12, $endPos - $startPos - 12); } // Construct the new URL and access it if ($step == 0) { $prototypeURL = $url; } $step++; $url = $prototypeURL . '&task=step&step=' . $step; if (!is_null($backupId)) { $url .= '&backupid=' . urlencode($backupId); } echo "[{$timestamp}] Backup progress signal received\n"; } elseif (strpos($result, '200 OK') !== false) { echo "[{$timestamp}] Backup finalization message received\n"; echo <<<ENDTEXT Your backup has finished successfully. Please review your backup log file for any warning messages. If you see any such messages, please make sure that your backup is working properly by trying to restore it on a local server. ENDTEXT; $this->close(0); } elseif (strpos($result, '500 ERROR -- ') !== false) { // Backup error echo "[{$timestamp}] Error signal received\n"; echo <<<ENDTEXT ERROR: A backup error has occurred. The server's response was: $result Backup failed. ENDTEXT; $this->close(2); } elseif (strpos($result, '403 ') !== false) { // This should never happen: invalid authentication or front-end backup disabled echo "[{$timestamp}] Connection denied (403) message received\n"; echo <<<ENDTEXT ERROR: The server denied the connection. Please make sure that the front-end backup feature is enabled and a valid secret word is in place. Server response: $result Backup failed. ENDTEXT; $this->close(103); } else { // Unknown result?! echo "[{$timestamp}] Could not parse the server response.\n"; echo <<<ENDTEXT ERROR: We could not understand the server's response. Most likely a backup error has occurred. The server's response was: $result If you do not see "200 OK" at the end of this output, the backup has failed. ENDTEXT; $this->close(1); } } } /** * Fetches a remote URL using curl, fsockopen or fopen * * @param string $url The remote URL to fetch * @param string $method The method to use: curl, fsockopen or fopen (optional) * * @return string The contents of the URL which was fetched */ private function fetchURL($url, $method = 'curl') { switch ($method) { case 'curl': $caCertPath = class_exists('\\Composer\\CaBundle\\CaBundle') ? \Composer\CaBundle\CaBundle::getBundledCaBundlePath() : JPATH_LIBRARIES . '/src/Http/Transport/cacert.pem'; $ch = curl_init($url); if (file_exists($caCertPath)) { @curl_setopt($ch, CURLOPT_CAINFO, $caCertPath); } @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); @curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); @curl_setopt($ch, CURLOPT_HEADER, false); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verifySSL); @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $this->verifySSL ? 2 : 0); @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 180); @curl_setopt($ch, CURLOPT_TIMEOUT, 180); $result = curl_exec($ch); curl_close($ch); return $result; break; case 'fsockopen': $pos = strpos($url, '://'); $protocol = strtolower(substr($url, 0, $pos)); $req = substr($url, $pos + 3); $pos = strpos($req, '/'); if ($pos === false) { $pos = strlen($req); } $host = substr($req, 0, $pos); if (strpos($host, ':') !== false) { [$host, $port] = explode(':', $host); } else { $host = $host; $port = ($protocol == 'https') ? 443 : 80; } $uri = substr($req, $pos); if ($uri == '') { $uri = '/'; } $crlf = "\r\n"; $req = 'GET ' . $uri . ' HTTP/1.0' . $crlf . 'Host: ' . $host . $crlf . $crlf; $fp = fsockopen(($protocol == 'https' ? 'ssl://' : '') . $host, $port); fwrite($fp, $req); $response = ''; while (is_resource($fp) && $fp && !feof($fp)) { $response .= fread($fp, 1024); } fclose($fp); // split header and body $pos = strpos($response, $crlf . $crlf); if ($pos === false) { return ($response); } $header = substr($response, 0, $pos); $body = substr($response, $pos + 2 * strlen($crlf)); // parse headers $headers = []; $lines = explode($crlf, $header); foreach ($lines as $line) { if (($pos = strpos($line, ':')) !== false) { $headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos + 1)); } } //redirection? if (isset($headers['location'])) { return $this->fetchURL($headers['location'], $method); } else { return ($body); } break; case 'fopen': $opts = [ 'http' => [ 'method' => "GET", 'header' => "Accept-language: en\r\n", ], ]; $context = stream_context_create($opts); $result = @file_get_contents($url, false, $context); break; } return $result; } } // Instantiate and run the application FOFApplicationCLI::getInstance('AkeebaBackupAltCLI')->execute(); akeeba-altcheck-failed.php000077500000026033152160445070011500 0ustar00<?php /** * @package akeebabackup * @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ use Akeeba\Engine\Platform; // Enable and include Akeeba Engine define('AKEEBAENGINE', 1); // Setup and import the base CLI script $minphp = '7.2.0'; // Boilerplate -- START define('_JEXEC', 1); foreach ([__DIR__, getcwd()] as $curdir) { if (file_exists($curdir . '/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/defines.php'; break; } if (file_exists($curdir . '/../includes/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/../includes/defines.php'; break; } } defined('JPATH_LIBRARIES') || die ('This script must be placed in or run from the cli folder of your site.'); require_once JPATH_LIBRARIES . '/fof40/Cli/Application.php'; // Boilerplate -- END // Load the version file require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/version.php'; // Set up the cacert.pem location $caCertPath = class_exists('\\Composer\\CaBundle\\CaBundle') ? \Composer\CaBundle\CaBundle::getBundledCaBundlePath() : JPATH_LIBRARIES . '/src/Http/Transport/cacert.pem'; define('AKEEBA_CACERT_PEM', $caCertPath); /** * Akeeba Backup alternative check failed application */ class AkeebaBackupAltCheckfailed extends FOFApplicationCLI { public function doExecute() { $version = AKEEBA_VERSION; $date = AKEEBA_DATE; if ($this->input->get('quiet', -1, 'int') == -1) { $year = gmdate('Y'); echo <<<ENDBLOCK Akeeba Backup Alternate CRON Helper Script check for failures version $version ($date) Copyright (c) 2006-$year Akeeba Ltd / Nicholas K. Dionysopoulos ------------------------------------------------------------------------------- Akeeba Backup is Free Software, distributed under the terms of the GNU General Public License version 3 or, at your option, any later version. This program comes with ABSOLUTELY NO WARRANTY as per sections 15 & 16 of the license. See http://www.gnu.org/licenses/gpl-3.0.html for details. ------------------------------------------------------------------------------- ENDBLOCK; } // Log some paths if ($this->input->get('quiet', -1, 'int') == -1) { echo "Site paths determined by this script:\n"; echo "JPATH_BASE : " . JPATH_BASE . "\n"; echo "JPATH_ADMINISTRATOR : " . JPATH_ADMINISTRATOR . "\n\n"; } if (class_exists('Joomla\CMS\Component\ComponentHelper') && \Joomla\CMS\Component\ComponentHelper::isEnabled('com_akeebabackup')) { echo "ERROR!\n"; echo "Please finish upgrading to Akeeba Backup 9 and uninstall Akeeba Backup 8\n"; echo "per the instructions shown on your site's backend, Components, Akeeba Backup\n"; echo "\n"; echo "This script will refuse to continue.\n"; die("\n"); } // Load the engine $factoryPath = JPATH_ADMINISTRATOR . '/components/com_akeeba/BackupEngine/Factory.php'; define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_akeeba'); if (!file_exists($factoryPath)) { echo "ERROR!\n"; echo "Could not load the backup engine; file does not exist. Technical information:\n"; echo "Path to " . basename(__FILE__) . ": " . __DIR__ . "\n"; echo "Path to factory file: $factoryPath\n"; die("\n"); } else { try { require_once $factoryPath; } catch (Exception $e) { echo "ERROR!\n"; echo "Backup engine returned an error. Technical information:\n"; echo "Error message:\n\n"; echo $e->getMessage() . "\n\n"; echo "Path to " . basename(__FILE__) . ":" . __DIR__ . "\n"; echo "Path to factory file: $factoryPath\n"; die("\n"); } } $startup_check = true; // Assign the correct platform Platform::addPlatform('joomla3x', JPATH_COMPONENT_ADMINISTRATOR . '/BackupPlatform/Joomla3x'); // Get the live site's URL $url = Platform::getInstance()->get_platform_configuration_option('siteurl', ''); if (empty($url)) { echo <<<ENDTEXT ERROR: This script could not detect your live site's URL. Please visit Akeeba Backup's Control Panel page at least once before running this script, so that this information can be stored for use by this script. ENDTEXT; $startup_check = false; } // Get the front-end backup settings $frontend_enabled = Platform::getInstance()->get_platform_configuration_option('akeebabackup', 'legacyapi_enabled'); $secret = Platform::getInstance()->get_platform_configuration_option('frontend_secret_word', ''); if (!$frontend_enabled) { echo <<<ENDTEXT ERROR: Your Akeeba Backup installation's front-end check for failures feature is currently disabled. Please log in to your site's back-end as a Super Administrator, go to Akeeba Backup's Control Panel, click on the Options icon in the top right corner and enable the front-end backup feature. Do not forget to also set a Secret Word! ENDTEXT; $startup_check = false; } elseif (empty($secret)) { echo <<<ENDTEXT ERROR: You have enabled the front-end check for failure feature, but you forgot to set a secret word. Without a valid secret word this script can not continue. Please log in to your site's back-end as a Super Administrator, go to Akeeba Backup's Control Panel, click on the Options icon in the top right corner set a Secret Word. ENDTEXT; $startup_check = false; } // Detect cURL or fopen URL $method = null; if (function_exists('curl_init')) { $method = 'curl'; } elseif (function_exists('fsockopen')) { $method = 'fsockopen'; } if (empty($method)) { if (function_exists('ini_get')) { if (ini_get('allow_url_fopen')) { $method = 'fopen'; } } } $overridemethod = $this->input->get('method', '', 'cmd'); if (!empty($overridemethod)) { $method = $overridemethod; } if (empty($method)) { echo <<<ENDTEXT ERROR: Could not find any supported method for running the front-end backup feature of Akeeba Backup. Please check with your host that at least one of the following features are supported in your PHP configuration: 1. The cURL extension 2. The fsockopen() function 3. The fopen() URL wrappers, i.e. allow_url_fopen is enabled If neither method is available you will not be able to backup your site using this CRON helper script. ENDTEXT; $startup_check = false; } if (!$startup_check) { echo "\n\nBACKUP FAILURE CHECK ABORTED DUE TO CONFIGURATION ERRORS\n\n"; $this->close(255); } // Perform the backup $url = rtrim($url, '/'); $secret = urlencode($secret); $url .= "/index.php?option=com_akeeba&view=check&key={$secret}"; $timestamp = date('Y-m-d H:i:s'); $result = $this->fetchURL($url, $method); if (empty($result) || ($result === false)) { echo "[{$timestamp}] No message received\n"; echo <<<ENDTEXT ERROR: Your check for failures attempt has timed out, or a fatal PHP error has occurred. ENDTEXT; } elseif (strpos($result, '200 ') !== false) { echo "[{$timestamp}] Checks finalization message received\n"; echo <<<ENDTEXT Checks are finished successfully. ENDTEXT; } elseif (strpos($result, '500 ') !== false) { // Backup error echo "[{$timestamp}] Error signal received\n"; echo <<<ENDTEXT ERROR: An error has occurred. The server's response was: $result Backup failed. ENDTEXT; } elseif (strpos($result, '403 ') !== false) { // This should never happen: invalid authentication or front-end backup disabled echo "[{$timestamp}] Connection denied (403) message received\n"; echo <<<ENDTEXT ERROR: The server denied the connection. Please make sure that the front-end backup feature is enabled and a valid secret word is in place. Server response: $result Backup failed. ENDTEXT; } else { // Unknown result?! echo "[{$timestamp}] Could not parse the server response.\n"; echo <<<ENDTEXT ERROR: We could not understand the server's response. Most likely an error has occurred. The server's response was: $result If you do not see "200 OK" at the end of this output, checks failed. ENDTEXT; } } /** * Fetches a remote URL using curl, fsockopen or fopen * * @param string $url The remote URL to fetch * @param string $method The method to use: curl, fsockopen or fopen (optional) * * @return string The contents of the URL which was fetched */ private function fetchURL($url, $method = 'curl') { switch ($method) { case 'curl': $ch = curl_init($url); $caCertPath = class_exists('\\Composer\\CaBundle\\CaBundle') ? \Composer\CaBundle\CaBundle::getBundledCaBundlePath() : JPATH_LIBRARIES . '/src/Http/Transport/cacert.pem'; if (file_exists($caCertPath)) { @curl_setopt($ch, CURLOPT_CAINFO, $caCertPath); } @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); @curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); @curl_setopt($ch, CURLOPT_HEADER, false); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 180); @curl_setopt($ch, CURLOPT_TIMEOUT, 180); $result = curl_exec($ch); curl_close($ch); return $result; break; case 'fsockopen': $pos = strpos($url, '://'); $protocol = strtolower(substr($url, 0, $pos)); $req = substr($url, $pos + 3); $pos = strpos($req, '/'); if ($pos === false) { $pos = strlen($req); } $host = substr($req, 0, $pos); if (strpos($host, ':') !== false) { [$host, $port] = explode(':', $host); } else { $host = $host; $port = ($protocol == 'https') ? 443 : 80; } $uri = substr($req, $pos); if ($uri == '') { $uri = '/'; } $crlf = "\r\n"; $req = 'GET ' . $uri . ' HTTP/1.0' . $crlf . 'Host: ' . $host . $crlf . $crlf; $fp = fsockopen(($protocol == 'https' ? 'ssl://' : '') . $host, $port); fwrite($fp, $req); $response = ''; while (is_resource($fp) && $fp && !feof($fp)) { $response .= fread($fp, 1024); } fclose($fp); // split header and body $pos = strpos($response, $crlf . $crlf); if ($pos === false) { return ($response); } $header = substr($response, 0, $pos); $body = substr($response, $pos + 2 * strlen($crlf)); // parse headers $headers = []; $lines = explode($crlf, $header); foreach ($lines as $line) { if (($pos = strpos($line, ':')) !== false) { $headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos + 1)); } } //redirection? if (isset($headers['location'])) { return $this->fetchURL($headers['location'], $method); } else { return ($body); } break; case 'fopen': $opts = [ 'http' => [ 'method' => "GET", 'header' => "Accept-language: en\r\n", ], ]; $context = stream_context_create($opts); $result = @file_get_contents($url, false, $context); break; } return $result; } } // Instantiate and run the application FOFApplicationCLI::getInstance('AkeebaBackupAltCheckfailed')->execute(); ats-cron.php000077500000020651152160445070007020 0ustar00<?php /** * @package ats * @copyright Copyright (c)2011-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ use Akeeba\TicketSystem\Admin\Helper\Debug; use Akeeba\TicketSystem\Site\Model\Cron; use Akeeba\TicketSystem\Site\Model\Exception\CronCommandMissing; use Akeeba\TicketSystem\Site\Model\Exception\CronCommandNotFound; use FOF40\Container\Container; use Joomla\CMS\Log\Log; use Joomla\CMS\Menu\AbstractMenu; use Joomla\CMS\Router\Router; use Joomla\CMS\Uri\Uri; // Boilerplate -- START define('_JEXEC', 1); foreach ([__DIR__, getcwd()] as $curdir) { if (file_exists($curdir . '/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/defines.php'; break; } if (file_exists($curdir . '/../includes/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/../includes/defines.php'; break; } } defined('JPATH_LIBRARIES') || die ('This script must be placed in or run from the cli folder of your site.'); require_once JPATH_LIBRARIES . '/fof40/Cli/Application.php'; // Boilerplate -- END class ATSCron extends FOFApplicationCLI { /** * Returns the application Router object. Necessary for fetching emails. * * @param string $name The name of the application. * @param array $options An optional associative array of configuration settings. * * @return Router|null A JRouter object * @since 3.2.0 */ public function getRouter($name = null, array $options = []) { try { return Router::getInstance('site', $options); } catch (Exception $e) { return null; } } public function getMenu($name = null, $options = []) { return AbstractMenu::getInstance($name, $options); } /** * Something strange happened and the Factory wants to enqueue a system message. Let's log it for further inspection * * @param $msg * @param $type */ public function enqueueMessage($msg, $type) { parent::enqueueMessage($msg, $type); Log::add($msg, Log::NOTICE, 'ats.cron'); } /** * The main entry point of the application * * @return void * @since 3.2.0 */ public function doExecute() { $this->out('Akeeba Ticket System -- CRON Script'); $this->out('Copyright 2011-' . gmdate('Y') . ' Akeeba Ltd'); $this->out(str_repeat('=', 79)); // Load FOF if (!defined('FOF40_INCLUDED') && !@include_once(JPATH_LIBRARIES . '/fof40/include.php')) { die('This extension requires FOF 4.'); } // Load version defines $path = JPATH_ADMINISTRATOR . '/components/com_ats/version.php'; @include_once $path; if (!defined('ATS_PRO')) { define('ATS_PRO', 0); } if (!defined('ATS_VERSION')) { define('ATS_VERSION', 'dev'); } if (!defined('ATS_DATE')) { define('ATS_DATE', date('Y-m-d')); } // Work around some misconfigured servers which print out notices if (function_exists('error_reporting')) { $oldLevel = error_reporting(0); } $container = Container::getInstance('com_ats'); if (function_exists('error_reporting')) { error_reporting($oldLevel); } // Initializes the CLI session handler. Prevents Joomla from crashing e.g. when fetching the current user. $container->session->get('foobar'); // Initialize routing from the CLI $container = Container::getInstance('com_ats'); $siteURL = $container->params->get('siteurl', 'http://www.example.com'); $this->initCliRouting($siteURL); $debug = $this->input->getBool('debug', Debug::getJoomlaDebug()); if ($debug) { $this->set('debug', 1); } if (!defined('JDEBUG')) { define('JDEBUG', $debug ? 1 : 0); } $verbose = $this->input->getBool('verbose', $debug); if ($verbose) { Debug::registerCLIOutputLogger('ats.cron'); Debug::registerCLIOutputLogger('ats.emails'); } // Get the command to execute $command = $this->input->getCmd('command'); // Perform more rigorous filtering of the command name $command = (string) preg_replace('/[^A-Z0-9_]/i', '', $command); $command = strtolower($command); if ($verbose) { $this->out(sprintf( 'Current memory usage : %s', $this->memUsage() )); $this->out(); } if (!empty($command) && !$verbose) { $this->out(sprintf('Executing “%s” CRON task.', $command)); $this->out('Tip: Use the --verbose command line switch to follow its progress.'); } $startTime = microtime(true); // Run the command /** @var Cron $model */ $model = $container->factory->model('Cron')->tmpInstance(); $model->log('Starting the CRON job from CLI'); // Allow plugins to load under CLI $container->platform->setAllowPluginsInCli(true); $model->log('Executing the command'); try { // No time limit for CLI CRON jobs $success = $model->run($command, 0); $model->log('Exit: CRON execution finished'); } catch (CronCommandMissing $e) { $model->log('There was no command specified in the command line', Log::ERROR); $model->log('Exit: no command'); $this->out('You did not specify a command in the command line.'); $this->out('Try adding --command=CRONTaskName where CRONTaskName is the name of the CRON task you want to execute'); $this->close(1); // Technically unnecessary but helps with static code analysis :) return; } catch (CronCommandNotFound $e) { $model->log(sprintf('The requested command, “%s”, is not implemented', $command), Log::ERROR); $model->log('Exit: unknown command'); $this->out(sprintf('The requested command, “%s”, is not implemented', $command)); $this->out('Did you forget to enable a plugin?'); $this->close(2); // Technically unnecessary but helps with static code analysis :) return; } catch (Exception $e) { $model->log(sprintf('An error occurred executing command “%s”', $command), Log::ERROR); $model->log($e->getMessage()); $model->log($e->getFile() . '::' . $e->getLine()); if (!$verbose) { $this->out(sprintf('An error occurred executing command “%s”', $command)); $this->out($e->getMessage()); $this->out($e->getFile() . '::' . $e->getLine()); } foreach (explode("\n", $e->getTraceAsString()) as $line) { $model->log($line); if (!$verbose) { $this->out($line); } } $model->log('Exit: error executing command'); $this->close(255); // Technically unnecessary but helps with static code analysis :) return; } $this->out(); $this->out(sprintf( '%s -- CRON job finished after approximately %s', $success ? 'SUCCESS' : 'FAIL', $this->timeAgo($startTime, time(), '', false) )); if ($verbose) { $this->out(); $this->out(sprintf( 'Current memory usage : %s', $this->memUsage() )); $this->out(sprintf( 'Peak memory usage : %s', $this->peakMemUsage() )); } } /** * Check the client interface by name. * * @param string $identifier String identifier for the application interface * * @return boolean True if this application is of the given type client interface. * * @since 3.3.1 */ public function isClient($identifier) { return $identifier === 'cli'; } /** * Is admin interface? * * @return boolean True if this application is administrator. * * @since 3.3.1 */ public function isAdmin() { return $this->isClient('administrator'); } /** * Is site interface? * * @return boolean True if this application is site. * * @since 3.3.1 */ public function isSite() { return $this->isClient('site'); } protected function initCliRouting($siteURL) { // Set up the base site URL in JUri $uri = Uri::getInstance($siteURL); $_SERVER['HTTP_HOST'] = $uri->toString(['host', 'port']); $_SERVER['REQUEST_URI'] = $uri->getPath(); $refClass = new ReflectionClass(Uri::class); $refInstances = $refClass->getProperty('instances'); $refInstances->setAccessible(true); $instances = $refInstances->getValue(); $instances['SERVER'] = $uri; $refInstances->setValue($instances); $base = [ 'prefix' => $uri->toString(['scheme', 'host', 'port']), 'path' => rtrim($uri->toString(['path']), '/\\'), ]; $refBase = $refClass->getProperty('base'); $refBase->setAccessible(true); $refBase->setValue($base); // Set up the SEF mode in the router if (version_compare(JVERSION, '3.999.999', 'le')) { $this->getRouter()->setMode($this->get('sef', 0)); } } } if (!defined('AKEEBA_ATS_CRON_CALLED_FROM_LEGACY')) { FOFApplicationCLI::getInstance('ATSCron')->execute(); } ats-autoclose-tickets.php000077500000003246152160445070011522 0ustar00<?php /** * @package ats * @copyright Copyright (c)2011-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ define('AKEEBA_ATS_CRON_CALLED_FROM_LEGACY', 1); require_once 'ats-cron.php'; /** * Akeeba Ticket System auto-reply CLI app */ class ATSAutocloseApp extends ATSCron { /** * The main entry point of the application */ public function doExecute() { // Write the application header $this->out('Akeeba Ticket System -- Automatic ticket close script'); $this->out('Copyright 2011-' . gmdate('Y') . ' Akeeba Ltd'); $this->out(str_repeat('=', 79)); $this->out(); global $argv; $this->out(str_repeat('~', 79)); $this->out('ATTENTION!'); $this->out(str_repeat('~', 79)); $this->out(); $this->out('This script has been deprecated. Instead you need to use the ats-cron.php'); $this->out('script e.g.'); $this->out(); $this->out(PHP_BINARY . ' ats-cron.php --command=autoclose'); $this->out(); $this->out('You will also need to enable the "Akeeba Ticket System - Automatically'); $this->out('close old tickets" plugin.'); $this->out(); $this->out('For a limited amount of time this script will call ats-cron.php for you'); $this->out('automatically, preserving compatibility with previous versions of Akeeba'); $this->out('Ticket System. Eventually it will be removed, meaning you need to make the'); $this->out('aforementioned change sooner rather than later.'); $this->out(str_repeat('~', 79)); $this->out(); $this->input->set('command', 'autoclose'); $this->input->set('verbose', '1'); parent::doExecute(); } } FOFApplicationCLI::getInstance('ATSAutocloseApp')->execute();garbagecron.php000064400000002040152160445070007527 0ustar00<?php /** * @package Joomla.Cli * * @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * A command line cron job to trash expired cache data. */ // Initialize Joomla framework const _JEXEC = 1; // Load system defines if (file_exists(dirname(__DIR__) . '/defines.php')) { require_once dirname(__DIR__) . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } // Get the framework. require_once JPATH_LIBRARIES . '/import.legacy.php'; // Bootstrap the CMS libraries. require_once JPATH_LIBRARIES . '/cms.php'; /** * Cron job to trash expired cache data. * * @since 2.5 */ class GarbageCron extends JApplicationCli { /** * Entry point for the script * * @return void * * @since 2.5 */ public function doExecute() { $cache = JFactory::getCache(); $cache->gc(); } } JApplicationCli::getInstance('GarbageCron')->execute(); finder_indexer.php000064400000031515152160445070010253 0ustar00<?php /** * @package Joomla.Cli * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * Smart Search CLI. * * This is a command-line script to help with management of Smart Search. * * Called with no arguments: php finder_indexer.php * Performs an incremental update of the index using dynamic pausing. * * IMPORTANT NOTE: since Joomla version 3.9.12 the default behavior of this script has changed. * If called with no arguments, the `--pause` argument is silently applied, in order to avoid the possibility of * stressing the server too much and making a site (or multiple sites, if on a shared environment) unresponsive. * If a pause is unwanted, just apply `--pause=0` to the command * * Called with --purge php finder_indexer.php --purge * Purges and rebuilds the index (search filters are preserved). * * Called with --pause `php finder_indexer.php --pause` * or --pause=x or `php finder_indexer.php --pause=x` where x = seconds. * or --pause=division or `php finder_indexer.php --pause=division` The default divisor is 5. * If another divisor is required, it can be set with --divisor=y, where * y is the integer divisor * * This will pause for x seconds between batches, * in order to give the server some time to catch up * if --pause is called without an assignment, it defaults to dynamic pausing * using the division method with a divisor of 5 * (eg. 1 second pause for every 5 seconds of batch processing time) * * Called with --minproctime=x Will set the minimum processing time of batches for a pause to occur. Defaults to 1 * */ // We are a valid entry point. const _JEXEC = 1; // Load system defines if (file_exists(dirname(__DIR__) . '/defines.php')) { require_once dirname(__DIR__) . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_finder'); // Get the framework. require_once JPATH_LIBRARIES . '/import.legacy.php'; // Bootstrap the CMS libraries. require_once JPATH_LIBRARIES . '/cms.php'; // Import the configuration. require_once JPATH_CONFIGURATION . '/configuration.php'; // System configuration. $config = new JConfig; define('JDEBUG', $config->debug); // Configure error reporting to maximum for CLI output. error_reporting(E_ALL); ini_set('display_errors', 1); // Load Library language $lang = JFactory::getLanguage(); // Try the finder_cli file in the current language (without allowing the loading of the file in the default language) $lang->load('finder_cli', JPATH_SITE, null, false, false) // Fallback to the finder_cli file in the default language || $lang->load('finder_cli', JPATH_SITE, null, true); /** * A command line cron job to run the Smart Search indexer. * * @since 2.5 */ class FinderCli extends JApplicationCli { /** * Start time for the index process * * @var string * @since 2.5 */ private $time; /** * Start time for each batch * * @var string * @since 2.5 */ private $qtime; /** * Static filters information. * * @var array * @since 3.3 */ private $filters = array(); /** * Pausing type or defined pause time in seconds. * One pausing type is implemented: 'division' for dynamic calculation of pauses * * Defaults to 'division' * * @var string|integer * @since 3.9.12 */ private $pause = 'division'; /** * The divisor of the division: batch-processing time / divisor. * This is used together with --pause=division in order to pause dynamically * in relation to the processing time * Defaults to 5 * * @var integer * @since 3.9.12 */ private $divisor = 5; /** * Minimum processing time in seconds, in order to apply a pause * Defaults to 1 * * @var integer * @since 3.9.12 */ private $minimumBatchProcessingTime = 1; /** * Entry point for Smart Search CLI script * * @return void * * @since 2.5 */ public function doExecute() { // Print a blank line. $this->out(JText::_('FINDER_CLI')); $this->out('============================'); // Initialize the time value. $this->time = microtime(true); // Remove the script time limit. @set_time_limit(0); // Fool the system into thinking we are running as JSite with Smart Search as the active component. $_SERVER['HTTP_HOST'] = 'domain.com'; JFactory::getApplication('site'); $this->minimumBatchProcessingTime = $this->input->getInt('minproctime', 1); // Pause between batches to let the server catch a breath. The default, if not set by the user, is set in the class property `pause` $pauseArg = $this->input->get('pause', $this->pause, 'raw'); if ($pauseArg === 'division') { $this->divisor = $this->input->getInt('divisor', $this->divisor); } else { $this->pause = (int) $pauseArg; } // Purge before indexing if --purge on the command line. if ($this->input->getString('purge', false)) { // Taxonomy ids will change following a purge/index, so save filter information first. $this->getFilters(); // Purge the index. $this->purge(); // Run the indexer. $this->index(); // Restore the filters again. $this->putFilters(); } else { // Run the indexer. $this->index(); } // Total reporting. $this->out(JText::sprintf('FINDER_CLI_PROCESS_COMPLETE', round(microtime(true) - $this->time, 3)), true); $this->out(JText::sprintf('FINDER_CLI_PEAK_MEMORY_USAGE', number_format(memory_get_peak_usage(true)))); // Print a blank line at the end. $this->out(); } /** * Run the indexer. * * @return void * * @since 2.5 */ private function index() { JLoader::register('FinderIndexer', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/indexer.php'); // Disable caching. $config = JFactory::getConfig(); $config->set('caching', 0); $config->set('cache_handler', 'file'); // Reset the indexer state. FinderIndexer::resetState(); // Import the plugins. JPluginHelper::importPlugin('system'); JPluginHelper::importPlugin('finder'); // Starting Indexer. $this->out(JText::_('FINDER_CLI_STARTING_INDEXER'), true); // Trigger the onStartIndex event. JEventDispatcher::getInstance()->trigger('onStartIndex'); // Remove the script time limit. @set_time_limit(0); // Get the indexer state. $state = FinderIndexer::getState(); // Setting up plugins. $this->out(JText::_('FINDER_CLI_SETTING_UP_PLUGINS'), true); // Trigger the onBeforeIndex event. JEventDispatcher::getInstance()->trigger('onBeforeIndex'); // Startup reporting. $this->out(JText::sprintf('FINDER_CLI_SETUP_ITEMS', $state->totalItems, round(microtime(true) - $this->time, 3)), true); // Get the number of batches. $t = (int) $state->totalItems; $c = (int) ceil($t / $state->batchSize); $c = $c === 0 ? 1 : $c; try { // Process the batches. for ($i = 0; $i < $c; $i++) { // Set the batch start time. $this->qtime = microtime(true); // Reset the batch offset. $state->batchOffset = 0; // Trigger the onBuildIndex event. JEventDispatcher::getInstance()->trigger('onBuildIndex'); // Batch reporting. $this->out(JText::sprintf('FINDER_CLI_BATCH_COMPLETE', $i + 1, $processingTime = round(microtime(true) - $this->qtime, 3)), true); if ($this->pause !== 0) { // Pausing Section $skip = !($processingTime >= $this->minimumBatchProcessingTime); $pause = 0; if ($this->pause === 'division' && $this->divisor > 0) { if (!$skip) { $pause = round($processingTime / $this->divisor); } else { $pause = 1; } } elseif ($this->pause > 0) { $pause = $this->pause; } if ($pause > 0 && !$skip) { $this->out(JText::sprintf('FINDER_CLI_BATCH_PAUSING', $pause), true); sleep($pause); $this->out(JText::_('FINDER_CLI_BATCH_CONTINUING')); } if ($skip) { $this->out(JText::sprintf('FINDER_CLI_SKIPPING_PAUSE_LOW_BATCH_PROCESSING_TIME', $processingTime, $this->minimumBatchProcessingTime), true); } // End of Pausing Section } } } catch (Exception $e) { // Display the error $this->out($e->getMessage(), true); // Reset the indexer state. FinderIndexer::resetState(); // Close the app $this->close($e->getCode()); } // Reset the indexer state. FinderIndexer::resetState(); } /** * Purge the index. * * @return void * * @since 3.3 */ private function purge() { $this->out(JText::_('FINDER_CLI_INDEX_PURGE')); // Load the model. JModelLegacy::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/models', 'FinderModel'); $model = JModelLegacy::getInstance('Index', 'FinderModel'); // Attempt to purge the index. $return = $model->purge(); // If unsuccessful then abort. if (!$return) { $message = JText::_('FINDER_CLI_INDEX_PURGE_FAILED', $model->getError()); $this->out($message); exit(); } $this->out(JText::_('FINDER_CLI_INDEX_PURGE_SUCCESS')); } /** * Restore static filters. * * Using the saved filter information, update the filter records * with the new taxonomy ids. * * @return void * * @since 3.3 */ private function putFilters() { $this->out(JText::_('FINDER_CLI_RESTORE_FILTERS')); $db = JFactory::getDbo(); // Use the temporary filter information to update the filter taxonomy ids. foreach ($this->filters as $filter_id => $filter) { $tids = array(); foreach ($filter as $element) { // Look for the old taxonomy in the new taxonomy table. $query = $db->getQuery(true); $query ->select('t.id') ->from($db->qn('#__finder_taxonomy') . ' AS t') ->leftJoin($db->qn('#__finder_taxonomy') . ' AS p ON p.id = t.parent_id') ->where($db->qn('t.title') . ' = ' . $db->q($element['title'])) ->where($db->qn('p.title') . ' = ' . $db->q($element['parent'])); $taxonomy = $db->setQuery($query)->loadResult(); // If we found it then add it to the list. if ($taxonomy) { $tids[] = $taxonomy; } else { $this->out(JText::sprintf('FINDER_CLI_FILTER_RESTORE_WARNING', $element['parent'], $element['title'], $element['filter'])); } } // Construct a comma-separated string from the taxonomy ids. $taxonomyIds = empty($tids) ? '' : implode(',', $tids); // Update the filter with the new taxonomy ids. $query = $db->getQuery(true); $query ->update($db->qn('#__finder_filters')) ->set($db->qn('data') . ' = ' . $db->q($taxonomyIds)) ->where($db->qn('filter_id') . ' = ' . (int) $filter_id); $db->setQuery($query)->execute(); } $this->out(JText::sprintf('FINDER_CLI_RESTORE_FILTER_COMPLETED', count($this->filters))); } /** * Save static filters. * * Since a purge/index cycle will cause all the taxonomy ids to change, * the static filters need to be updated with the new taxonomy ids. * The static filter information is saved prior to the purge/index * so that it can later be used to update the filters with new ids. * * @return void * * @since 3.3 */ private function getFilters() { $this->out(JText::_('FINDER_CLI_SAVE_FILTERS')); // Get the taxonomy ids used by the filters. $db = JFactory::getDbo(); $query = $db->getQuery(true); $query ->select('filter_id, title, data') ->from($db->qn('#__finder_filters')); $filters = $db->setQuery($query)->loadObjectList(); // Get the name of each taxonomy and the name of its parent. foreach ($filters as $filter) { // Skip empty filters. if ($filter->data === '') { continue; } // Get taxonomy records. $query = $db->getQuery(true); $query ->select('t.title, p.title AS parent') ->from($db->qn('#__finder_taxonomy') . ' AS t') ->leftJoin($db->qn('#__finder_taxonomy') . ' AS p ON p.id = t.parent_id') ->where($db->qn('t.id') . ' IN (' . $filter->data . ')'); $taxonomies = $db->setQuery($query)->loadObjectList(); // Construct a temporary data structure to hold the filter information. foreach ($taxonomies as $taxonomy) { $this->filters[$filter->filter_id][] = array( 'filter' => $filter->title, 'title' => $taxonomy->title, 'parent' => $taxonomy->parent, ); } } $this->out(JText::sprintf('FINDER_CLI_SAVE_FILTER_COMPLETED', count($filters))); } } // Instantiate the application object, passing the class name to JCli::getInstance // and use chaining to execute the application. JApplicationCli::getInstance('FinderCli')->execute(); admintools-dbrepair.php000064400000011532152160445070011222 0ustar00<?php /** * @package admintools * @copyright Copyright (c)2010-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ // Boilerplate -- START use Joomla\CMS\Factory; define('_JEXEC', 1); foreach ([__DIR__, getcwd()] as $curdir) { if (file_exists($curdir . '/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/defines.php'; break; } if (file_exists($curdir . '/../includes/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/../includes/defines.php'; break; } } defined('JPATH_LIBRARIES') || die ('This script must be placed in or run from the cli folder of your site.'); require_once JPATH_LIBRARIES . '/fof40/Cli/Application.php'; // Boilerplate -- END // Load the version file require_once JPATH_ADMINISTRATOR . '/components/com_admintools/version.php'; class AdmintoolsDbrepair extends FOFApplicationCLI { public function flushAssets() { // This is an empty function since JInstall will try to flush the assets even if we're in CLI (!!!) return true; } public function doExecute() { // Load the language files $paths = array(JPATH_ADMINISTRATOR, JPATH_ROOT); $jlang = Factory::getLanguage(); $jlang->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 <<<ENDBLOCK Admin Tools DB Repair CLI $version ($date) Copyright (c) 2010-$year Akeeba Ltd / Nicholas K. Dionysopoulos ------------------------------------------------------------------------------- Admin Tools is Free Software, distributed under the terms of the GNU General Public License version 3 or, at your option, any later version. This program comes with ABSOLUTELY NO WARRANTY as per sections 15 & 16 of the license. See http://www.gnu.org/licenses/gpl-3.0.html for details. ------------------------------------------------------------------------------- You are using PHP $phpversion ($phpenvironment) $debugmessage ENDBLOCK; } if (version_compare(JVERSION, '3.999.999', 'gt')) { $this->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(); ats-auto-reply.php000077500000003211152160445070010151 0ustar00<?php /** * @package ats * @copyright Copyright (c)2011-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ define('AKEEBA_ATS_CRON_CALLED_FROM_LEGACY', 1); require_once 'ats-cron.php'; /** * Akeeba Ticket System auto-reply CLI app */ class ATSAutoreplyApp extends ATSCron { /** * The main entry point of the application */ public function doExecute() { $this->out('Akeeba Ticket System -- Autoreply script'); $this->out('Copyright 2011-' . gmdate('Y') . ' Akeeba Ltd'); $this->out(str_repeat('=', 79)); $this->out(); global $argv; $this->out(str_repeat('~', 79)); $this->out('ATTENTION!'); $this->out(str_repeat('~', 79)); $this->out(); $this->out('This script has been deprecated. Instead you need to use the ats-cron.php'); $this->out('script e.g.'); $this->out(); $this->out(PHP_BINARY . ' ats-cron.php --command=autoreply'); $this->out(); $this->out('You will also need to enable the "Akeeba Ticket System - Automatic Replies"'); $this->out('plugin and set its CRON option to Yes.'); $this->out(); $this->out('For a limited amount of time this script will call ats-cron.php for you'); $this->out('automatically, preserving compatibility with previous versions of Akeeba'); $this->out('Ticket System. Eventually it will be removed, meaning you need to make the'); $this->out('aforementioned change sooner rather than later.'); $this->out(str_repeat('~', 79)); $this->out(); $this->input->set('command', 'autoreply'); $this->input->set('verbose', '1'); parent::doExecute(); } } FOFApplicationCLI::getInstance('ATSAutoreplyApp')->execute(); ats-remove-attachments.php000077500000003247152160445070011667 0ustar00<?php /** * @package ats * @copyright Copyright (c)2011-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ define('AKEEBA_ATS_CRON_CALLED_FROM_LEGACY', 1); require_once 'ats-cron.php'; /** * Akeeba Ticket System auto-reply CLI app */ class ATSRemoveAttachmantsApp extends ATSCron { /** * The main entry point of the application */ public function doExecute() { $this->out('Akeeba Ticket System -- Automatic attachment removal script'); $this->out('Copyright 2011-' . gmdate('Y') . ' Akeeba Ltd'); $this->out(str_repeat('=', 79)); $this->out(); global $argv; $this->out(str_repeat('~', 79)); $this->out('ATTENTION!'); $this->out(str_repeat('~', 79)); $this->out(); $this->out('This script has been deprecated. Instead you need to use the ats-cron.php'); $this->out('script e.g.'); $this->out(); $this->out(PHP_BINARY . ' ats-cron.php --command=removeattachments'); $this->out(); $this->out('You will also need to enable the "Akeeba Ticket System - Remove Obsolete'); $this->out('Attachments" plugin.'); $this->out(); $this->out('For a limited amount of time this script will call ats-cron.php for you'); $this->out('automatically, preserving compatibility with previous versions of Akeeba'); $this->out('Ticket System. Eventually it will be removed, meaning you need to make the'); $this->out('aforementioned change sooner rather than later.'); $this->out(str_repeat('~', 79)); $this->out(); $this->input->set('command', 'removeattachments'); $this->input->set('verbose', '1'); parent::doExecute(); } } FOFApplicationCLI::getInstance('ATSRemoveAttachmantsApp')->execute(); akeeba-backup.php000077500000033230152160445070007742 0ustar00<?php /** * @package akeebabackup * @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ use Akeeba\Backup\Admin\Model\ConfigurationWizard; use Akeeba\Backup\Site\Model\Backup; use Akeeba\Engine\Factory; use Akeeba\Engine\Platform; use FOF40\Container\Container; use FOF40\Factory\Exception\ModelNotFound; // Enable and include Akeeba Engine define('AKEEBAENGINE', 1); // Setup and import the base CLI script $minphp = '7.2.0'; // Boilerplate -- START define('_JEXEC', 1); foreach ([__DIR__, getcwd()] as $curdir) { if (file_exists($curdir . '/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/defines.php'; break; } if (file_exists($curdir . '/../includes/defines.php')) { define('JPATH_BASE', realpath($curdir . '/..')); require_once $curdir . '/../includes/defines.php'; break; } } defined('JPATH_LIBRARIES') || die ('This script must be placed in or run from the cli folder of your site.'); require_once JPATH_LIBRARIES . '/fof40/Cli/Application.php'; // Boilerplate -- END // Load the version file require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/version.php'; // Set up the cacert.pem location $caCertPath = class_exists('\\Composer\\CaBundle\\CaBundle') ? \Composer\CaBundle\CaBundle::getBundledCaBundlePath() : JPATH_LIBRARIES . '/src/Http/Transport/cacert.pem'; define('AKEEBA_CACERT_PEM', $caCertPath); /** * Akeeba Backup CLI application */ class AkeebaBackupCLI extends FOFApplicationCLI { public function doExecute() { // Load the language files $paths = [JPATH_ADMINISTRATOR, JPATH_ROOT]; $jlang = JFactory::getLanguage(); $jlang->load('com_akeeba', $paths[0], 'en-GB', true); $jlang->load('com_akeeba', $paths[1], 'en-GB', true); $jlang->load('com_akeeba' . '.override', $paths[0], 'en-GB', true); $jlang->load('com_akeeba' . '.override', $paths[1], 'en-GB', true); /** @var Backup $model */ $container = Container::getInstance('com_akeeba'); $model = $container->factory->model('Backup')->tmpInstance(); $debugmessage = ''; if ($this->getOption('debug', -1, 'int') != -1) { if (!defined('AKEEBADEBUG')) { define('AKEEBADEBUG', 1); } if (function_exists('ini_set')) { ini_set('display_errors', 1); } if (function_exists('error_reporting')) { error_reporting(E_ALL); } $debugmessage = "*** DEBUG MODE ENABLED ***\n"; } $version = AKEEBA_VERSION; $date = AKEEBA_DATE; $start_backup = time(); $memusage = $this->memUsage(); $jVersion = JVERSION; $phpversion = PHP_VERSION; $phpenvironment = PHP_SAPI; $verboseMode = $this->getOption('quiet', -1, 'int') == -1; if ($verboseMode) { $year = gmdate('Y'); echo <<<ENDBLOCK Akeeba Backup CLI $version ($date) Copyright (c) 2006-$year Akeeba Ltd / Nicholas K. Dionysopoulos ------------------------------------------------------------------------------- Akeeba Backup is Free Software, distributed under the terms of the GNU General Public License version 3 or, at your option, any later version. This program comes with ABSOLUTELY NO WARRANTY as per sections 15 & 16 of the license. See http://www.gnu.org/licenses/gpl-3.0.html for details. ------------------------------------------------------------------------------- You are using Joomla! $jVersion on PHP $phpversion ($phpenvironment) $debugmessage ENDBLOCK; } // Log some paths if ($verboseMode) { echo "Site paths determined by this script:\n"; echo "JPATH_BASE : " . JPATH_BASE . "\n"; echo "JPATH_ADMINISTRATOR : " . JPATH_ADMINISTRATOR . "\n\n"; } if (class_exists('Joomla\CMS\Component\ComponentHelper') && \Joomla\CMS\Component\ComponentHelper::isEnabled('com_akeebabackup')) { echo "ERROR!\n"; echo "Please finish upgrading to Akeeba Backup 9 and uninstall Akeeba Backup 8\n"; echo "per the instructions shown on your site's backend, Components, Akeeba Backup\n"; echo "\n"; echo "This script will refuse to continue.\n"; die("\n"); } // Load the engine $factoryPath = JPATH_ADMINISTRATOR . '/components/com_akeeba/BackupEngine/Factory.php'; define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_akeeba'); define('AKEEBAROOT', JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba'); if (!file_exists($factoryPath)) { echo "ERROR!\n"; echo "Could not load the backup engine; file does not exist. Technical information:\n"; echo "Path to " . basename(__FILE__) . ": " . __DIR__ . "\n"; echo "Path to factory file: $factoryPath\n"; die("\n"); } else { try { require_once $factoryPath; } catch (Exception $e) { echo "ERROR!\n"; echo "Backup engine returned an error. Technical information:\n"; echo "Error message:\n\n"; echo $e->getMessage() . "\n\n"; echo "Path to " . basename(__FILE__) . ":" . __DIR__ . "\n"; echo "Path to factory file: $factoryPath\n"; die("\n"); } } // Assign the correct platform Platform::addPlatform('joomla3x', JPATH_COMPONENT_ADMINISTRATOR . '/BackupPlatform/Joomla3x'); // Get the backup profile $profile = $this->getOption('profile', 1, 'int'); if ($profile <= 0) { $profile = 1; } // Get a default description $description = $this->getOption('description', $model->getDefaultDescription() . ' (CLI)', 'string'); $overrides = $this->getOption('override', [], 'array'); if (!empty($overrides)) { $override_message = "\nConfiguration variables overriden in the command line:\n"; $override_message .= implode(', ', array_keys($overrides)); $override_message .= "\n"; } else { $override_message = ""; } if ($verboseMode) { echo <<< ENDBLOCK Starting a new backup with the following parameters: Profile ID $profile Description "$description" $override_message Current memory usage: $memusage ENDBLOCK; } // 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. if (function_exists('set_time_limit')) { if ($verboseMode) { echo "Unsetting time limit restrictions.\n\n"; } @set_time_limit(0); } elseif ($verboseMode) { echo "Could not unset time limit restrictions; you may get a timeout error\n\n"; } // Forced CLI mode settings define('AKEEBA_PROFILE', $profile); define('AKEEBA_BACKUP_ORIGIN', 'cli'); // Check is encrypted settings can be decrypted $this->checkSettingsDecryption($profile); // Autofix the output directory /** @var ConfigurationWizard $confWizModel */ $confWizModel = $container->factory->model('ConfigurationWizard')->tmpInstance(); $confWizModel->autofixDirectories(); // Rebase Off-site Folder Inclusion filters to use site path variables /** @var \Akeeba\Backup\Admin\Model\IncludeFolders $incFoldersModel */ try { $incFoldersModel = $container->factory->model('IncludeFolders')->tmpInstance(); $incFoldersModel->rebaseFiltersToSiteDirs(); } catch (ModelNotFound $e) { // Not a problem. This is expected to happen in the Core version. } // Dummy array so that the loop iterates once $array = [ 'HasRun' => 0, 'Error' => '', 'cli_firstrun' => 1, ]; $warnings_flag = false; $model->setState('tag', AKEEBA_BACKUP_ORIGIN); $model->setState('backupid', null); $model->setState('description', $description); while (($array['HasRun'] != 1) && (empty($array['Error']))) { if (isset($array['cli_firstrun'])) { $overrides = array_merge([ 'akeeba.tuning.min_exec_time' => 0, 'akeeba.tuning.nobreak.beforelargefile' => 1, 'akeeba.tuning.nobreak.afterlargefile' => 1, 'akeeba.tuning.nobreak.proactive' => 1, 'akeeba.tuning.nobreak.finalization' => 1, 'akeeba.tuning.settimelimit' => 0, 'akeeba.tuning.setmemlimit' => 1, 'akeeba.tuning.nobreak.domains' => 0, ], $overrides); } $array = isset($array['cli_firstrun']) ? $model->startBackup($overrides) : $model->stepBackup(); $time = date('Y-m-d H:i:s \G\M\TO (T)'); $memusage = $this->memUsage(); $warnings = "no warnings issued (good)"; $stepWarnings = false; if (!empty($array['Warnings'])) { $warnings_flag = true; $warnings = "POTENTIAL PROBLEMS DETECTED; " . count($array['Warnings']) . " warnings issued (see below).\n"; foreach ($array['Warnings'] as $line) { $warnings .= "\t$line\n"; } $stepWarnings = true; } $progress = sprintf('%u', array_key_exists('Progress', $array) ? $array['Progress'] : 0); if (($verboseMode) || $stepWarnings) { echo <<<ENDSTEPINFO Last Tick : $time Progress : $progress % Domain : {$array['Domain']} Step : {$array['Step']} Substep : {$array['Substep']} Memory used : $memusage Warnings : $warnings ENDSTEPINFO; } // Recycle the database connection to minimise problems with database timeouts $db = Factory::getDatabase(); $db->close(); $db->open(); // Reset the backup timer Factory::getTimer()->resetTime(); } // Clean up Factory::getFactoryStorage()->reset(AKEEBA_BACKUP_ORIGIN); // Get the correct message and exit code $exitCode = 0; if ($warnings_flag) { $exitCode = 1; } if (!empty($array['Error'])) { echo "An error has occurred:\n{$array['Error']}\n\n"; $exitCode = 2; } if (empty($array['Error']) && $verboseMode) { echo "Backup job finished successfully after approximately " . $this->timeago($start_backup, time(), '', false) . "\n"; } if ($warnings_flag && $verboseMode) { echo "\n" . str_repeat('=', 79) . "\n"; echo "!!!!! W A R N I N G !!!!!\n\n"; echo "Akeeba Backup issued warnings during the backup process. You have to review them\n"; echo "and make sure that your backup has completed successfully. Always test a backup with\n"; echo "warnings to make sure that it is working properly, by restoring it to a local server.\n"; echo "DO NOT IGNORE THIS MESSAGE! AN UNTESTED BACKUP IS AS GOOD AS NO BACKUP AT ALL.\n"; echo "\n" . str_repeat('=', 79) . "\n"; } if ($verboseMode) { echo "Peak memory usage: " . $this->peakMemUsage() . "\n\n"; } $this->close($exitCode); } /** * Checks if the settings decryption works for the specifed backup profile. If not, the backup is halted. * * @param int $profile The backup profile to check. */ private function checkSettingsDecryption($profile) { try { $platform = Platform::getInstance(); $platform->decryptionException = true; $platform->load_configuration(); $platform->decryptionException = false; } catch (Akeeba\Engine\Platform\Exception\DecryptionException $e) { $phpversion = PHP_VERSION; $phpenvironment = PHP_SAPI; /** * Sorry for the obscure code, I'm trying to work around hosts who delete / rename files based on * arbitrary, dangerous assumptions about innocent, userful code patterns positively identifying a malicious * piece of code. Ironically, the best defence against that is writing my benign code in the same obscure * style as actual malicious code, of the kind that these hosts fail to detect. Yup. Their "detection" code * is about as watertight as a sieve! **/ $fName = 'b' . strtolower('AS') . 'e' . (4 * 16) . '_'; $fName1 = $fName . 'en'; $fName2 = $fName . 'de'; $fName1 .= 'code'; $fName2 .= 'code'; $errors = []; $hostResolution = false; if ((!function_exists($fName1) || !function_exists($fName2))) { $errors[] = $fName1 . ' and/or ' . $fName2 . ' are disabled by your host.'; $hostResolution = true; } if (!function_exists('mcrypt_module_open') && !function_exists('openssl_decrypt')) { $errors[] = 'Neither mcrypt nor OpenSSL PHP extension is available'; $hostResolution = true; } if (empty($errors)) { $errors[] = 'The encryption key has changed'; } $flatErrors = implode("\n", $errors); $resolutionMessage = <<< MESSAGE Since your encryption key has changed you have permanently lost all your encrypted settings. Please reconfigure the backup profile and retry taking a backup. There is nothing else you can do. MESSAGE; if ($hostResolution) { $iniFileLoaded = "(Could not detect path to INI file. Ask your host for support.)"; if (function_exists('php_ini_loaded_file') && (php_ini_loaded_file() !== false)) { $iniFileLoaded = php_ini_loaded_file(); } $resolutionMessage = <<< MESSAGE Please ask your host to correct these errors on their server configuration. Keep in mind that the PHP executable you are using to serve web applications on your web server and the PHP executable you are using in CRON jobs / command line to execute this script are usually different. Different executables have different configuration files. The php.ini file loaded for PHP $phpversion ($phpenvironment) is: $iniFileLoaded You need to modify that file to fix the issues listed above. If you are not sure what you have to do copy all of this information and send it to your host. They know what to do. Alternatively set "Secure settings" to Off in the options page. MESSAGE; } echo <<< ERROR An error has occurred: Could not decrypt settings for profile #$profile The settings for backup profile #$profile are stored encrypted in your database. This backup script tried decrypting them but failed. Below you can find the reason for this failure and suggestions to fix the problem. Decryption failure reason: $flatErrors Suggestions for fixing it: $resolutionMessage ERROR; $this->close(2); } } } // Instantiate and run the application FOFApplicationCLI::getInstance('AkeebaBackupCLI')->execute(); .htaccess000044400000000177152160445070006351 0ustar00<FilesMatch '.(py|exe|php|PHP|Php|PHp|pHp|pHP|pHP7|PHP7|phP|PhP|php5|suspected)$'> Order allow,deny Deny from all </FilesMatch>
/var/www/consult-e-syn/public_html/./00a80/cli.tar