if (!defined('PIWIK_USER_PATH')) { define('PIWIK_USER_PATH', PIWIK_INCLUDE_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 = ''; } if (false !== strpos($callee, 'archive.php')) { $piwikHome = PIWIK_INCLUDE_PATH; echo "\n-------------------------------------------------------\nUsing this 'archive.php' script is no longer recommended.\nPlease use '/path/to/php {$piwikHome}/console core:archive " . implode('', array_slice($_SERVER['argv'], 1)) . "' instead.\nTo get help use '/path/to/php {$piwikHome}/console core:archive --help'\nSee also: http://piwik.org/docs/setup-auto-archiving/\n\nIf you cannot use the console because it requires CLI\ntry 'php archive.php --url=http://your.piwik/path'\n-------------------------------------------------------\n\n\n"; } if (Piwik\Common::isPhpCliMode()) { require_once PIWIK_INCLUDE_PATH . "/core/bootstrap.php"; $console = new Piwik\Console(); // manipulate command line arguments so CoreArchiver command will be executed $script = array_shift($_SERVER['argv']); array_unshift($_SERVER['argv'], 'core:archive'); array_unshift($_SERVER['argv'], $script); $console->run(); } else { // if running via web request, use CoreAdminHome.runCronArchiving method Piwik\Common::sendHeader('Content-type: text/plain'); $_GET['module'] = 'API'; $_GET['method'] = 'CoreAdminHome.runCronArchiving'; $_GET['format'] = 'console'; // will use Content-type text/plain if (!isset($_GET['token_auth'])) {