本文整理汇总了PHP中wcf\system\database\util\PreparedStatementConditionBuilder::add方法的典型用法代码示例。如果您正苦于以下问题:PHP PreparedStatementConditionBuilder::add方法的具体用法?PHP PreparedStatementConditionBuilder::add怎么用?PHP PreparedStatementConditionBuilder::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\system\database\util\PreparedStatementConditionBuilder
的用法示例。
在下文中一共展示了PreparedStatementConditionBuilder::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logFiles
/**
* @see \wcf\system\setup\IFileHandler::logFiles()
*/
public function logFiles(array $files)
{
// remove file extension
foreach ($files as &$file) {
$file = substr($file, 0, -4);
}
unset($file);
// fetch already installed acp templates
$conditions = new PreparedStatementConditionBuilder();
$conditions->add('packageID = ?', array($this->packageInstallation->getPackageID()));
$conditions->add('templateName IN (?)', array($files));
$conditions->add('application = ?', array($this->application));
$sql = "SELECT\ttemplateName\n\t\t\tFROM\twcf" . WCF_N . "_" . $this->tableName . "\n\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
while ($templateName = $statement->fetchColumn()) {
$index = array_search($templateName, $files);
if ($index !== false) {
unset($files[$index]);
}
}
if (!empty($files)) {
$sql = "INSERT INTO\twcf" . WCF_N . "_" . $this->tableName . "\n\t\t\t\t\t\t(packageID, templateName, application)\n\t\t\t\tVALUES\t\t(?, ?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($files as $file) {
$statement->execute(array($this->packageInstallation->getPackageID(), $file, $this->application));
}
}
}
示例2: getTags
/**
* Reads associated tags.
*/
protected function getTags()
{
$this->tags = array();
if (!empty($this->objectTypeIDs)) {
// get tag ids
$tagIDs = array();
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('object.objectTypeID IN (?)', array($this->objectTypeIDs));
$conditionBuilder->add('object.languageID IN (?)', array($this->languageIDs));
$sql = "SELECT\t\tCOUNT(*) AS counter, object.tagID\n\t\t\t\tFROM\t\twcf" . WCF_N . "_tag_to_object object\n\t\t\t\t" . $conditionBuilder . "\n\t\t\t\tGROUP BY\tobject.tagID\n\t\t\t\tORDER BY\tcounter DESC";
$statement = WCF::getDB()->prepareStatement($sql, 500);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
$tagIDs[$row['tagID']] = $row['counter'];
}
// get tags
if (!empty($tagIDs)) {
$sql = "SELECT\t*\n\t\t\t\t\tFROM\twcf" . WCF_N . "_tag\n\t\t\t\t\tWHERE\ttagID IN (?" . (count($tagIDs) > 1 ? str_repeat(',?', count($tagIDs) - 1) : '') . ")";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array_keys($tagIDs));
while ($row = $statement->fetchArray()) {
$row['counter'] = $tagIDs[$row['tagID']];
$this->tags[$row['name']] = new TagCloudTag(new Tag(null, $row));
}
// sort by counter
uasort($this->tags, array('self', 'compareTags'));
}
}
}
示例3: loadStorage
/**
* Loads storage for a given set of users.
*
* @param array<integer> $userIDs
* @param integer $packageID
*/
public function loadStorage(array $userIDs, $packageID = PACKAGE_ID)
{
$tmp = array();
foreach ($userIDs as $userID) {
if (!isset($this->cache[$userID])) {
$tmp[] = $userID;
}
}
// ignore users whose storage data is already loaded
if (empty($tmp)) {
return;
}
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", array($tmp));
$conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies($packageID)));
$sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_user_storage\n\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
if (!isset($this->cache[$row['userID']])) {
$this->cache[$row['userID']] = array();
}
$this->cache[$row['userID']][$row['field']] = $row['fieldValue'];
}
}
示例4: checkFiles
/**
* @see \wcf\system\setup\IFileHandler::checkFiles()
*/
public function checkFiles(array $files)
{
if ($this->packageInstallation->getPackage()->package != 'com.woltlab.wcf') {
if (!empty($files)) {
// get registered files of other packages for the
// same application
$conditions = new PreparedStatementConditionBuilder();
$conditions->add('packageID <> ?', array($this->packageInstallation->getPackageID()));
$conditions->add('filename IN (?)', array($files));
$conditions->add('application = ?', array($this->application));
$sql = "SELECT\tfilename, packageID\n\t\t\t\t\tFROM\twcf" . WCF_N . "_package_installation_file_log\n\t\t\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
$lockedFiles = array();
while ($row = $statement->fetchArray()) {
$lockedFiles[$row['filename']] = $row['packageID'];
}
// check delivered files
if (!empty($lockedFiles)) {
foreach ($files as $key => $file) {
if (isset($lockedFiles[$file])) {
$owningPackage = new Package($lockedFiles[$file]);
throw new SystemException("A package can't overwrite files from other packages. Only an update from the package which owns the file can do that. (Package '" . $this->packageInstallation->getPackage()->package . "' tries to overwrite file '" . $file . "', which is owned by package '" . $owningPackage->package . "')");
}
}
}
}
}
}
示例5: initUnreadArticle
protected function initUnreadArticle()
{
//Get application
$classParts = explode('\\', get_called_class());
if (WCF::getUser()->userID) {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add(self::$articleType . '.lastChangeTime > ?', array(VisitTracker::getInstance()->getVisitTime(self::OBJECT_TYPE)));
$conditionBuilder->add(self::$articleType . '.isDeleted = 0');
$conditionBuilder->add(self::$articleType . '.isDisabled = 0');
$conditionBuilder->add('tracked_visit.visitTime IS NULL');
// apply language filter
if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
$conditionBuilder->add('(' . self::$articleType . '.languageID IN (?) OR ' . self::$articleType . '.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
}
$sql = 'SELECT COUNT(*) AS count, ' . self::$articleType . '_to_category.categoryID
FROM ' . $classParts[0] . WCF_N . '_' . self::$articleType . ' ' . self::$articleType . '
LEFT JOIN wcf' . WCF_N . '_tracked_visit tracked_visit
ON (tracked_visit.objectTypeID = ' . VisitTracker::getInstance()->getObjectTypeID(self::OBJECT_TYPE) . ' AND tracked_visit.objectID = ' . self::$articleType . '.' . self::$articleType . 'ID AND tracked_visit.userID = ' . WCF::getUser()->userID . ')
LEFT JOIN ' . $classParts[0] . WCF_N . '_' . self::$articleType . '_to_category ' . self::$articleType . '_to_category
ON (' . self::$articleType . '_to_category.' . self::$articleType . 'ID = ' . self::$articleType . '.' . self::$articleType . 'ID)
' . $conditionBuilder . '
GROUP BY ' . self::$articleType . '_to_category.categoryID';
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
$this->unreadArticles[$row['categoryID']] = $row['count'];
}
}
}
示例6: logFiles
/**
* @see wcf\system\setup\IFileHandler::logFiles()
*/
public function logFiles(array $files)
{
if (empty($files)) {
return;
}
// fetch already installed files
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("packageID = ?", array($this->packageInstallation->getPackageID()));
$conditions->add("filename IN (?)", array($files));
$sql = "SELECT\tfilename\n\t\t\tFROM\twcf" . WCF_N . "_package_installation_file_log\n\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
$installedFiles = array();
while ($row = $statement->fetchArray()) {
$installedFiles[] = $row['filename'];
}
// ignore files which have already been installed
$installFiles = array();
foreach ($files as $file) {
if (in_array($file, $installedFiles)) {
continue;
}
$installFiles[] = $file;
}
if (!empty($installFiles)) {
$sql = "INSERT INTO\twcf" . WCF_N . "_package_installation_file_log\n\t\t\t\t\t\t(packageID, filename)\n\t\t\t\tVALUES\t\t(?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($installFiles as $file) {
$statement->execute(array($this->packageInstallation->getPackageID(), $file));
}
}
}
示例7: getData
/**
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $cacheResource)
{
list($cache, $packageID) = explode('-', $cacheResource['cache']);
$data = array();
// get all menu items and filter menu items with low priority
$sql = "SELECT\t\tmenuItem, menuItemID \n\t\t\tFROM\t\twcf" . WCF_N . "_page_menu_item menu_item\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_package_dependency package_dependency\n\t\t\tON\t\t(package_dependency.dependency = menu_item.packageID)\n\t\t\tWHERE \t\tpackage_dependency.packageID = ?\n\t\t\tORDER BY\tpackage_dependency.priority ASC";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($packageID));
$itemIDs = array();
while ($row = $statement->fetchArray()) {
$itemIDs[$row['menuItem']] = $row['menuItemID'];
}
if (count($itemIDs) > 0) {
// get needed menu items and build item tree
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("menu_item.menuItemID IN (?)", array($itemIDs));
$conditions->add("menu_item.isDisabled = ?", array(0));
$sql = "SELECT\t\tmenuItemID, menuItem, parentMenuItem, menuItemLink,\n\t\t\t\t\t\tpermissions, options, packageDir, menuPosition, className,\n\t\t\t\t\t\tCASE WHEN parentPackageID <> 0 THEN parentPackageID ELSE menu_item.packageID END AS packageID\n\t\t\t\tFROM\t\twcf" . WCF_N . "_page_menu_item menu_item\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\t\tON\t\t(package.packageID = menu_item.packageID)\n\t\t\t\t" . $conditions . "\n\t\t\t\tORDER BY\tshowOrder ASC";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$data[$row['parentMenuItem'] ? $row['parentMenuItem'] : $row['menuPosition']][] = new PageMenuItem(null, $row);
}
}
return $data;
}
示例8: countObjects
/**
* @see wcf\system\worker\IWorker::countObjects()
*/
public function countObjects()
{
$this->conditions = new PreparedStatementConditionBuilder();
$this->conditions->add("user.userID IN (?)", array($this->transferData['userIDs']));
$sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twcf" . WCF_N . "_user user\n\t\t\t" . $this->conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($this->conditions->getParameters());
$row = $statement->fetchArray();
$this->count = $row['count'];
}
示例9: search
/**
* @see wcf\system\search\acp\IACPSearchResultProvider::search()
*/
public function search($query) {
$results = array();
// search by language item
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
$conditions->add("languageItemValue LIKE ?", array($query.'%'));
// filter by language item
$languageItemsConditions = '';
$languageItemsParameters = array();
foreach (ACPSearchHandler::getInstance()->getAbbreviations('.acp.menu.link.%') as $abbreviation) {
if (!empty($languageItemsConditions)) $languageItemsConditions .= " OR ";
$languageItemsConditions .= "languageItem LIKE ?";
$languageItemsParameters[] = $abbreviation;
}
$conditions->add("(".$languageItemsConditions.")", $languageItemsParameters);
$sql = "SELECT languageItem, languageItemValue
FROM wcf".WCF_N."_language_item
".$conditions."
ORDER BY languageItemValue ASC";
$statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
$statement->execute($conditions->getParameters());
$languageItems = array();
while ($row = $statement->fetchArray()) {
$languageItems[$row['languageItem']] = $row['languageItemValue'];
}
if (empty($languageItems)) {
return array();
}
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("menuItem IN (?)", array(array_keys($languageItems)));
$conditions->add("menuItemLink <> ''");
$sql = "SELECT menuItem, menuItemLink, permissions, options
FROM wcf".WCF_N."_acp_menu_item
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
$statement->execute($conditions->getParameters());
while ($menuItem = $statement->fetchObject('wcf\data\acp\menu\item\ACPMenuItem')) {
if (!$this->validate($menuItem)) {
continue;
}
$results[] = new ACPSearchResult($languageItems[$menuItem->menuItem], $menuItem->getLink());
}
return $results;
}
示例10: search
/**
* @see \wcf\system\search\acp\IACPSearchResultProvider::search()
*/
public function search($query)
{
$results = array();
// search by language item
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
// filter by language item
$languageItemsConditions = '';
$languageItemsParameters = array();
foreach (ACPSearchHandler::getInstance()->getAbbreviations('.acp.menu.link.%') as $abbreviation) {
if (!empty($languageItemsConditions)) {
$languageItemsConditions .= " OR ";
}
$languageItemsConditions .= "languageItem LIKE ?";
$languageItemsParameters[] = $abbreviation;
}
$conditions->add("(" . $languageItemsConditions . ")", $languageItemsParameters);
$conditions->add("languageItemValue LIKE ?", array('%' . $query . '%'));
$sql = "SELECT\t\tlanguageItem, languageItemValue\n\t\t\tFROM\t\twcf" . WCF_N . "_language_item\n\t\t\t" . $conditions . "\n\t\t\tORDER BY\tlanguageItemValue ASC";
$statement = WCF::getDB()->prepareStatement($sql);
// don't use a limit here
$statement->execute($conditions->getParameters());
$languageItems = array();
while ($row = $statement->fetchArray()) {
$languageItems[$row['languageItem']] = $row['languageItemValue'];
}
if (empty($languageItems)) {
return array();
}
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("menuItem IN (?)", array(array_keys($languageItems)));
$conditions->add("menuItemController <> ''");
$sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_acp_menu_item\n\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
// don't use a limit here
$statement->execute($conditions->getParameters());
$menuItems = ACPMenu::getInstance()->menuItemList;
while ($menuItem = $statement->fetchObject('wcf\\data\\acp\\menu\\item\\ACPMenuItem')) {
// only valid menu items exist in TreeMenu::$menuItemList,
// so no need to call AbstractACPSearchResultProvider::validate()
if (!isset($menuItems[$menuItem->menuItem])) {
continue;
}
$parentMenuItem = $menuItem->parentMenuItem;
$parentMenuItems = array();
while ($parentMenuItem && isset($menuItems[$parentMenuItem])) {
array_unshift($parentMenuItems, $parentMenuItem);
$parentMenuItem = $menuItems[$parentMenuItem]->parentMenuItem;
}
$results[] = new ACPSearchResult($languageItems[$menuItem->menuItem], $menuItem->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', array('pieces' => $parentMenuItems)));
}
return $results;
}
示例11: execute
/**
* @see \wcf\system\worker\IWorker::execute()
*/
public function execute()
{
parent::execute();
if (!count($this->objectList)) {
return;
}
if (!$this->loopCount) {
// remove the activity points
UserActivityPointHandler::getInstance()->reset('de.voolia.news.activityPointEvent.news');
// remove the entry from search index
SearchIndexManager::getInstance()->reset('de.voolia.news.entry');
}
// get news attachments
$attachmentObjectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', 'de.voolia.news.entry');
$sql = "SELECT\t\tCOUNT(*) AS attachments\n\t\t\tFROM\t\twcf" . WCF_N . "_attachment\n\t\t\tWHERE\t\tobjectTypeID = ?\n\t\t\tAND\t\tobjectID = ?";
$attachments = WCF::getDB()->prepareStatement($sql);
// calculate the cumulative likes
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("objectID IN (?)", array($this->objectList->getObjectIDs()));
$conditions->add("objectTypeID = ?", array(ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.like.likeableObject', 'de.voolia.news.likeableNews')));
$sql = "SELECT\tobjectID,\n\t\t\t\tcumulativeLikes\n\t\t\tFROM\twcf" . WCF_N . "_like_object\n\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
$likes = array();
while ($row = $statement->fetchArray()) {
$likes[$row['objectID']] = $row['cumulativeLikes'];
}
// update the news entries
$userItems = array();
foreach ($this->objectList as $news) {
// new EntryEditor
$editor = new NewsEditor($news);
// update search index
SearchIndexManager::getInstance()->add('de.voolia.news.entry', $news->newsID, $news->message, $news->subject, $news->time, $news->userID, $news->username, $news->languageID);
// news data
$newsData = array();
// likes
$newsData['cumulativeLikes'] = isset($likes[$news->newsID]) ? $likes[$news->newsID] : 0;
// attachments
$attachments->execute(array($attachmentObjectType->objectTypeID, $news->newsID));
$row = $attachments->fetchArray();
$newsData['attachments'] = $row['attachments'];
if ($news->userID) {
if (!isset($userItems[$news->userID])) {
$userItems[$news->userID] = 0;
}
$userItems[$news->userID]++;
}
$editor->update($newsData);
}
// update activity points
UserActivityPointHandler::getInstance()->fireEvents('de.voolia.news.activityPointEvent.news', $userItems, false);
}
示例12: getData
/**
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $cacheResource)
{
list($cache, $packageID, $groupIDs) = explode('-', $cacheResource['cache']);
$data = array();
// get all options and filter options with low priority
if ($packageID == 0) {
// during the installation of the package wcf
$sql = "SELECT\t\toptionName, optionID \n\t\t\t\tFROM\t\twcf" . WCF_N . "_user_group_option\n\t\t\t\tWHERE \t\tpackageID IS NULL";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
} else {
$sql = "SELECT\t\toptionName, optionID \n\t\t\t\tFROM\t\twcf" . WCF_N . "_user_group_option option_table\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_package_dependency package_dependency\n\t\t\t\tON\t\t(package_dependency.dependency = option_table.packageID)\n\t\t\t\tWHERE \t\tpackage_dependency.packageID = ?\n\t\t\t\tORDER BY\tpackage_dependency.priority ASC";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($packageID));
}
$options = array();
while ($row = $statement->fetchArray()) {
$options[$row['optionName']] = $row['optionID'];
}
if (count($options) > 0) {
// get needed options
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("option_value.groupID IN (?)", array(explode(',', $groupIDs)));
$conditions->add("option_value.optionID IN (?)", array($options));
$sql = "SELECT\t\toption_table.optionName, option_table.optionType, option_value.optionValue\n\t\t\t\tFROM\t\twcf" . WCF_N . "_user_group_option_value option_value\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_group_option option_table\n\t\t\t\tON\t\t(option_table.optionID = option_value.optionID)\n\t\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
if (!isset($data[$row['optionName']])) {
$data[$row['optionName']] = array('type' => $row['optionType'], 'values' => array());
}
$data[$row['optionName']]['values'][] = $row['optionValue'];
}
// merge values
foreach ($data as $optionName => $option) {
if (count($option['values']) == 1) {
$result = $option['values'][0];
} else {
$typeObj = $this->getTypeObject($option['type']);
$result = $typeObj->merge($option['values']);
}
// unset false values
if ($result === false) {
unset($data[$optionName]);
} else {
$data[$optionName] = $result;
}
}
}
$data['groupIDs'] = $groupIDs;
return $data;
}
示例13: getCondition
/**
* @see \wcf\system\option\ISearchableUserOption::getCondition()
*/
public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value)
{
if (!isset($_POST['searchOptions'][$option->optionName])) {
return false;
}
$value = StringUtil::trim($value);
if ($value == '') {
$conditions->add("option_value.userOption" . $option->optionID . " = ?", array(''));
} else {
$conditions->add("option_value.userOption" . $option->optionID . " LIKE ?", array('%' . addcslashes($value, '_%') . '%'));
}
return true;
}
示例14: _remove
/**
* Removes log entries.
*
* @param string $objectType
* @param array<integer> $objectIDs
*/
protected function _remove($objectType, array $objectIDs)
{
$objectType = $this->getObjectType($objectType);
if ($objectType === null) {
throw new SystemException("Object type '" . $objectType . "' not found within definition 'com.woltlab.wcf.modifiableContent'");
}
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("objectTypeID = ?", array($objectType->objectTypeID));
$conditions->add("objectID IN (?)", array($objectIDs));
$sql = "DELETE FROM\twcf" . WCF_N . "_modification_log\n\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
}
示例15: execute
/**
* @see \wcf\system\worker\IWorker::execute()
*/
public function execute()
{
parent::execute();
if (!$this->loopCount) {
// reset activity points
UserActivityPointHandler::getInstance()->reset('de.incendium.linklist.activityPointEvent.entry');
// reset search index
SearchIndexManager::getInstance()->reset('de.incendium.linklist.entry');
}
if (!count($this->objectList)) {
return;
}
// fetch cumulative likes
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("objectTypeID = ?", array(ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.like.likeableObject', 'de.incendium.linklist.likeableEntry')));
$conditions->add("objectID IN (?)", array($this->objectList->getObjectIDs()));
$sql = "SELECT\tobjectID, cumulativeLikes\n\t\t\tFROM\twcf" . WCF_N . "_like_object\n\t\t\t" . $conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
$cumulativeLikes = array();
while ($row = $statement->fetchArray()) {
$cumulativeLikes[$row['objectID']] = $row['cumulativeLikes'];
}
// prepare statements
$attachmentObjectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', 'de.incendium.linklist.entry');
$sql = "SELECT\t\tCOUNT(*) AS attachments\n\t\t\tFROM\t\twcf" . WCF_N . "_attachment\n\t\t\tWHERE\t\tobjectTypeID = ?\n\t\t\t\t\tAND objectID = ?";
$attachmentStatement = WCF::getDB()->prepareStatement($sql);
$itemsToUser = array();
foreach ($this->objectList as $entry) {
$editor = new EntryEditor($entry);
$data = array();
// count attachments
$attachmentStatement->execute(array($attachmentObjectType->objectTypeID, $entry->entryID));
$row = $attachmentStatement->fetchArray();
$data['attachments'] = $row['attachments'];
// update cumulative likes
$data['cumulativeLikes'] = isset($cumulativeLikes[$entry->entryID]) ? $cumulativeLikes[$entry->entryID] : 0;
$editor->update($data);
if ($entry->userID) {
if (!isset($itemsToUser[$entry->userID])) {
$itemsToUser[$entry->userID] = 0;
}
$itemsToUser[$entry->userID]++;
}
// update search index
SearchIndexManager::getInstance()->add('de.incendium.linklist.entry', $entry->entryID, $entry->message, $entry->subject, $entry->time, $entry->userID, $entry->username, $entry->languageID);
}
// update activity points
UserActivityPointHandler::getInstance()->fireEvents('de.incendium.linklist.activityPointEvent.entry', $itemsToUser, false);
}