// 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] = $count; } else { $nodeIDHashCounter[$nodeID] += $count; } } } foreach ($nodeIDHashCounter as $nodeID => $count) { if (eZContentObjectTreeNode::fetch($nodeID) != null) { $counter = eZViewCounter::fetch($nodeID); if ($counter == null) { $counter = eZViewCounter::create($nodeID); $counter->setAttribute('count', $count); $counter->store(); } else { $counter->increase($count); } } } $dt = new eZDateTime(); $fh = fopen($updateViewLogPath, "w"); if ($fh) { fwrite($fh, "# Finished at " . $dt->toString() . "\n" . "# Last updated entry:" . "\n" . $lastLine . "\n"); fclose($fh); } $cli->output("Finished at " . $dt->toString() . "\n"); $cli->output("View count have been updated!\n");