diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-03-27 01:10:01 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-03-27 01:10:01 +0400 |
commit | 213b5c7f3c5c0af6af3911659ac5f238320596c1 (patch) | |
tree | ae87431c506e2e3c1e48af0a927889c5af36baf9 | |
parent | 39caffc7581c880eb4e96e9adb5f00553a031b9c (diff) |
refs #4903 make archiving via web possible again, will provide a better solution later
-rw-r--r-- | misc/cron/archive.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php index 73c248bded..c002fa71ff 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -9,7 +9,37 @@ * @package Piwik */ +if (!defined('PIWIK_INCLUDE_PATH')) { + define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__) . "/../..")); +} + +if (!defined('PIWIK_USER_PATH')) { + define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH); +} + +if (empty($_SERVER['argv'])) { + + define('PIWIK_ENABLE_DISPATCH', false); + define('PIWIK_ENABLE_ERROR_HANDLER', false); + define('PIWIK_ENABLE_SESSION_START', false); + + require_once PIWIK_INCLUDE_PATH . "/index.php"; + + $archiving = new Piwik\CronArchive(); + try { + $archiving->init(); + $archiving->run(); + $archiving->runScheduledTasks(); + $archiving->end(); + } catch (Exception $e) { + $archiving->logFatalError($e->getMessage()); + } + + return; +} + $callee = array_shift($_SERVER['argv']); + $args = array($callee); $args[] = 'core:archive'; foreach ($_SERVER['argv'] as $arg) { @@ -24,7 +54,7 @@ foreach ($_SERVER['argv'] as $arg) { $_SERVER['argv'] = $args; -$piwikHome = realpath(dirname(__FILE__) . "/../.."); +$piwikHome = PIWIK_INCLUDE_PATH; if (false !== strpos($callee, 'archive.php')) { echo " |