diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-03-26 07:35:10 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-03-26 07:35:10 +0400 |
commit | c2b6c25713d7e5c1037075af288447a275dc22b1 (patch) | |
tree | 97d137f9b6ffb6266f544036e14d389c14389908 /misc | |
parent | 2af200d173464c18d393a9f7b0e562873f54664b (diff) |
refs #4903 forward archive.php to new console command
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cron/archive.php | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php index ff2fd5c485..73c248bded 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -9,30 +9,30 @@ * @package Piwik */ -namespace Piwik; - -use Exception; - -if (!defined('PIWIK_INCLUDE_PATH')) { - define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__) . "/../..")); +$callee = array_shift($_SERVER['argv']); +$args = array($callee); +$args[] = 'core:archive'; +foreach ($_SERVER['argv'] as $arg) { + if (0 === strpos($arg, '--')) { + $args[] = $arg; + } elseif (0 === strpos($arg, '-')) { + $args[] = '-' . $arg; + } else { + $args[] = '--' . $arg; + } } -if (!defined('PIWIK_USER_PATH')) { - define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH); -} +$_SERVER['argv'] = $args; -define('PIWIK_ENABLE_DISPATCH', false); -define('PIWIK_ENABLE_ERROR_HANDLER', false); -define('PIWIK_ENABLE_SESSION_START', false); +$piwikHome = realpath(dirname(__FILE__) . "/../.."); -require_once PIWIK_INCLUDE_PATH . "/index.php"; - -$archiving = new CronArchive(); -try { - $archiving->init(); - $archiving->run(); - $archiving->runScheduledTasks(); - $archiving->end(); -} catch (Exception $e) { - $archiving->logFatalError($e->getMessage()); +if (false !== strpos($callee, 'archive.php')) { +echo " +------------------------------------------------------- +Using this 'archive.php' script is no longer recommended. +Please use '/path/to/php $piwikHome/console core:archive " . implode(' ', array_slice($args, 2)) . "' instead. +------------------------------------------------------- +\n\n"; } + +include $piwikHome . '/console';
\ No newline at end of file |