public static function fetchMostViewedTopList($classID, $sectionID, $offset, $limit) { $topList = eZViewCounter::fetchTopList($classID, $sectionID, $offset, $limit); $contentNodeList = array(); foreach (array_keys($topList) as $key) { $nodeID = $topList[$key]['node_id']; $contentNode = eZContentObjectTreeNode::fetch($nodeID); if ($contentNode === null) { return array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND)); } $contentNodeList[] = $contentNode; } return array('result' => $contentNodeList); }
$startTime = @next(explode(" ", $srcStartTime)) + current(explode(" ", $srcStartTime)); $stopTime = @next(explode(" ", $srcStopTime)) + current(explode(" ", $srcStopTime)); $executionTime = round($stopTime - $startTime, 2); /** Alert the user to how long the script execution took place **/ $cli->output("\n\nThis script execution completed in " . $executionTime . " seconds" . ".\n"); } /** Login script to run as admin user This is required to see past content tree permissions, sections and other limitations **/ $currentuser = eZUser::currentUser(); $currentuser->logoutCurrent(); $user = eZUser::fetch($adminUserID); $user->loginCurrent(); /** Iterate over classID parameters **/ foreach ($classIDs as $classIDKey => $classID) { $sectionID = $sectionIDs[$classIDKey]; /** Fetch top view count of content object nodes **/ $topList = eZViewCounter::fetchTopList($classID, $sectionID, $offset, $limit); $topListCount += count($topList); /** Optional debug output **/ if ($troubleshoot && $scriptVerboseLevel >= 5) { $cli->output("View count entries fetched: " . $topListCount . "\n"); if ($troubleshoot && $scriptVerboseLevel >= 6) { $cli->output(print_r($topList)); } } foreach (array_keys($topList) as $key) { $nodeID = $topList[$key]['node_id']; /** Iterate over node **/ $contentNode = eZContentObjectTreeNode::fetch($nodeID); /** Content object node missing from database **/ if ($contentNode === null) { $viewCountRemoveRequiredDetected++;