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...

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 21:11:23
Script start
Timing: Jan 30 2025 21:11:23
Module start 'layout'
Timing: Jan 30 2025 21:11:23
Module start 'content'
Timing: Jan 30 2025 21:11:23
Module end 'content'
Timing: Jan 30 2025 21:11:23
Script end

Main resources:

Total runtime0.0258 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 588.2500151.2266
Module start 'layout' 0.00500.0040 739.4766220.7188
Module start 'content' 0.00900.0153 960.19531,009.9453
Module end 'content' 0.02430.0015 1,970.140645.9922
Script end 0.0258  2,016.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00259.8144140.0002
Check MTime0.00103.9572140.0001
Mysql Total
Database connection0.00072.554110.0007
Mysqli_queries0.002710.639330.0009
Looping result0.00000.038810.0000
Template Total0.00114.210.0011
Template load0.00083.118410.0008
Template processing0.00031.050310.0003
Override
Cache load0.00062.216010.0006
General
dbfile0.002710.463880.0003
String conversion0.00000.032340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs