diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-01-31 04:54:22 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-01-31 04:54:22 +0400 |
commit | ac7731074c83c97d0583addb326640c808dd85a8 (patch) | |
tree | 484e5d99470593061e97550e9e1982a820b5fa5d /misc/cron/archive.sh | |
parent | 7250284dd1c24637e5a4416c047af05e66951d42 (diff) |
refs #4564 fix import logs and archive.sh did no longer work because there is no longer a superuser in the config. Read directly the tokenauth of any superuser from a generated file instead. The updatetoken.php will create a file containing the needed token in tmp/cache which will not be served by default (on apache). Also the script contains directly an exit to avoid execution or anything from the browser or cli
Diffstat (limited to 'misc/cron/archive.sh')
-rwxr-xr-x | misc/cron/archive.sh | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/misc/cron/archive.sh b/misc/cron/archive.sh index e9dc100004..1947e5513d 100755 --- a/misc/cron/archive.sh +++ b/misc/cron/archive.sh @@ -62,17 +62,10 @@ act_path() { ARCHIVE=`act_path ${0}` PIWIK_CRON_FOLDER=`dirname ${ARCHIVE}` PIWIK_PATH="$PIWIK_CRON_FOLDER"/../../index.php -PIWIK_CONFIG="$PIWIK_CRON_FOLDER"/../../config/config.ini.php +PIWIK_TOKEN_GENERATOR="$PIWIK_CRON_FOLDER"/../../misc/cron/updatetoken.php -DB_USERNAME=`sed '/^\[database\]/,$!d;/^username[ \t]*=[ \t]*"*/!d;s///;s/"*[ \t]*$//;q' $PIWIK_CONFIG` -DB_PASSWORD=`sed '/^\[database\]/,$!d;/^password[ \t]*=[ \t]*"*/!d;s///;s/"*[ \t]*$//;q' $PIWIK_CONFIG` -DB_HOST=`sed '/^\[database\]/,$!d;/^host[ \t]*=[ \t]*"*/!d;s///;s/"*[ \t]*$//;q' $PIWIK_CONFIG` -DB_NAME=`sed '/^\[database\]/,$!d;/^dbname[ \t]*=[ \t]*"*/!d;s///;s/"*[ \t]*$//;q' $PIWIK_CONFIG` -DB_TABLEPREFIX=`sed '/^\[database\]/,$!d;/^tables_prefix[ \t]*=[ \t]*"*/!d;s///;s/"*[ \t]*$//;q' $PIWIK_CONFIG` -DB_USERTABLE=${DB_TABLEPREFIX}user - -PIWIK_SUPERUSER=`mysql -h $DB_HOST -u $DB_USERNAME -p$DB_PASSWORD $DB_NAME -e "select login from $DB_USERTABLE where superuser_access=1 limit 1;" -s -N` -TOKEN_AUTH=`mysql -h $DB_HOST -u $DB_USERNAME -p$DB_PASSWORD $DB_NAME -e "select token_auth from $DB_USERTABLE where superuser_access=1 limit 1;" -s -N` +FILENAME_TOKEN_CONTENT=`php $PIWIK_TOKEN_GENERATOR` +TOKEN_AUTH=`cat $FILENAME_TOKEN_CONTENT | cut -f2` CMD_GET_ID_SITES="$PHP_BIN -q $PIWIK_PATH -- module=API&method=SitesManager.getAllSitesId&token_auth=$TOKEN_AUTH&format=csv&convertToUnicode=0" ID_SITES=`$CMD_GET_ID_SITES` |