本文整理汇总了PHP中WCF::getDB方法的典型用法代码示例。如果您正苦于以下问题:PHP WCF::getDB方法的具体用法?PHP WCF::getDB怎么用?PHP WCF::getDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WCF
的用法示例。
在下文中一共展示了WCF::getDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if (WCF::getUser()->userID && WCF::getUser()->getPermission('admin.general.canUseAcp') && !defined(get_class($eventObj) . '::DO_NOT_LOG')) {
// try to find existing session log
$sql = "SELECT\tsessionLogID\n\t\t\t\tFROM\twcf" . WCF_N . "_acp_session_log\n\t\t\t\tWHERE\tsessionID = '" . WCF::getSession()->sessionID . "'\n\t\t\t\t\tAND lastActivityTime >= " . (TIME_NOW - SESSION_TIMEOUT);
$row = WCF::getDB()->getFirstRow($sql);
if (!empty($row['sessionLogID'])) {
$sessionLogID = $row['sessionLogID'];
// update session log
$sql = "UPDATE\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\tSET\tlastActivityTime = " . TIME_NOW . "\n\t\t\t\t\tWHERE\tsessionLogID = " . $sessionLogID;
WCF::getDB()->registerShutdownUpdate($sql);
} else {
// create new session log
$sql = "INSERT INTO\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\t\t\t(sessionID, userID, ipAddress, hostname, userAgent, time, lastActivityTime)\n\t\t\t\t\tVALUES\t\t('" . WCF::getSession()->sessionID . "', " . WCF::getUser()->userID . ", '" . escapeString(WCF::getSession()->ipAddress) . "', '" . escapeString(@gethostbyaddr(WCF::getSession()->ipAddress)) . "', '" . escapeString(WCF::getSession()->userAgent) . "', " . TIME_NOW . ", " . TIME_NOW . ")";
WCF::getDB()->sendQuery($sql);
$sessionLogID = WCF::getDB()->getInsertID("wcf" . WCF_N . "_acp_session_log", 'sessionLogID');
}
// format request uri
$requestURI = WCF::getSession()->requestURI;
// remove directories
$URIComponents = explode('/', $requestURI);
$requestURI = array_pop($URIComponents);
// remove session url
$requestURI = preg_replace('/(?:\\?|&)s=[a-f0-9]{40}/', '', $requestURI);
// save access
$sql = "INSERT INTO\twcf" . WCF_N . "_acp_session_access_log\n\t\t\t\t\t\t(sessionLogID, packageID, ipAddress, time, requestURI, requestMethod, className)\n\t\t\t\tVALUES\t\t(" . $sessionLogID . ", " . PACKAGE_ID . ", '" . escapeString(WCF::getSession()->ipAddress) . "', " . TIME_NOW . ", '" . escapeString($requestURI) . "', '" . escapeString(WCF::getSession()->requestMethod) . "', '" . escapeString(get_class($eventObj)) . "')";
WCF::getDB()->registerShutdownUpdate($sql);
}
}
示例2: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
list($cache, $packageID, $languageIDs) = explode('-', $cacheResource['cache']);
$data = array();
// get all taggable types
$sql = "SELECT\t\ttaggable.taggableID, taggable.name\n\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency package_dependency,\n\t\t\t\t\twcf" . WCF_N . "_tag_taggable taggable\n\t\t\tWHERE \t\ttaggable.packageID = package_dependency.dependency\n\t\t\t\t\tAND package_dependency.packageID = " . $packageID . "\n\t\t\tORDER BY\tpackage_dependency.priority";
$result = WCF::getDB()->sendQuery($sql);
$itemIDs = array();
while ($row = WCF::getDB()->fetchArray($result)) {
$itemIDs[$row['name']] = $row['taggableID'];
}
if (count($itemIDs) > 0) {
// get tag ids
$tagIDs = array();
$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\tWHERE \t\tobject.taggableID IN (" . implode(',', $itemIDs) . ")\n\t\t\t\t\t\tAND object.languageID IN (" . $languageIDs . ")\n\t\t\t\tGROUP BY \tobject.tagID\n\t\t\t\tORDER BY \tcounter DESC";
$result = WCF::getDB()->sendQuery($sql, 500);
while ($row = WCF::getDB()->fetchArray($result)) {
$tagIDs[$row['tagID']] = $row['counter'];
}
// get tags
if (count($tagIDs)) {
$sql = "SELECT\t\tname, tagID\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_tag\n\t\t\t\t\tWHERE\t\ttagID IN (" . implode(',', array_keys($tagIDs)) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['counter'] = $tagIDs[$row['tagID']];
$this->tags[StringUtil::toLowerCase($row['name'])] = new Tag(null, $row);
}
// sort by counter
uasort($this->tags, array('self', 'compareTags'));
$data = $this->tags;
}
}
return $data;
}
示例3: countItems
/**
* @see MultipleLinkPage::countItems()
*/
public function countItems()
{
parent::countItems();
$sql = "SELECT\t\tCOUNT(*) AS count\n\t\t\tFROM \t\twcf" . WCF_N . "_user\n\t\t\tWHERE\t\tuserID IN (\n\t\t\t\t\t\tSELECT\tuserID\n\t\t\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\t\t\tWHERE\tgroupID = " . $this->groupID . "\n\t\t\t\t\t)";
$result = WCF::getDB()->getFirstRow($sql);
return $result['count'];
}
示例4: execute
/**
* @see Cronjob::execute()
*/
public function execute($data)
{
$sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_group\n\t\t\tWHERE\tneededAge <> 0\n\t\t\t\tOR neededPoints <> 0";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$userIDArray = array();
if ($row['neededAge'] > 0) {
$sql = "SELECT\tuserID\n\t\t\t\t\tFROM\twcf" . WCF_N . "_user\n\t\t\t\t\tWHERE\tregistrationDate <= " . (TIME_NOW - 86400 * $row['neededAge']) . "\n\t\t\t\t\t\tAND userID NOT IN (\n\t\t\t\t\t\t\tSELECT\tuserID\n\t\t\t\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\t\t\t\tWHERE\tgroupID = " . $row['groupID'] . "\n\t\t\t\t\t\t)";
$result2 = WCF::getDB()->sendQuery($sql);
while ($row2 = WCF::getDB()->fetchArray($result2)) {
$userIDArray[] = $row2['userID'];
}
}
if ($row['neededPoints'] > 0) {
$sql = "SELECT\tuserID\n\t\t\t\t\tFROM\twcf" . WCF_N . "_user\n\t\t\t\t\tWHERE\tactivityPoints >= " . $row['neededPoints'] . "\n\t\t\t\t\t\tAND userID NOT IN (\n\t\t\t\t\t\t\tSELECT\tuserID\n\t\t\t\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\t\t\t\tWHERE\tgroupID = " . $row['groupID'] . "\n\t\t\t\t\t\t)";
$result2 = WCF::getDB()->sendQuery($sql);
while ($row2 = WCF::getDB()->fetchArray($result2)) {
$userIDArray[] = $row2['userID'];
}
}
if (count($userIDArray)) {
$userIDArray = array_unique($userIDArray);
// assign to group
$sql = "INSERT INTO\twcf" . WCF_N . "_user_to_groups\n\t\t\t\t\t\t\t(userID, groupID)\n\t\t\t\t\tSELECT\t\tuserID, " . $row['groupID'] . "\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user\n\t\t\t\t\tWHERE\t\tuserID IN (" . implode(',', $userIDArray) . ")";
WCF::getDB()->sendQuery($sql);
// reset sesions
Session::resetSessions($userIDArray);
}
}
}
示例5: countItems
/**
* @see MultipleLinkPage::countItems()
*/
public function countItems()
{
SortablePage::countItems();
$sql = "SELECT COUNT(DISTINCT cronjobID) AS count FROM wcf" . WCF_N . "_admin_tools_function_to_cronjob";
$row = WCF::getDB()->getFirstRow($sql);
return $row['count'];
}
示例6: execute
/**
* @see Action::execute()
*/
public function execute()
{
parent::execute();
WCF::getUser()->checkPermission('admin.user.canDeleteUser');
require_once WCF_DIR . 'lib/data/user/UserEditor.class.php';
require_once WCF_DIR . 'lib/data/user/group/Group.class.php';
if ($this->userID !== 0) {
$this->userIDs[] = $this->userID;
}
// active user can't delete himself
$activeUserID = WCF::getSession()->getUser()->userID;
$this->userIDs = array_diff($this->userIDs, array($activeUserID));
// check permission
if (count($this->userIDs) > 0) {
$sql = "SELECT\tDISTINCT groupID\n\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\tWHERE\tuserID IN (" . implode(',', $this->userIDs) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
if (!Group::isAccessibleGroup($row['groupID'])) {
throw new PermissionDeniedException();
}
}
}
$deletedUsers = UserEditor::deleteUsers($this->userIDs);
$this->executed();
if (!empty($this->url) && (strpos($this->url, 'searchID=0') !== false || strpos($this->url, 'searchID=') === false)) {
HeaderUtil::redirect($this->url);
} else {
HeaderUtil::redirect('index.php?form=UserSearch&deletedUsers=' . $deletedUsers . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
}
exit;
}
示例7: execute
/**
* @see Action::execute()
*/
public function execute()
{
parent::execute();
// count board
$sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_board";
$row = WCF::getDB()->getFirstRow($sql);
$count = $row['count'];
// get board ids
$boardIDs = '';
$sql = "SELECT\t\tboardID\n\t\t\tFROM\t\twbb" . WBB_N . "_board\n\t\t\tORDER BY\tboardID";
$result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
while ($row = WCF::getDB()->fetchArray($result)) {
$boardIDs .= ',' . $row['boardID'];
// update last post
$board = new BoardEditor($row['boardID']);
$board->setLastPosts();
}
if (empty($boardIDs)) {
// clear board cache
WCF::getCache()->clear(WBB_DIR . 'cache', 'cache.boardData.php');
$this->calcProgress();
$this->finish();
}
// update boards
$sql = "UPDATE\twbb" . WBB_N . "_board board\n\t\t\tSET\tthreads = (\n\t\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\tWHERE\tboardID = board.boardID\n\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t),\n\t\t\t\tposts = (\n\t\t\t\t\tSELECT\tIFNULL(SUM(replies), 0) + COUNT(*)\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread thread\n\t\t\t\t\tWHERE\tboardID = board.boardID\n\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t)\n\t\t\tWHERE\tboard.boardID IN (0" . $boardIDs . ")";
WCF::getDB()->sendQuery($sql);
$this->executed();
$this->calcProgress($this->limit * $this->loop, $count);
$this->nextLoop();
}
示例8: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
$sql = "SELECT *\r\n\t\t\t\tFROM ugml_stat_type\r\n\t\t\t\tGROUP BY ugml_stat_type.statTypeID";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$sql = "SELECT DISTINCT `time`\r\n\t\t\t\t\tFROM ugml_stat_entry_archive\r\n\t\t\t\t\tWHERE statTypeID = " . $row['statTypeID'];
$result2 = WCF::getDB()->sendQuery($sql);
while ($row2 = WCF::getDB()->fetchArray($result2)) {
$row['times'][] = $row2['time'];
}
// range
$sql = "SELECT MAX(rank)\r\n\t\t\t\t\t\tAS max\r\n\t\t\t\t\tFROM ugml_stat_entry\r\n\t\t\t\t\tWHERE statTypeID = " . $row['statTypeID'];
$row += WCF::getDB()->getFirstRow($sql);
$this->data[$row['statTypeID']] = $row;
}
$this->data = array('byStatTypeID' => $this->data, 'byTypeName' => array());
foreach ($this->data['byStatTypeID'] as $statTypeID => $row) {
$name = StringUtil::firstCharToUpperCase($row['type']) . StringUtil::firstCharToUpperCase($row['name']);
$this->data['byTypeName'][$name] = $row;
}
// get the names and the types
$sql = "SELECT GROUP_CONCAT(DISTINCT type)\r\n\t\t\t\t\t\t\tAS types,\r\n\t\t\t\t\t\tGROUP_CONCAT(DISTINCT name)\r\n\t\t\t\t\t\t\tAS names\r\n\t\t\t\tFROM ugml_stat_type\r\n\t\t\t\tGROUP BY NULL";
$row = WCF::getDB()->getFirstRow($sql);
$this->data['types'] = explode(',', $row['types']);
$this->data['names'] = explode(',', $row['names']);
return $this->data;
}
示例9: readPageMenuItems
/**
* Gets page menu items.
*/
protected function readPageMenuItems()
{
$headerPosition = $footerPosition = 1;
$sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_page_menu_item\n\t\t\tWHERE\t\tpackageID IN (\n\t\t\t\t\t\tSELECT\tdependency\n\t\t\t\t\t\tFROM\twcf" . WCF_N . "_package_dependency\n\t\t\t\t\t\tWHERE\tpackageID = " . PACKAGE_ID . "\n\t\t\t\t\t)\n\t\t\tORDER BY\tshowOrder";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$hasEnabledOption = true;
// check the options of this item
if (!empty($row['options'])) {
$hasEnabledOption = false;
$options = explode(',', strtoupper($row['options']));
foreach ($options as $option) {
if (defined($option) && constant($option)) {
$hasEnabledOption = true;
break;
}
}
}
if (!$hasEnabledOption) {
continue;
}
if ($row['menuPosition'] == 'header') {
$row['showOrder'] = $headerPosition;
$this->headerMenuItemList[$row['menuItemID']] = new PageMenuItem(null, $row);
$headerPosition++;
} else {
$row['showOrder'] = $footerPosition;
$this->footerMenuItemList[$row['menuItemID']] = new PageMenuItem(null, $row);
$footerPosition++;
}
}
}
示例10: save
/**
* @see Form::save()
*/
public function save()
{
parent::save();
// send content type
header('Content-Type: text/' . $this->fileType . '; charset=' . CHARSET);
header('Content-Disposition: attachment; filename="export.' . $this->fileType . '"');
if ($this->fileType == 'xml') {
echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<addresses>\n";
}
// get users
$sql = "SELECT\t\temail\n\t\t\tFROM\t\twcf" . WCF_N . "_user\n\t\t\tWHERE\t\tuserID IN (" . $this->userIDs . ")\n\t\t\tORDER BY\temail";
$result = WCF::getDB()->sendQuery($sql);
$i = 0;
$j = WCF::getDB()->countRows($result) - 1;
while ($row = WCF::getDB()->fetchArray($result)) {
if ($this->fileType == 'xml') {
echo "<address><![CDATA[" . StringUtil::escapeCDATA($row['email']) . "]]></address>\n";
} else {
echo $this->textSeparator . $row['email'] . $this->textSeparator . ($i < $j ? $this->separator : '');
}
$i++;
}
if ($this->fileType == 'xml') {
echo "</addresses>";
}
UserEditor::unmarkAll();
$this->saved();
exit;
}
示例11: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
list($cache, $packageID) = explode('-', $cacheResource['cache']);
$data = array('actions' => array('user' => array(), 'admin' => array()), 'inheritedActions' => array('user' => array(), 'admin' => array()));
// get all listeners and filter options with low priority
$sql = "SELECT\t\tlistener.*, package.packageDir\n\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency package_dependency,\n\t\t\t\t\twcf" . WCF_N . "_event_listener listener\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\tON\t\t(package.packageID = listener.packageID)\n\t\t\tWHERE \t\tlistener.packageID = package_dependency.dependency\n\t\t\t\t\tAND package_dependency.packageID = " . $packageID . "\n\t\t\tORDER BY\tpackage_dependency.priority";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['listenerClassName'] = StringUtil::getClassName($row['listenerClassFile']);
// distinguish between inherited actions and non-inherited actions
if (!$row['inherit']) {
$data['actions'][$row['environment']][EventHandler::generateKey($row['eventClassName'], $row['eventName'])][] = $row;
} else {
if (!isset($data['inheritedActions'][$row['environment']][$row['eventClassName']])) {
$data['inheritedActions'][$row['eventClassName']] = array();
}
$data['inheritedActions'][$row['environment']][$row['eventClassName']][$row['eventName']][] = $row;
}
}
// sort data by class name
foreach ($data['actions'] as $environment => $listenerMap) {
foreach ($listenerMap as $key => $listeners) {
uasort($data['actions'][$environment][$key], array('CacheBuilderEventListener', 'sortListeners'));
}
}
foreach ($data['inheritedActions'] as $environment => $listenerMap) {
foreach ($listenerMap as $class => $listeners) {
foreach ($listeners as $key => $val) {
uasort($data['inheritedActions'][$environment][$class][$key], array('CacheBuilderEventListener', 'sortListeners'));
}
}
}
return $data;
}
示例12: updateRatings
/**
* updates scores
* @param array $data
*/
public static function updateRatings($solutionID, $userID, $data)
{
foreach ($data as $optionID => $score) {
$sql = "INSERT INTO\twcf" . WCF_N . "_contest_solution_rating\n\t\t\t\t\t\t(solutionID, userID, optionID, score, time)\n\t\t\t\tVALUES\t\t(" . intval($solutionID) . ", " . intval($userID) . ", " . intval($optionID) . ", " . intval($score) . ", " . TIME_NOW . ")\n\t\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\t\t\tscore = " . intval($score) . ",\n\t\t\t\t\t\ttime = " . TIME_NOW;
WCF::getDB()->sendQuery($sql);
}
}
示例13: getData
/**
* @see CacheBuilder::getData()
*/
public function getData($cacheResource)
{
$data = array('boards' => array(), 'boardStructure' => array(), 'moderators' => array());
// boards
$sql = "SELECT\t*\n\t\t\tFROM \twbb" . WBB_N . "_board";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$data['boards'][$row['boardID']] = new Board(null, $row);
}
// board structure
$sql = "SELECT\t\t*\n\t\t\tFROM \t\twbb" . WBB_N . "_board_structure\n\t\t\tORDER BY \tparentID ASC, position ASC";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$data['boardStructure'][$row['parentID']][] = $row['boardID'];
}
// board moderators
$sql = "SELECT \t\tuser.username, wcf_group.groupName,\n\t\t\t\t\tmoderator.*, IFNULL(user.username, wcf_group.groupName) AS name\n\t\t\tFROM \t\twbb" . WBB_N . "_board_moderator moderator\n\t\t\tLEFT JOIN \twcf" . WCF_N . "_user user\n\t\t\tON\t\t(user.userID = moderator.userID)\n\t\t\tLEFT JOIN \twcf" . WCF_N . "_group wcf_group\n\t\t\tON \t\t(wcf_group.groupID = moderator.groupID)\n\t\t\tORDER BY \tboardID,\n\t\t\t\t\tname";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
if (empty($row['name'])) {
continue;
}
if ($row['userID'] != 0) {
$object = new User(null, $row);
$key = 'u' . $row['userID'];
} else {
$object = new Group(null, $row);
$key = 'g' . $row['groupID'];
}
$data['moderators'][$row['boardID']][$key] = $object;
}
return $data;
}
示例14: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
$um = WCF::getTPL()->get('userMessages');
if ($um && preg_match('/page=UserGuestbook/', $um)) {
return;
}
if (WCF::getUser()->userID) {
$userID = WCF::getUser()->userID;
}
if (!empty($userID)) {
$ret = WCF::getTPL()->get('userMessages');
require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
$user = new UserProfile($userID, null, null, null);
if ($user->userGuestbook_sendInfo) {
$sql = "SELECT gbh.userLastVisit, gbh.newEntries, gbh.lastEntryUserID, gbh.lastEntry, u.username" . "\n FROM wcf" . WCF_N . "_user_guestbook_header gbh" . "\n LEFT JOIN wcf" . WCF_N . "_user u ON (u.userID = gbh.lastEntryUserID)" . "\n WHERE gbh.userID = " . $userID . "\n AND gbh.userID != gbh.lastEntryUserID";
$row = WCF::getDB()->getFirstRow($sql);
if (!empty($row['newEntries']) && !empty($row['lastEntry']) && $row['lastEntry'] > $row['userLastVisit']) {
if ($row['newEntries'] != 1) {
$msg = WCF::getLanguage()->get('wcf.user.guestbook.infoMessages', array('$newEntries' => $row['newEntries']));
} else {
$msg = WCF::getLanguage()->get('wcf.user.guestbook.infoMessage', array('$username' => $row['username']));
}
WCF::getTPL()->append('userMessages', '<p class="info"><a href="index.php?page=UserGuestbook&userID=' . $userID . SID_ARG_2ND . '">' . $msg . '</a></p>');
}
}
}
}
示例15: execute
/**
* @see Action::execute()
*/
public function execute()
{
parent::execute();
// count posts
$sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_post";
$row = WCF::getDB()->getFirstRow($sql);
$count = $row['count'];
// get postids
$postIDs = '';
$sql = "SELECT\t\tpostID\n\t\t\tFROM\t\twbb" . WBB_N . "_post\n\t\t\tORDER BY\tpostID";
$result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
while ($row = WCF::getDB()->fetchArray($result)) {
$postIDs .= ',' . $row['postID'];
}
if (empty($postIDs)) {
$this->calcProgress();
$this->finish();
}
// update posts
$sql = "UPDATE\twbb" . WBB_N . "_post post\n\t\t\tSET\tattachments = IFNULL((\n\t\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\t\tFROM\twcf" . WCF_N . "_attachment attachment\n\t\t\t\t\tWHERE\tattachment.packageID = " . PACKAGE_ID . "\n\t\t\t\t\t\tAND attachment.containerID = post.postID\n\t\t\t\t\t\tAND attachment.containerType = 'post'\n\t\t\t\t), 0)\n\t\t\tWHERE\tpost.postID IN (0" . $postIDs . ")";
WCF::getDB()->sendQuery($sql);
$this->executed();
$this->calcProgress($this->limit * $this->loop, $count);
$this->nextLoop();
}