diff options
author | diosmosis <benaka@piwik.pro> | 2015-04-19 14:03:31 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-05-10 08:44:11 +0300 |
commit | ff8fa3f3ffdfdc12e0bbf4aaec4a86843dc97d24 (patch) | |
tree | d13dd613a9cad1d77284950472dd5b0323c3d85e /plugins/CoreConsole | |
parent | e2d14cd5581ee3681c8daa28029df286def712f7 (diff) |
Add cron archiving API method only visible to superusers, use this in archive.php script and re-add php-cgi support to Console, which did not get merged in the past for some reason.
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r-- | plugins/CoreConsole/Commands/CoreArchiver.php | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/plugins/CoreConsole/Commands/CoreArchiver.php b/plugins/CoreConsole/Commands/CoreArchiver.php index 05cffb7e12..9682224a67 100644 --- a/plugins/CoreConsole/Commands/CoreArchiver.php +++ b/plugins/CoreConsole/Commands/CoreArchiver.php @@ -25,24 +25,14 @@ class CoreArchiver extends ConsoleCommand protected function execute(InputInterface $input, OutputInterface $output) { - $url = $input->getOption('url') ?: $input->getOption('piwik-domain'); - if (empty($url)) { - throw new \InvalidArgumentException("The --url argument is not set. It should be set to your Piwik URL, for example: --url=http://example.org/piwik/."); - } - - if (is_string($url) && $url && in_array($url, array('http://', 'https://'))) { - // see https://github.com/piwik/piwik/issues/5180 and http://forum.piwik.org/read.php?2,115274 - throw new \InvalidArgumentException('No valid URL given. If you have specified a valid URL try --piwik-domain instead of --url'); - } - - $archiver = self::makeArchiver($url, $input); + $archiver = self::makeArchiver("", $input); $archiver->main(); } // also used by another console command - public static function makeArchiver($url, InputInterface $input) + public static function makeArchiver($url, InputInterface $input) // TODO: remove url from this function { - $archiver = new CronArchive($url); + $archiver = new CronArchive(); $archiver->disableScheduledTasks = $input->getOption('disable-scheduled-tasks'); $archiver->acceptInvalidSSLCertificate = $input->getOption("accept-invalid-ssl-certificate"); @@ -81,7 +71,7 @@ class CoreArchiver extends ConsoleCommand but it is recommended to run it via command line/CLI instead. * If you have any suggestion about this script, please let the team know at feedback@piwik.org * Enjoy!"); - $command->addOption('url', null, InputOption::VALUE_REQUIRED, "Mandatory option as an alternative to '--piwik-domain'. Must be set to the Piwik base URL.\nFor example: --url=http://analytics.example.org/ or --url=https://example.org/piwik/"); + $command->addOption('url', null, InputOption::VALUE_REQUIRED, "Deprecated."); $command->addOption('force-all-websites', null, InputOption::VALUE_NONE, "If specified, the script will trigger archiving on all websites.\nUse with --force-all-periods=[seconds] to also process those websites that had visits in the last [seconds] seconds.\nLaunching several processes with this option will make them share the list of sites to process."); $command->addOption('force-all-periods', null, InputOption::VALUE_OPTIONAL, "Limits archiving to websites with some traffic in the last [seconds] seconds. \nFor example --force-all-periods=86400 will archive websites that had visits in the last 24 hours. \nIf [seconds] is not specified, all websites with visits in the last " . CronArchive::ARCHIVE_SITES_WITH_TRAFFIC_SINCE . " seconds (" . round(CronArchive::ARCHIVE_SITES_WITH_TRAFFIC_SINCE / 86400) . " days) will be archived."); $command->addOption('force-timeout-for-periods', null, InputOption::VALUE_OPTIONAL, "The current week/ current month/ current year will be processed at most every [seconds].\nIf not specified, defaults to " . CronArchive::SECONDS_DELAY_BETWEEN_PERIOD_ARCHIVES . "."); |