Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
2012.3, 4.7.0-dev
-
None
Description
Hi. updateviewcount.php only adds one hit per node in each execution.
That's it, if you visit same page 12 or 1000 times between two updateviewcount executions, database counter will only be incremented in one hit for every node that updateviewcount has catched from the webserver log file.
i do think problem relies on this piece of code
foreach ( $pathHashCounter as $path => $count ) { $nodeID = eZURLAliasML::fetchNodeIDByPath( $path ); // Support for PathPrefix for ( $pathPrefixIndex = 0; !$nodeID && $pathPrefixIndex < $pathPrefixesCount; ++$pathPrefixIndex ) { // Try prepending each of the existing pathPrefixes, to see if one of them matches an existing node $nodeID = eZURLAliasML::fetchNodeIDByPath( $pathPrefixes[$pathPrefixIndex] . $path ); } if ( $nodeID ) { if ( !isset( $nodeIDHashCounter[$nodeID] ) ) { $nodeIDHashCounter[$nodeID] = 1; } else { ++$nodeIDHashCounter[$nodeID]; } } }
before start this loop, $pathHashCounter is like
$pathHashCounter[ 'path1/path2/node'] = 15; // suppose node_id 1000 $pathHashCounter[ 'path3/path4/path6/node'] = 25; // suppose node_id 1500
nodeIDHashCounter is not used anywhere if you work with clean url it's only used for checking /content/view/full like urls
So, after the nodeIdHashCounter lookes like
array( '1000' => 1, '1500' => 1 );
and this is the info sent to the database for increasing counters...
Steps to reproduce
1) Add a cronjobpart for executing updateviewcount.php script
2) take a look at the current state of ezview_counter table
3) Override log.ini to point to your log file
4) Visit same page two or more times. take note of the node_id
5) run cronjob for updateviewcount
6) look to ezview_counter table and you'll see counters have been only incremented per 1 in each case