diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2014-07-26 16:04:45 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2014-07-26 16:56:28 +0400 |
commit | b3a8a9dde2d90bab347b03b1ce5d60fe44113445 (patch) | |
tree | b69efb5e66d2e44434a887f9bb395a8044b3b667 /misc | |
parent | e366223af42135dad469aa2ce03ec69bc27d025e (diff) |
Refs #5807, fix build regression (accessing archive.php via web request results in PHP error).
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cron/archive.php | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php index 693bd8d948..fcf04d57c1 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -42,12 +42,17 @@ See also: http://piwik.org/docs/setup-auto-archiving/ \n\n"; } -$console = new Piwik\Console(); -$console->init(); - -// 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();
\ No newline at end of file +if (isset($_SERVER['argv'])) { + $console = new Piwik\Console(); + $console->init(); + + // 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 CronArchive directly + $archiver = new Piwik\CronArchive(); + $archiver->main(); +}
\ No newline at end of file |