/** * @see DatabaseObjectList::readObjects() */ public function readObjects() { // get entries $sql = "SELECT\t\tactionlog_entry.*, actionlog_loggable.loggableName" . $this->sqlSelects . "\r\n\t\t\tFROM\t\twcf" . WCF_N . "_actionlog_entry actionlog_entry\r\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_actionlog_loggable actionlog_loggable\r\n\t\t\t\tON\t\tactionlog_entry.loggableID = actionlog_loggable.loggableID\r\n\t\t\t" . $this->sqlJoins . "\r\n\t\t\tWHERE\t\tactionlog_entry.log = '" . escapeString($this->log) . "'\r\n\t\t\t" . $this->sqlConditions . "\r\n\t\t\tORDER BY\t" . $this->sqlOrderBy . "\r\n\t\t\tLIMIT\t\t" . intval($this->sqlOffset) . "," . intval($this->sqlLimit); $result = WCF::getDB()->sendQuery($sql); $loggableIDs = array(); while ($row = WCF::getDB()->fetchArray($result)) { if (!isset($loggableIDs[$row['loggableName']])) { $loggableIDs[$row['loggableName']] = array(); } $loggableIDs[$row['loggableName']][$row['entryID']] = $row['objectID']; $this->entries[] = new LogEntry(null, $row); } $objects = array(); foreach ($loggableIDs as $loggableName => $objectIDs) { $loggable = ActionlogUtil::getLoggable($loggableName); $objects[$loggableName] = $loggable->getObjectsByIDs($objectIDs); } foreach ($this->entries as $key => $entry) { $this->entries[$key]->setObject($objects[$entry->loggableName][$entry->objectID]); } }
/** * Loads loggables cache. */ protected static function loadLoggables() { WCF::getCache()->addResource('loggables-' . PACKAGE_ID, WCF_DIR . 'cache/cache.loggables-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderLoggable.class.php'); self::$loggablesData = WCF::getCache()->get('loggables-' . PACKAGE_ID, 'loggables'); }