diff options
author | mattab <matthieu.aubry@gmail.com> | 2015-07-12 20:18:10 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2015-07-12 20:18:10 +0300 |
commit | eda2756defc0b1f7cf124169a07ce88c36b0ea4d (patch) | |
tree | 76ce89992e5f8d257f75ad4a0cf12ac49db19d2c /misc | |
parent | 15e4a6942a6a1f83b9f21daa3c5549d7937e6956 (diff) |
Restore friendly error message when token_auth not found in request
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cron/archive.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php index d06c9cd230..bbfa1ae39d 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -20,15 +20,14 @@ if (!defined('PIWIK_USER_PATH')) { define('PIWIK_ENABLE_ERROR_HANDLER', false); define('PIWIK_ENABLE_SESSION_START', false); +require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; + if (!empty($_SERVER['argv'][0])) { $callee = $_SERVER['argv'][0]; } else { $callee = ''; } -require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; - - if (false !== strpos($callee, 'archive.php')) { $piwikHome = PIWIK_INCLUDE_PATH; echo " @@ -61,5 +60,15 @@ if (Piwik\Common::isPhpCliMode()) { $_GET['method'] = 'CoreAdminHome.runCronArchiving'; $_GET['format'] = 'console'; // will use Content-type text/plain + if(!isset($_GET['token_auth'])) { + echo " +<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> +\n\n"; + exit; + } + require_once PIWIK_INCLUDE_PATH . "/index.php"; }
\ No newline at end of file |