diff options
author | diosmosis <benaka@piwik.pro> | 2014-10-16 05:48:09 +0400 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2014-10-16 05:48:09 +0400 |
commit | cbc8714a9e281721e1e4ceddd7b9826339a1520a (patch) | |
tree | ca19db60b6a05921c51ec42e2311a5788284f10e /misc | |
parent | 9b713ca17c7994ff9c75057a72e65e8d2b711d72 (diff) |
Moving CronArchive token auth check to archive script since it is only for when the archive.php script is invoked from a web request.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cron/archive.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php index 015a827986..bf8ed3317b 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -56,6 +56,17 @@ if (isset($_SERVER['argv']) && Piwik\Console::isSupported()) { $console->run(); } else { // if running via web request, use CronArchive directly + $token_auth = Piwik\Common::getRequestVar('token_auth', '', 'string'); + + if ($token_auth !== $this->token_auth + || strlen($token_auth) != 32 + ) { + die('<b>You must specify the Super User token_auth as a parameter to this script, eg. <code>?token_auth=XYZ</code> if you wish to run this script through the browser. </b><br> + However it is recommended to run it <a href="http://piwik.org/docs/setup-auto-archiving/">via cron in the command line</a>, since it can take a long time to run.<br/> + In a shell, execute for example the following to trigger archiving on the local Piwik server:<br/> + <code>$ /path/to/php /path/to/piwik/console core:archive --url=http://your-website.org/path/to/piwik/</code>'); + } + $archiver = new Piwik\CronArchive(); $archiver->main(); }
\ No newline at end of file |