SitesManager.getAllSitesId returns nothing in 0.6.1?

Hello,

I’m calling the archive.sh via cronjob.
Since my upgrade from 0.6 RC 1 to 0.6.1 it doesn’t work anymore.

The problem is this call:
$PIWIK_PATH – module=API&method=SitesManager.getAllSitesId&token_auth=$TOKEN_AUTH&format=csv&convertToUnicode=0

It returns an empty csv. (tested it in my browser with correct token id).

I have only one site defined (id=1). I’ve updated piwik by deleting all old files and uploading all
new files via FTP. Everything else (Dashboard, archiving via browser etc.) works fine.

Anyone with the same issue or an idea?

do you use token_auth from the super user? I just tried and it works fine.

I seem to have the same problem, and can’t find the token_auth for the superuser.

This effectively breaks scheduled archiving via archive.sh too. Bummer.

I figured something out with this…

when calling:

CMD_TOKEN_AUTH="$PHP_BIN $PIWIK_PATH -- module=API&method=UsersManager.getTokenAuth&userLogin=$PIWIK_SUPERUSER&md5Password=$PIWIK_SUPERUSER_MD5_PASSWORD&format=php&serialize=0"

from the command line, it returns an error:

<result>
        <error message="The parameter 'method' isn't set in the Request, and a default value wasn't provided." />
</result>

however, if I get the values and run it via the browser…:

www.<i>mydomain.com</i>/<i>piwik_location</i>/index.php?module=API&method=UsersManager.getTokenAuth&userLogin=<i>my_superuser</i>&md5Password=<i>my_md5_password</i>&format=php&serialize=0

it returns the correct token_auth value.

Next I edit archive.sh and replace

TOKEN_AUTH=`$CMD_TOKEN_AUTH`

with

TOKEN_AUTH=<i>my_token_auth</i>

… and at least it works.

An ugly workaround, at the least.

what is the content of your config/config.ini.php ?
it looks like the magic sed command is failing to retrieve the md5 password from your config file, probably because it uses some uncommon characters? you can send it by MP if you don’t want to reveal passwords etc.

[quote=matthieu @ May 24 2010, 06:20 AM]what is the content of your config/config.ini.php ?
it looks like the magic sed command is failing to retrieve the md5 password from your config file, probably because it uses some uncommon characters? you can send it by MP if you don’t want to reveal passwords etc.[/quote]

Sent.

[quote=dep @ May 8 2010, 09:04 AM]Hello,

I’m calling the archive.sh via cronjob.
Since my upgrade from 0.6 RC 1 to 0.6.1 it doesn’t work anymore.

The problem is this call:
$PIWIK_PATH – module=API&method=SitesManager.getAllSitesId&token_auth=$TOKEN_AUTH&format=csv&convertToUnicode=0

It returns an empty csv. (tested it in my browser with correct token id).

I have only one site defined (id=1). I’ve updated piwik by deleting all old files and uploading all
new files via FTP. Everything else (Dashboard, archiving via browser etc.) works fine.

Anyone with the same issue or an idea?[/quote]

I’ve done a little more work on this, and I think I might be on to something.

I inserted the command echo $TOKEN_AUTH into archive.sh just after TOKEN_AUTH=$CMD_TOKEN_AUTH and the result that I’m seeing is this:

X-Powered-By: PHP/5.2.13^M Set-Cookie: PIWIK_SESSID=b82901c84b2989b34f86fa962a11a03b; path=/^M Expires: Thu, 19 Nov 1981 08:52:00 GMT^M Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0^M Pragma: no-cache^M Content-type: text/html^M ^M <i>token_auth</i>

Where token_auth is the correct code.

I believe that $CMD_TOKEN_AUTH needs to be parsed more to get the actual token_auth code rather than the full returned headers from the command. Thoughts?

That’s because the “php” that you’re executing from the command line is the PHP-CGI binary, and not the PHP-CLI binary; the latter doesn’t output HTTP headers.