Forums / Install & configuration / updateviewcount.php wont work

updateviewcount.php wont work

Author Message

Fabio Farnesi

Thursday 31 January 2008 3:35:34 am

well i've

------------------cronjob.ini.append.php
[CronjobSettings]
ScriptDirectories[]=cronjobs
Scripts[]=unpublish.php
Scripts[]=indexcontent.php
Scripts[]=hide.php
Scripts[]=subtreeexpirycleanup.php
Scripts[]=internal_drafts_cleanup.php
Scripts[]=updateviewcount.php
ExtensionDirectories[]

____________
[AccessLogFileSettings]
StorageDir=/usr/local/Zend/apache2/logs/
LogFileName=access_log
SitePrefix[]=plain_site\/
SitePrefix[]=plain_site_admin\/
_______________

i run

php runcronjobs.php -d -s plain_site -c --sql --logfiles

and everything seems to work, my updateview.log report the last line log analyzed.

BTW ezview_counter is not updated

mysql> select * from ezview_counter;
Empty set (0.00 sec)

so i can't use stats in my site. Where is my error?

Fabio

André R.

Thursday 31 January 2008 9:55:44 am

You should probably make some modifications to the script to see if what this query returns, and what '$pathIdentificationString'' is:

"SELECT node_id FROM ezcontentobject_tree \n" .
                                         "WHERE path_identification_string='$pathIdentificationString'";

This will give you a clue on how you should tweak SitePrefix[]!

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Fabio Farnesi

Thursday 31 January 2008 1:31:18 pm

tnx for the help, i'm doing some little progress.

Now i've modified

SitePrefix[]=corporate\/index.php\/plain_site\/

and some records r written in ezview_counter

btw the counter don't works fine. Only few clicks r registered in ezview_counter

I think the problem is in my general configuration. For example i want count the view on this url

http://localhost/corporate/index.php/plain_site/Download/Test-Workflow

and this don't work. It work on this type of url

http://localhost/corporate/index.php/plain_site/content/view/full/78

any ideas?

André R.

Thursday 31 January 2008 1:44:27 pm

Ah.. could you post the path_identification_string on that node ? it's probably different.

This might be because of the new url translation system in 3.10 / 4.0, and the update view count script is not updated for it it seems ( as in a bug ).

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Fabio Farnesi

Thursday 31 January 2008 1:57:47 pm

this is my path_identification_string

path_identification_string = 'download/test_workflow'

on this url

André R.

Thursday 31 January 2008 2:14:40 pm

Ok, I have created a issue for it:
http://issues.ez.no/IssueView.php?Id=12484&

It will hopefully be fixed in 3.10.1 and 4.0.1. You can try to downcase the url in the mean time in the script code.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Fabio Farnesi

Thursday 31 January 2008 2:33:53 pm

oh :-(

Ok, understood now. Tnx for you help, i'll wait for a bug fix

Tnx anyway,

Have a great day
Fabio

Fabio Farnesi

Thursday 31 January 2008 3:55:57 pm

i've done few changes to updateviewcounter.php and it seems works better now.

This is my hack, i hope it can be useful:

line 133
$url = preg_replace( "/\?.*/", "", $url);
<b>$url = strtolower($url);</b>
foreach ( $prefixes as $prefix )

line 222
foreach ( $pathArray as $path )
{
$pathIdentification = $db->escapeString( $path );
<b>$pathIdentification=preg_replace('/-/','_',$pathIdentification);
$pathIdentification=preg_replace('/\./','_',$pathIdentification);
</b>

dunno if is this solve for every1, for me works.

Have a great day
Fabio

André R.

Friday 11 April 2008 5:28:56 am

Hi, you can try my path for updateviewcount.php:

http://issues.ez.no/IssueView.php?Id=12842&activeItem=1

Might be better then your url replace quick fix ;)

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michael Scofield

Wednesday 04 June 2008 11:52:34 pm

Hello,

I'm a newcomer to the world of Ez Publish.

I'm having a lot of troubles with the updateviewcount.php script and had to do a little modification in the code to make it work.

I just replaced the next lines:

$url = str_replace( "content/view/full/", "", $url );
                        $url = str_replace( "/", "", $url );
                        $url = preg_replace( "/\?(.*)/", "", $url );
                        $nodeIDArray[] = $url;

With these ones:

$pos_in_url = strrpos($url, "/");
						if ($pos_in_url !== false) {							
							$url = substr($url, $pos_in_url+1, strlen($url)-$pos_in_url);
	                        $nodeIDArray[] = $url;
						}

That's because $url was coming with a string like this one: "index.phpeng87". It should come only with the ID, but was coming with index.php and siteaccess.

The script is working fine now, information is being registered in database (ezview_counter table), but I still have the URL problem, described by Fábio Farnesi.

I have applied the patch André R. recommended, and even after that, the bug persists.

The problem is with Virtual URLS. System URLs are being registered correctly in the database.

I don't know what to do, maybe wait for version 4.0.1...