diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2010-03-31 17:53:29 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2010-03-31 17:53:29 +0400 |
commit | dbd2e78843e25b65a84fe154b7e265f08286fd22 (patch) | |
tree | 6d39d5a5f23787ab32ba5bd194725c14446ce94c /misc/cron/archive.sh | |
parent | d5a3765dbe6129616cab259616a5cb01d01c9a1e (diff) |
Fixes #1227
the archive script now loops over all websites and triggers a different request for each archive, helping out with the archive memory exhausted issue (refs #766)
git-svn-id: http://dev.piwik.org/svn/trunk@2025 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'misc/cron/archive.sh')
-rw-r--r-- | misc/cron/archive.sh | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/misc/cron/archive.sh b/misc/cron/archive.sh index bfd43fd3e4..2871bf4c42 100644 --- a/misc/cron/archive.sh +++ b/misc/cron/archive.sh @@ -48,8 +48,25 @@ PIWIK_SUPERUSER_MD5_PASSWORD=`sed '/^\[superuser\]/,$!d;/^password[ \t]*=[ \t]*" CMD_TOKEN_AUTH="$PHP_BIN $PIWIK_PATH -- module=API&method=UsersManager.getTokenAuth&userLogin=$PIWIK_SUPERUSER&md5Password=$PIWIK_SUPERUSER_MD5_PASSWORD&format=php&serialize=0" TOKEN_AUTH=`$CMD_TOKEN_AUTH` -for period in day week year; do - CMD="$PHP_BIN $PIWIK_PATH -- module=API&method=VisitsSummary.getVisits&idSite=all&period=$period&date=last52&format=xml&token_auth=$TOKEN_AUTH"; - $CMD - echo "" +CMD_GET_ID_SITES="$PHP_BIN $PIWIK_PATH -- module=API&method=SitesManager.getAllSitesId&token_auth=$TOKEN_AUTH&format=csv&convertToUnicode=0" +ID_SITES=`$CMD_GET_ID_SITES` +echo "Starting Piwik archiving..." +echo "" +for idsite in $ID_SITES; do + TEST_IS_NUMERIC=`echo $idsite | egrep '^[0-9]+$'` + if [ "$TEST_IS_NUMERIC" ] + then + for period in day week year; do + echo "" + echo "Archiving period = $period for idsite = $idsite..." + CMD="$PHP_BIN $PIWIK_PATH -- module=API&method=VisitsSummary.getVisits&idSite=$idsite&period=$period&date=last52&format=xml&token_auth=$TOKEN_AUTH"; + $CMD + done + + echo "" + echo "Archiving for idsite = $idsite done!" + fi done + +echo "Piwik archiving finished." + |