use wcf\system\WCF;
$tableNames = WCF::getDB()->getEditor()->getTableNames();
-if (!\in_array('wcf' . WCF_N . '_spider', $tableNames)) {
+if (!\in_array('wcf1_spider', $tableNames)) {
// The table `wcf1_spider` will be removed by a database PIP that is
// executed after this script.
return;
{
// get domain path
$sql = "SELECT *
- FROM wcf" . WCF_N . "_application
+ FROM wcf1_application
WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([1]);
/** @var Application $application */
parent::execute();
$this->ipAddresses = [
- 'com.woltlab.blog' => ['blog' . WCF_N . '_entry '],
- 'com.woltlab.calendar' => ['calendar' . WCF_N . '_event'],
+ 'com.woltlab.blog' => ['blog1_entry '],
+ 'com.woltlab.calendar' => ['calendar1_event'],
'com.woltlab.filebase' => [
- 'filebase' . WCF_N . '_file',
+ 'filebase1_file',
],
'com.woltlab.gallery' => [],
// intentionally left empty, the image table is queried manually
- 'com.woltlab.wbb' => ['wbb' . WCF_N . '_post'],
- 'com.woltlab.wcf.conversation' => ['wcf' . WCF_N . '_conversation_message'],
+ 'com.woltlab.wbb' => ['wbb1_post'],
+ 'com.woltlab.wcf.conversation' => ['wcf1_conversation_message'],
];
// content
'userOptions' => [],
'ipAddresses' => [],
'paidSubscriptionTransactionLog' => $this->dumpTable(
- 'wcf' . WCF_N . '_paid_subscription_transaction_log',
+ 'wcf1_paid_subscription_transaction_log',
'userID'
),
],
if ($package === 'com.woltlab.filebase') {
$ipAddresses = \array_merge(
$ipAddresses,
- $this->exportIpAddresses('filebase' . WCF_N . '_file_version', 'ipAddress', 'uploadTime', 'userID')
+ $this->exportIpAddresses('filebase1_file_version', 'ipAddress', 'uploadTime', 'userID')
);
} elseif ($package === 'com.woltlab.gallery') {
$ipAddresses = \array_merge(
$ipAddresses,
- $this->exportIpAddresses('gallery' . WCF_N . '_image', 'ipAddress', 'uploadTime', 'userID')
+ $this->exportIpAddresses('gallery1_image', 'ipAddress', 'uploadTime', 'userID')
);
}
FROM {$databaseTable}
WHERE {$userIDColumn} = ?
AND {$ipAddressColumn} <> ''";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->user->userID]);
return $this->fetchIpAddresses($statement, $ipAddressColumn, $timeColumn);
$sql = "SELECT *
FROM {$tableName}
WHERE {$userIDColumn} = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->user->userID]);
$data = [];
];
$data['session'] = $this->exportIpAddresses(
- 'wcf' . WCF_N . '_user_session',
+ 'wcf1_user_session',
'ipAddress',
'lastActivityTime',
'userID'
// we can ignore the wcfN_acp_session_access_log table because it is directly related
// to the wcfN_acp_session_log table and ACP sessions are bound to the ip address
$data['acpSessionLog'] = $this->exportIpAddresses(
- 'wcf' . WCF_N . '_acp_session_log',
+ 'wcf1_acp_session_log',
'ipAddress',
'lastActivityTime',
'userID'
switch ($this->mode) {
case 'banned':
$sql = "SELECT user_table.userID
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value option_value
ON option_value.userID = user_table.userID
WHERE banned = ?";
- $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
+ $statement = WCF::getDB()->prepare($sql, $this->maxResults);
$statement->execute([1]);
$this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN);
break;
$this->sortField = 'registrationDate';
$this->sortOrder = 'DESC';
$sql = "SELECT user_table.userID
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value option_value
ON option_value.userID = user_table.userID
ORDER BY user_table.registrationDate DESC";
- $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
+ $statement = WCF::getDB()->prepare($sql, $this->maxResults);
$statement->execute();
$this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN);
break;
$this->sortField = 'registrationDate';
$this->sortOrder = 'DESC';
$sql = "SELECT user_table.userID
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value option_value
ON option_value.userID = user_table.userID
WHERE activationCode <> ?
ORDER BY user_table.registrationDate DESC";
- $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
+ $statement = WCF::getDB()->prepare($sql, $this->maxResults);
$statement->execute([0]);
$this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN);
break;
$this->sortField = 'registrationDate';
$this->sortOrder = 'DESC';
$sql = "SELECT user_table.userID
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value option_value
ON option_value.userID = user_table.userID
" . $conditionBuilder . "
ORDER BY user_table.registrationDate DESC";
- $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
+ $statement = WCF::getDB()->prepare($sql, $this->maxResults);
$statement->execute($conditionBuilder->getParameters());
$this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN);
break;
case 'disabledAvatars':
$sql = "SELECT user_table.userID
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value option_value
ON option_value.userID = user_table.userID
WHERE disableAvatar = ?";
- $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
+ $statement = WCF::getDB()->prepare($sql, $this->maxResults);
$statement->execute([1]);
$this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN);
break;
case 'disabledSignatures':
$sql = "SELECT user_table.userID
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value option_value
ON option_value.userID = user_table.userID
WHERE disableSignature = ?";
- $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
+ $statement = WCF::getDB()->prepare($sql, $this->maxResults);
$statement->execute([1]);
$this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN);
break;
parent::save();
if (!ENABLE_ENTERPRISE_MODE || WCF::getUser()->hasOwnerAccess()) {
- $sql = "UPDATE wcf" . WCF_N . "_application
+ $sql = "UPDATE wcf1_application
SET domainName = ?,
cookieDomain = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->domainName,
$this->cookieDomain,
]);
}
- $sql = "UPDATE wcf" . WCF_N . "_application
+ $sql = "UPDATE wcf1_application
SET landingPageID = ?
WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($this->landingPageID as $packageID => $landingPageID) {
$statement->execute([
$landingPageID ?: null,
$this->objectAction->executeAction();
// clear existing attributes
- $sql = "DELETE FROM wcf" . WCF_N . "_bbcode_attribute
+ $sql = "DELETE FROM wcf1_bbcode_attribute
WHERE bbcodeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->bbcodeID]);
foreach ($this->attributes as $attribute) {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('pageID IN (?)', [$this->pageIDs]);
$sql = "SELECT pageID
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$this->pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
if (empty($_POST)) {
if (!$this->exporterName) {
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_import_mapping";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_import_mapping";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
if ($statement->fetchSingleColumn()) {
// remove old relations
if ($groupID !== null) {
- $sql = "DELETE FROM wcf" . WCF_N . "_label_group_to_object
+ $sql = "DELETE FROM wcf1_label_group_to_object
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$groupID]);
}
// insert new relations
if (!empty($this->objectTypes)) {
- $sql = "INSERT INTO wcf" . WCF_N . "_label_group_to_object
+ $sql = "INSERT INTO wcf1_label_group_to_object
(groupID, objectTypeID, objectID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($this->objectTypes as $objectTypeID => $data) {
foreach ($data as $objectID) {
if (empty($_POST)) {
// read database values
$sql = "SELECT objectTypeID, objectID
- FROM wcf" . WCF_N . "_label_group_to_object
+ FROM wcf1_label_group_to_object
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->groupID]);
$data = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('pageID IN (?)', [$this->pageIDs]);
$sql = "SELECT pageID
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$this->pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
);
if ($this->resetIsDismissed) {
- $sql = "DELETE FROM wcf" . WCF_N . "_notice_dismissed
+ $sql = "DELETE FROM wcf1_notice_dismissed
WHERE noticeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->notice->noticeID,
]);
if ($this->applyChangesToExistingUsers) {
if (!$preset) {
- $sql = "DELETE FROM wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "DELETE FROM wcf1_user_notification_event_to_user
WHERE eventID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$event->eventID]);
} else {
- $sql = "REPLACE INTO wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "REPLACE INTO wcf1_user_notification_event_to_user
(userID, eventID, mailNotificationType)
SELECT userID, ?, ?
- FROM wcf" . WCF_N . "_user";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$event->eventID, $presetMailNotificationType]);
}
}
}
$sql = "SELECT MAX(showOrder)
- FROM wcf" . WCF_N . "_menu_item
+ FROM wcf1_menu_item
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$maxShowOrder = $statement->fetchSingleColumn() ?? 0;
$conditionBuilder->add('smileyID <> ?', [$this->smiley->smileyID]);
}
$sql = "SELECT smileyCode, aliases
- FROM wcf" . WCF_N . "_smiley
+ FROM wcf1_smiley
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$aliases = \explode("\n", $this->aliases);
// get available variables
$sql = "SELECT variableName
- FROM wcf" . WCF_N . "_style_variable";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_style_variable";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$variables = $statement->fetchAll(\PDO::FETCH_COLUMN);
protected function readStyleVariables()
{
$sql = "SELECT variableName, defaultValue
- FROM wcf" . WCF_N . "_style_variable";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_style_variable";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$this->variables = $statement->fetchMap('variableName', 'defaultValue');
}
if ($this->tagObj->synonymFor === null) {
// remove synonyms first
- $sql = "UPDATE wcf" . WCF_N . "_tag
+ $sql = "UPDATE wcf1_tag
SET synonymFor = ?
WHERE synonymFor = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
null,
$this->tagID,
}
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_template
+ FROM wcf1_template
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
if ($statement->fetchSingleColumn()) {
$parameters['data']['application'] = $this->copiedTemplate->application;
} else {
$sql = "SELECT packageID
- FROM wcf" . WCF_N . "_template
+ FROM wcf1_template
WHERE templateName = ?
AND templateGroupID IS NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$parameters['data']['templateName']
]);
}
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
WHERE templateGroupName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->templateGroupName]);
if ($statement->fetchSingleColumn()) {
}
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
WHERE templateGroupFolderName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->templateGroupFolderName]);
if ($statement->fetchSingleColumn()) {
// reset special trophies, if trophy is disabled
if ($this->isDisabled) {
- $sql = "DELETE FROM wcf" . WCF_N . "_user_special_trophy
+ $sql = "DELETE FROM wcf1_user_special_trophy
WHERE trophyID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->trophyID]);
UserStorageHandler::getInstance()->resetAll('specialTrophies');
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('trophyID = ?', [$this->trophyID]);
$sql = "SELECT COUNT(*) as count, userID
- FROM wcf" . WCF_N . "_user_trophy
+ FROM wcf1_user_trophy
" . $conditionBuilder . "
GROUP BY userID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
$conditions->add("groupType NOT IN (?)", [[UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS]]);
$sql = "SELECT groupID
- FROM wcf" . WCF_N . "_user_group
+ FROM wcf1_user_group
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$this->groupIDs = [];
while ($row = $statement->fetchArray()) {
$conditions->add("userID IN (?)", [$this->userIDs]);
$sql = "SELECT userID, groupID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$groups = $statement->fetchMap('userID', 'groupID', false);
}
// remove assignments
- $sql = "DELETE FROM wcf" . WCF_N . "_moderation_queue_to_user
+ $sql = "DELETE FROM wcf1_moderation_queue_to_user
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->user->userID]);
// reset moderation count
// count users
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$count = $statement->fetchSingleColumn();
// get users
$sql = "SELECT email
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
" . $conditions . "
ORDER BY email";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$i = 0;
$conditions->add("optionID = ?", [$this->userGroupOption->optionID]);
$sql = "SELECT groupID, optionValue
- FROM wcf" . WCF_N . "_user_group_option_value
+ FROM wcf1_user_group_option_value
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$this->values = $statement->fetchMap('groupID', 'optionValue');
}
// poll_option_vote
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_poll_option_vote
+ $sql = "UPDATE IGNORE wcf1_poll_option_vote
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// comment
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_comment
+ $sql = "UPDATE wcf1_comment
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// comment_response
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_comment_response
+ $sql = "UPDATE wcf1_comment_response
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// profile comments
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("objectTypeID = ?", [$objectType->objectTypeID]);
$conditions->add("objectID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_comment
+ $sql = "UPDATE wcf1_comment
SET objectID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// like (userID)
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_like
+ $sql = "UPDATE IGNORE wcf1_like
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// like (objectUserID)
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("objectUserID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_like
+ $sql = "UPDATE wcf1_like
SET objectUserID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// like_object
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("objectUserID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_like_object
+ $sql = "UPDATE wcf1_like_object
SET objectUserID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// user_follow (userID)
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
$conditions->add("followUserID <> ?", [$this->destinationUserID]);
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_user_follow
+ $sql = "UPDATE IGNORE wcf1_user_follow
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// user_follow (followUserID)
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("followUserID IN (?)", [$this->mergedUserIDs]);
$conditions->add("userID <> ?", [$this->destinationUserID]);
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_user_follow
+ $sql = "UPDATE IGNORE wcf1_user_follow
SET followUserID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// user_ignore (userID)
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
$conditions->add("ignoreUserID <> ?", [$this->destinationUserID]);
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_user_ignore
+ $sql = "UPDATE IGNORE wcf1_user_ignore
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// user_ignore (ignoreUserID)
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("ignoreUserID IN (?)", [$this->mergedUserIDs]);
$conditions->add("userID <> ?", [$this->destinationUserID]);
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_user_ignore
+ $sql = "UPDATE IGNORE wcf1_user_ignore
SET ignoreUserID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// user_object_watch
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_user_object_watch
+ $sql = "UPDATE IGNORE wcf1_user_object_watch
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// user_activity_event
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_user_activity_event
+ $sql = "UPDATE wcf1_user_activity_event
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// attachments
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_attachment
+ $sql = "UPDATE wcf1_attachment
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// modification_log
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_modification_log
+ $sql = "UPDATE wcf1_modification_log
SET userID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// user notifications
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("authorID IN (?)", [$this->mergedUserIDs]);
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_user_notification_author
+ $sql = "UPDATE IGNORE wcf1_user_notification_author
SET authorID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters()));
// delete merged users
throw new UserInputException('categoryName');
}
$sql = "SELECT categoryID
- FROM wcf" . WCF_N . "_user_option_category
+ FROM wcf1_user_option_category
WHERE categoryName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->categoryName]);
if ($statement->fetchArray() === false) {
throw new UserInputException('categoryName');
// get changed options
$sql = "SELECT optionID, defaultValue
- FROM wcf" . WCF_N . "_user_option
+ FROM wcf1_user_option
WHERE optionID IN (?" . \str_repeat(', ?', \count($optionIDs) - 1) . ")";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($optionIDs);
$optionIDs = $optionValues = [];
while ($row = $statement->fetchArray()) {
}
if (!empty($optionIDs)) {
- $sql = "UPDATE wcf" . WCF_N . "_user_option_value
+ $sql = "UPDATE wcf1_user_option_value
SET userOption" . \implode(' = ?, userOption', $optionIDs) . " = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge($optionValues));
}
}
// save values
- $sql = "UPDATE wcf" . WCF_N . "_user_option
+ $sql = "UPDATE wcf1_user_option
SET defaultValue = ?
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($saveOptions as $optionID => $value) {
$statement->execute([$value, $optionID]);
}
{
$this->userList = new UserList();
$this->userList->sqlConditionJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID";
$this->userList->sqlLimit = $this->maxResults;
$this->objectList->getConditionBuilder()->add(
'article.articleID IN (
SELECT articleID
- FROM wcf' . WCF_N . '_article_content
+ FROM wcf1_article_content
WHERE title LIKE ?
)',
['%' . $this->title . '%']
$this->objectList->getConditionBuilder()->add(
'article.articleID IN (
SELECT articleID
- FROM wcf' . WCF_N . '_article_content
+ FROM wcf1_article_content
WHERE content LIKE ?
)',
['%' . $this->content . '%']
$this->objectList->sqlSelects = "(
SELECT title
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleID = article.articleID
AND (
languageID IS NULL
$this->objectList->getConditionBuilder()->add(
'box.boxID IN (
SELECT boxID
- FROM wcf' . WCF_N . '_box_content
+ FROM wcf1_box_content
WHERE title LIKE ?
)',
['%' . $this->title . '%']
$this->objectList->getConditionBuilder()->add(
'box.boxID IN (
SELECT boxID
- FROM wcf' . WCF_N . '_box_content
+ FROM wcf1_box_content
WHERE content LIKE ?
)',
['%' . $this->content . '%']
$this->objectList->sqlSelects = "cronjob.*";
$this->objectList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_cronjob cronjob
+ LEFT JOIN wcf1_cronjob cronjob
ON cronjob.cronjobID = cronjob_log.cronjobID";
if ($this->cronjobID) {
$this->objectList->sqlSelects .= '(
SELECT COUNT(*)
- FROM wcf' . WCF_N . '_label
+ FROM wcf1_label
WHERE groupID = label_group.groupID
) AS labels';
$this->objectList->sqlSelects = "label_group.groupName, label_group.groupDescription";
$this->objectList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_label_group label_group
+ LEFT JOIN wcf1_label_group label_group
ON label_group.groupID = label.groupID";
if ($this->labelGroup) {
$this->objectList->getConditionBuilder()->add('label.groupID = ?', [$this->labelGroup->groupID]);
$this->objectList->sqlSelects = "(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user user
+ FROM wcf1_user user
WHERE languageID = language.languageID
) AS users, (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
WHERE languageID = language.languageID
) AS variables, (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
WHERE languageID = language.languageID
AND languageCustomItemValue IS NOT NULL
) AS customVariables";
// get installed packages
$sql = "SELECT package, packageVersion
- FROM wcf" . WCF_N . "_package";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_package";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$installedPackages = $statement->fetchMap('package', 'packageVersion');
// get excluded packages (of installed packages)
$excludedPackagesOfInstalledPackages = [];
$sql = "SELECT excludedPackage, excludedPackageVersion
- FROM wcf" . WCF_N . "_package_exclusion";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_package_exclusion";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
if (!isset($excludedPackagesOfInstalledPackages[$row['excludedPackage']])) {
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("packageUpdateID IN (?)", [\array_keys($packageUpdates)]);
$sql = "SELECT packageUpdateID, packageUpdateServerID, package
- FROM wcf" . WCF_N . "_package_update
+ FROM wcf1_package_update
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$possiblePackages = [];
while ($row = $statement->fetchArray()) {
$conditions->add("packageUpdateVersionID IN (?)", [$packageUpdateVersionIDs]);
$sql = "SELECT packageUpdateVersionID, packageUpdateID, packageVersion
- FROM wcf" . WCF_N . "_package_update_version
+ FROM wcf1_package_update_version
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$packageVersions = [];
while ($row = $statement->fetchArray()) {
$conditions->add(
"packageUpdateVersionID IN (
SELECT packageUpdateVersionID
- FROM wcf" . WCF_N . "_package_update_version
+ FROM wcf1_package_update_version
WHERE packageUpdateID = ?
)",
[$packageUpdateID]
);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_package_update_exclusion
+ FROM wcf1_package_update_exclusion
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$excludedPackages = [];
while ($row = $statement->fetchArray()) {
);
$sql = "SELECT pu.package, pu.packageUpdateServerID, puv.packageUpdateVersionID,
puv.packageUpdateID, puv.packageVersion, puv.isAccessible
- FROM wcf" . WCF_N . "_package_update_version puv
- LEFT JOIN wcf" . WCF_N . "_package_update pu
+ FROM wcf1_package_update_version puv
+ LEFT JOIN wcf1_package_update pu
ON pu.packageUpdateID = puv.packageUpdateID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$packageVersions = [];
while ($row = $statement->fetchArray()) {
// validate dependencies
foreach ($packageUpdates as $packageUpdateData) {
$sql = "SELECT package, minversion
- FROM wcf" . WCF_N . "_package_update_requirement
+ FROM wcf1_package_update_requirement
WHERE packageUpdateVersionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$packageUpdateData['accessible']]);
$requirements = [];
while ($row = $statement->fetchArray()) {
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("package IN (?)", [\array_keys($requirements)]);
$sql = "SELECT packageUpdateID, package
- FROM wcf" . WCF_N . "_package_update
+ FROM wcf1_package_update
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
if (!\in_array($row['package'], $openRequirements)) {
$this->objectList->sqlSelects .= '(
SELECT COUNT(*)
- FROM wcf' . WCF_N . '_menu_item
+ FROM wcf1_menu_item
WHERE menuID = menu.menuID
) AS items, (
SELECT position
- FROM wcf' . WCF_N . '_box
+ FROM wcf1_box
WHERE menuID = menu.menuID
) AS position, (
SELECT showOrder
- FROM wcf' . WCF_N . '_box
+ FROM wcf1_box
WHERE menuID = menu.menuID
) AS showOrder';
}
parent::readData();
$sql = "SELECT pluginStoreFileID
- FROM wcf" . WCF_N . "_package_update
+ FROM wcf1_package_update
WHERE package = ?
AND pluginStoreFileID <> 0";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->package->package]);
$this->pluginStoreFileID = \intval($statement->fetchSingleColumn());
}
$this->objectList->getConditionBuilder()->add(
'page.pageID IN (
SELECT pageID
- FROM wcf' . WCF_N . '_page_content
+ FROM wcf1_page_content
WHERE title LIKE ?
)',
['%' . $this->title . '%']
$this->objectList->getConditionBuilder()->add(
'page.pageID IN (
SELECT pageID
- FROM wcf' . WCF_N . '_page_content
+ FROM wcf1_page_content
WHERE content LIKE ?
)',
['%' . $this->content . '%']
$this->objectList->getConditionBuilder()->add(
'paid_subscription_transaction_log.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user
+ FROM wcf1_user
WHERE username LIKE ?
)',
['%' . $this->username . '%']
$this->objectList->sqlSelects = 'user_table.username, paid_subscription.title';
$this->objectList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = paid_subscription_transaction_log.userID
- LEFT JOIN wcf" . WCF_N . "_paid_subscription paid_subscription
+ LEFT JOIN wcf1_paid_subscription paid_subscription
ON paid_subscription.subscriptionID = paid_subscription_transaction_log.subscriptionID";
}
$this->objectList->getConditionBuilder()->add(
'paid_subscription_user.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user
+ FROM wcf1_user
WHERE username LIKE ?
)',
['%' . $this->username . '%']
$this->objectList->getConditionBuilder()->add('paid_subscription_user.isActive = ?', [1]);
$this->objectList->sqlSelects = 'user_table.username, paid_subscription.title';
$this->objectList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = paid_subscription_user.userID
- LEFT JOIN wcf" . WCF_N . "_paid_subscription paid_subscription
+ LEFT JOIN wcf1_paid_subscription paid_subscription
ON paid_subscription.subscriptionID = paid_subscription_user.subscriptionID";
}
$this->objectList->sqlSelects = "(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
WHERE styleID = style.styleID
) AS users";
}
];
public $foreignKeys = [
- 'wcf' . WCF_N . '_user' => [
+ 'wcf1_user' => [
'avatarID' => [
- 'referenceTable' => 'wcf' . WCF_N . '_user_avatar',
+ 'referenceTable' => 'wcf1_user_avatar',
'referenceColumn' => 'avatarID',
],
],
- 'wcf' . WCF_N . '_comment' => [
+ 'wcf1_comment' => [
'userID' => [
- 'referenceTable' => 'wcf' . WCF_N . '_user',
+ 'referenceTable' => 'wcf1_user',
'referenceColumn' => 'userID',
],
'objectTypeID' => [
- 'referenceTable' => 'wcf' . WCF_N . '_object_type',
+ 'referenceTable' => 'wcf1_object_type',
'referenceColumn' => 'objectTypeID',
],
],
- 'wcf' . WCF_N . '_moderation_queue' => [
+ 'wcf1_moderation_queue' => [
'objectTypeID' => [
- 'referenceTable' => 'wcf' . WCF_N . '_object_type',
+ 'referenceTable' => 'wcf1_object_type',
'referenceColumn' => 'objectTypeID',
],
'assignedUserID' => [
- 'referenceTable' => 'wcf' . WCF_N . '_user',
+ 'referenceTable' => 'wcf1_user',
'referenceColumn' => 'userID',
],
'userID' => [
- 'referenceTable' => 'wcf' . WCF_N . '_user',
+ 'referenceTable' => 'wcf1_user',
'referenceColumn' => 'userID',
],
],
// check for MySQL Native driver
$sql = "SELECT 1";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$this->results['mysql']['mysqlnd'] = ($statement->fetchSingleColumn() === 1);
// check innodb support
$sql = "SHOW ENGINES";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
if ($row['Engine'] == 'InnoDB' && \in_array($row['Support'], ['DEFAULT', 'YES'])) {
$sql = "SELECT COUNT(*)
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$this->results['mysql']['foreignKeys'] = $statement->fetchSingleColumn() == $expectedForeignKeyCount;
$sql = "SELECT @@innodb_buffer_pool_size";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$this->results['mysql']['bufferPool']['value'] = $statement->fetchSingleColumn();
if ($this->results['mysql']['bufferPool']['value'] > 134217728) {
$this->objectList->sqlSelects = "(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_tag_to_object t2o
+ FROM wcf1_tag_to_object t2o
WHERE t2o.tagID = tag.tagID
) AS usageCount";
$this->objectList->sqlSelects .= ", language.languageName, language.languageCode";
$this->objectList->sqlSelects .= ", synonym.name AS synonymName";
$this->objectList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_language language
+ LEFT JOIN wcf1_language language
ON tag.languageID = language.languageID
- LEFT JOIN wcf" . WCF_N . "_tag synonym
+ LEFT JOIN wcf1_tag synonym
ON tag.synonymFor = synonym.tagID";
if ($this->search !== '') {
$this->objectList->sqlSelects = "
(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_template
+ FROM wcf1_template
WHERE templateGroupID = template_group.templateGroupID
) AS templates,
(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_style
+ FROM wcf1_style
WHERE templateGroupID = template_group.templateGroupID
) AS styles";
}
}
$this->objectList->sqlSelects .= "(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
WHERE groupID = user_group.groupID
) AS members";
}
EventHandler::getInstance()->fireAction($this, 'countItems');
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user user_table
+ FROM wcf1_user user_table
" . $this->conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->conditions->getParameters());
return $statement->fetchSingleColumn();
{
// get user ids
$sql = "SELECT user_table.userID
- FROM wcf" . WCF_N . "_user user_table
+ FROM wcf1_user user_table
" . (isset($this->options[$this->sortField]) ? "
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
" : '') . "
" . $this->conditions . "
ORDER BY " . (($this->sortField != 'email' && isset($this->options[$this->sortField])) ? 'user_option_value.userOption' . $this->options[$this->sortField]->optionID : $this->sortField) . " " . $this->sortOrder;
- $statement = WCF::getDB()->prepareStatement(
+ $statement = WCF::getDB()->prepare(
$sql,
$this->itemsPerPage,
($this->pageNo - 1) * $this->itemsPerPage
$conditions->add("user_table.userID IN (?)", [$userIDs]);
$sql = "SELECT userID, groupID
- FROM wcf" . WCF_N . "_user_to_group user_table
+ FROM wcf1_user_to_group user_table
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$userToGroups = $statement->fetchMap('userID', 'groupID', false);
$sql = "SELECT user_avatar.*, option_value.*, user_table.*
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value option_value
ON option_value.userID = user_table.userID
- LEFT JOIN wcf" . WCF_N . "_user_avatar user_avatar
+ LEFT JOIN wcf1_user_avatar user_avatar
ON user_avatar.avatarID = user_table.avatarID
" . $conditions . "
ORDER BY " . (($this->sortField != 'email' && isset($this->options[$this->sortField])) ? 'option_value.userOption' . $this->options[$this->sortField]->optionID : 'user_table.' . $this->sortField) . " " . $this->sortOrder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$groupIDs = ($userToGroups[$row['userID']] ?? []);
{
// get user search from database
$sql = "SELECT searchData
- FROM wcf" . WCF_N . "_search
+ FROM wcf1_search
WHERE searchID = ?
AND userID = ?
AND searchType = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->searchID,
WCF::getUser()->userID,
$this->objectList->sqlSelects = "(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_option
+ FROM wcf1_user_option
WHERE categoryName = user_option_category.categoryName
) AS userOptions";
$this->objectList->getConditionBuilder()->add('user_option_category.parentCategoryName = ?', ['profile']);
$this->objectList->getConditionBuilder()->add(
"option_table.categoryName IN (
SELECT categoryName
- FROM wcf" . WCF_N . "_user_option_category
+ FROM wcf1_user_option_category
WHERE parentCategoryName = ?
)",
['profile']
$this->objectList->sqlSelects .= (!empty($this->objectList->sqlSelects) ? ', ' : '') . 'user_group.groupName';
$this->objectList->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_user_group user_group
+ LEFT JOIN wcf1_user_group user_group
ON user_group.groupID = user_rank.groupID';
}
}
{
parent::initObjectList();
- $this->objectList->sqlJoins .= ' LEFT JOIN wcf' . WCF_N . '_user users ON (users.userID = user_trophy.userID)';
+ $this->objectList->sqlJoins .= ' LEFT JOIN wcf1_user users ON (users.userID = user_trophy.userID)';
if ($this->trophyID) {
$this->objectList->getConditionBuilder()->add('user_trophy.trophyID = ?', [$this->trophyID]);
}
$this->objectList->getConditionBuilder()->add(
'user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user
+ FROM wcf1_user
WHERE username LIKE ?
)',
['%' . $this->username . '%']
$sql = "SELECT *
FROM " . $tableName . "
WHERE " . $indexName . " IN (" . \str_repeat('?,', \count($this->objectIDs) - 1) . "?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->objectIDs);
while ($object = $statement->fetchObject($baseClass)) {
$this->objects[] = new $this->className($object);
$sql = "SELECT *
FROM " . static::getDatabaseTableName() . "
WHERE " . static::getDatabaseTableIndexName() . " = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$id]);
$row = $statement->fetchArray();
$classParts = \explode('\\', $className);
if (static::$databaseTableName !== '') {
- return $classParts[0] . WCF_N . '_' . static::$databaseTableName;
+ return $classParts[0] . '1_' . static::$databaseTableName;
}
static $databaseTableNames = [];
if (!isset($databaseTableNames[$className])) {
- $databaseTableNames[$className] = $classParts[0] . WCF_N . '_' . \strtolower(\implode(
- '_',
- \preg_split(
- '~(?=[A-Z](?=[a-z]))~',
- \array_pop($classParts),
- -1,
- \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY
- )
- ));
+ $databaseTableNames[$className] = $classParts[0] . '1_' . \strtolower(
+ \implode(
+ '_',
+ \preg_split(
+ '~(?=[A-Z](?=[a-z]))~',
+ \array_pop($classParts),
+ -1,
+ \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY
+ )
+ )
+ );
}
return $databaseTableNames[$className];
$sql = "UPDATE " . static::getDatabaseTableName() . "
SET " . $updateSQL . "
WHERE " . static::getDatabaseTableIndexName() . " = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($statementParameters);
}
$sql = "UPDATE " . static::getDatabaseTableName() . "
SET " . $updateSQL . "
WHERE " . static::getDatabaseTableIndexName() . " = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($statementParameters);
}
$sql = "DELETE FROM " . static::getDatabaseTableName() . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$affectedCount += $statement->getAffectedRows();
}
FROM " . $this->getDatabaseTableName() . " " . $this->getDatabaseTableAlias() . "
" . $this->sqlConditionJoins . "
" . $this->getConditionBuilder();
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->getConditionBuilder()->getParameters());
return $statement->fetchSingleColumn();
" . $this->sqlConditionJoins . "
" . $this->getConditionBuilder() . "
" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
+ $statement = WCF::getDB()->prepare($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
$this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
" . $this->sqlJoins . "
WHERE " . $this->getDatabaseTableAlias() . "." . $this->getDatabaseTableIndexName() . " IN ({$objectIdPlaceholder})
" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->objectIDs);
$this->objects = $statement->fetchObjects(($this->objectClassName ?: $this->className));
} else {
" . $this->sqlJoins . "
" . $this->getConditionBuilder() . "
" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
+ $statement = WCF::getDB()->prepare($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
$this->objects = $statement->fetchObjects(($this->objectClassName ?: $this->className));
}
$this->sqlSelects .= (!empty($this->sqlSelects) ? ', ' : '') . "COALESCE(" . $matchTable . ".languageItemValue, " . $this->getDatabaseTableAlias() . "." . $key . ") AS " . $value;
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_language_item " . $matchTable . "
+ LEFT JOIN wcf1_language_item " . $matchTable . "
ON " . $matchTable . ".languageItem = " . $this->getDatabaseTableAlias() . "." . $key . "
AND " . $matchTable . ".languageID = " . $languageID;
}
$sql = "INSERT INTO " . static::getDatabaseTableName() . "
(" . $keys . ")
VALUES (" . $values . ")";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($statementParameters);
// return new object
}
} else {
$sql = "SELECT categoryID
- FROM wcf" . WCF_N . "_category
+ FROM wcf1_category
WHERE categoryID IN (
SELECT categoryID
FROM " . static::getCategoryMappingDatabaseTableName() . "
WHERE " . static::getDatabaseTableIndexName() . " = ?
)
ORDER BY parentCategoryID, showOrder";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->getObjectID()]);
while ($categoryID = $statement->fetchColumn()) {
/** @noinspection PhpUndefinedMethodInspection */
$sql = "SELECT *
FROM " . static::getDatabaseTableName() . "
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$userID]);
return $statement->fetchObject(static::class);
$sql = "DELETE FROM " . \call_user_func([static::$baseClass, 'getDatabaseTableName']) . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
{
if ($id !== null) {
$sql = "SELECT acp_session_log.*, user_table.username, 0 AS active
- FROM wcf" . WCF_N . "_acp_session_log acp_session_log
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ FROM wcf1_acp_session_log acp_session_log
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = acp_session_log.userID
WHERE acp_session_log.sessionLogID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$id]);
$row = $statement->fetchArray();
} elseif ($object !== null) {
0 AS active,
(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_acp_session_access_log
+ FROM wcf1_acp_session_access_log
WHERE sessionLogID = " . $this->getDatabaseTableAlias() . ".sessionLogID
) AS accesses";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = " . $this->getDatabaseTableAlias() . ".userID";
parent::readObjects();
*/
public function updatePosition()
{
- $sql = "UPDATE wcf" . WCF_N . "_ad
+ $sql = "UPDATE wcf1_ad
SET showOrder = ?
WHERE adID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$showOrder = $this->parameters['data']['offset'];
WCF::getDB()->beginTransaction();
public function setShowOrder($showOrder = 0)
{
$sql = "SELECT MAX(showOrder)
- FROM wcf" . WCF_N . "_ad
+ FROM wcf1_ad
WHERE objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->objectTypeID,
]);
$newShowOrder = $maxShowOrder + 1;
} else {
// shift other ads
- $sql = "UPDATE wcf" . WCF_N . "_ad
+ $sql = "UPDATE wcf1_ad
SET showOrder = showOrder + 1
WHERE objectTypeID = ?
AND showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->objectTypeID,
$showOrder,
$this->readObjects();
}
- $sql = "UPDATE wcf" . WCF_N . "_application
+ $sql = "UPDATE wcf1_application
SET cookieDomain = ?
WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
// calculate cookie domain
$regex = new Regex(':[0-9]+');
$this->articleContents = [];
$sql = "SELECT *
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->articleID]);
while ($row = $statement->fetchArray()) {
$this->articleContents[$row['languageID'] ?: 0] = new ArticleContent(null, $row);
if ($this->languageLinks === null) {
$this->languageLinks = [];
$sql = "SELECT articleContentID, title, languageID
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->articleID]);
while ($row = $statement->fetchArray()) {
$this->languageLinks[$row['languageID'] ?: 0] = new ArticleContent(null, $row);
// update author in recent activities
if (isset($this->parameters['data']['userID'])) {
- $sql = "UPDATE wcf" . WCF_N . "_user_activity_event
+ $sql = "UPDATE wcf1_user_activity_event
SET userID = ?
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($this->objects as $articleEditor) {
if ($articleEditor->userID != $this->parameters['data']['userID']) {
public function search()
{
$sql = "SELECT articleID
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE title LIKE ?
AND (
languageID = ?
OR languageID IS NULL
)
ORDER BY title";
- $statement = WCF::getDB()->prepareStatement($sql, 5);
+ $statement = WCF::getDB()->prepare($sql, 5);
$statement->execute([
'%' . $this->parameters['searchString'] . '%',
WCF::getLanguage()->languageID,
*/
public static function updateArticleCounter(array $users)
{
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET articles = articles + ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($users as $userID => $articles) {
$statement->execute([$articles, $userID]);
}
);
$this->getConditionBuilder()->add("article.articleID IN (
SELECT articleID
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleContentID IN ({$subselect['sql']})
)", $subselect['parameters']);
}
$conditionBuilder->add('(article.time > tracked_visit.visitTime OR tracked_visit.visitTime IS NULL)');
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_article article
- LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit
+ FROM wcf1_article article
+ LEFT JOIN wcf1_tracked_visit tracked_visit
ON tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.article') . "
AND tracked_visit.objectID = article.articleID
AND tracked_visit.userID = " . WCF::getUser()->userID . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
self::$unreadArticles = $statement->fetchSingleColumn();
}
$conditionBuilder->add('(article.time > tracked_visit.visitTime OR tracked_visit.visitTime IS NULL)');
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_article article
- LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit
+ FROM wcf1_article article
+ LEFT JOIN wcf1_tracked_visit tracked_visit
ON tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.article') . "
AND tracked_visit.objectID = article.articleID
AND tracked_visit.userID = " . WCF::getUser()->userID . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
return $statement->fetchSingleColumn();
$conditionBuilder->add('(article.time > tracked_visit.visitTime OR tracked_visit.visitTime IS NULL)');
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_article article
- LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit
+ FROM wcf1_article article
+ LEFT JOIN wcf1_tracked_visit tracked_visit
ON tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.article') . "
AND tracked_visit.objectID = article.articleID
AND tracked_visit.userID = " . WCF::getUser()->userID . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
self::$unreadWatchedArticles = $statement->fetchSingleColumn();
}
}
$this->sqlSelects .= 'tracked_visit.visitTime';
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit
+ LEFT JOIN wcf1_tracked_visit tracked_visit
ON tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.article') . "
AND tracked_visit.objectID = article.articleID
AND tracked_visit.userID = " . WCF::getUser()->userID;
}
$this->sqlSelects .= "like_object.cachedReactions";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_like_object like_object
+ LEFT JOIN wcf1_like_object like_object
ON like_object.objectTypeID = " . ReactionHandler::getInstance()->getObjectType('com.woltlab.wcf.likeableArticle')->objectTypeID . "
AND like_object.objectID = article.articleID";
}
$objectTypeID = UserObjectWatchHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.article.category');
$sql = "SELECT objectID
- FROM wcf" . WCF_N . "_user_object_watch
+ FROM wcf1_user_object_watch
WHERE objectTypeID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeID, WCF::getUser()->userID]);
self::$subscribedCategories = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$sql = "SELECT COUNT(*) AS count, categoryID
- FROM wcf" . WCF_N . "_article
+ FROM wcf1_article
" . $conditionBuilder . "
GROUP BY categoryID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$articles = $statement->fetchMap('categoryID', 'count');
{
if ($languageID !== null) {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleID = ?
AND languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$articleID, $languageID]);
} else {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleID = ?
AND languageID IS NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$articleID]);
}
$this->sqlSelects = 'user_table.username';
$this->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = attachment.userID";
}
{
$fileTypes = [];
$sql = "SELECT DISTINCT attachment.fileType
- FROM wcf" . WCF_N . "_attachment attachment
+ FROM wcf1_attachment attachment
" . $this->getConditionBuilder();
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->getConditionBuilder()->getParameters());
while ($row = $statement->fetchArray()) {
if ($row['fileType']) {
$sql = "SELECT COUNT(*) AS count,
COALESCE(SUM(attachment.filesize), 0) AS size,
COALESCE(SUM(downloads), 0) AS downloads
- FROM wcf" . WCF_N . "_attachment attachment
+ FROM wcf1_attachment attachment
" . $this->getConditionBuilder();
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->getConditionBuilder()->getParameters());
return $statement->fetchArray();
*/
public function delete()
{
- $sql = "DELETE FROM wcf" . WCF_N . "_attachment
+ $sql = "DELETE FROM wcf1_attachment
WHERE attachmentID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->attachmentID]);
$this->deleteFiles();
$conditionBuilder->add("attachmentID IN (?)", [$objectIDs]);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_attachment
+ FROM wcf1_attachment
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
while ($attachment = $statement->fetchObject(static::$baseClass)) {
$editor = new self($attachment);
$this->getConditionBuilder()->add(
'(
SELECT DISTINCT embeddedObjectID
- FROM wcf' . WCF_N . '_message_embedded_object
+ FROM wcf1_message_embedded_object
WHERE messageObjectTypeID = ?
AND messageID = attachment.objectID
AND embeddedObjectTypeID = ?
public static function getBBCodeByTag($tag)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_bbcode
+ FROM wcf1_bbcode
WHERE bbcodeTag = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$tag]);
$row = $statement->fetchArray();
if (!$row) {
// add bbcode to BBCodeSelect user group options
$sql = "SELECT optionID
- FROM wcf" . WCF_N . "_user_group_option
+ FROM wcf1_user_group_option
WHERE optionType = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['BBCodeSelect']);
$optionIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$conditionBuilder->add("optionValue <> ?", ['all']);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_group_option_value
+ FROM wcf1_user_group_option_value
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
- $sql = "UPDATE wcf" . WCF_N . "_user_group_option_value
+ $sql = "UPDATE wcf1_user_group_option_value
SET optionValue = ?
WHERE optionID = ?
AND groupID = ?";
- $updateStatement = WCF::getDB()->prepareStatement($sql);
+ $updateStatement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
while ($row = $statement->fetchArray()) {
}
$sql = "SELECT type, occurrences
- FROM wcf" . WCF_N . "_blacklist_entry
+ FROM wcf1_blacklist_entry
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$matches = [];
while ($row = $statement->fetchArray()) {
$percentile[$type] = 99999;
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_blacklist_entry
+ FROM wcf1_blacklist_entry
WHERE type = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$type]);
$count = $statement->fetchSingleColumn();
if ($count > 0) {
$sql = "SELECT occurrences
- FROM wcf" . WCF_N . "_blacklist_entry
+ FROM wcf1_blacklist_entry
WHERE type = ?
ORDER BY occurrences DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 1, \round($count * 0.9));
+ $statement = WCF::getDB()->prepare($sql, 1, \round($count * 0.9));
$statement->execute([$type]);
$percentile[$type] = $statement->fetchSingleColumn();
$data = JSON::decode((string)$response->getBody());
if (\is_array($data)) {
- $sql = "INSERT INTO wcf" . WCF_N . "_blacklist_entry
+ $sql = "INSERT INTO wcf1_blacklist_entry
(type, hash, lastSeen, occurrences)
VALUES (?, ?, ?, ?)
ON DUPLICATE KEY UPDATE lastSeen = VALUES(lastSeen),
occurrences = VALUES(occurrences)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$lastSeen = \preg_replace('~^(.+)T(.+)Z~', '$1 $2', $data['meta']['end']);
$this->boxContents = [];
$sql = "SELECT *
- FROM wcf" . WCF_N . "_box_content
+ FROM wcf1_box_content
WHERE boxID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->boxID]);
while ($row = $statement->fetchArray()) {
$this->boxContents[$row['languageID'] ?: 0] = new BoxContent(null, $row);
{
if ($this->pageIDs === null) {
$sql = "SELECT pageID
- FROM wcf" . WCF_N . "_box_to_page
+ FROM wcf1_box_to_page
WHERE boxID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->boxID]);
$this->pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
public static function getBoxByIdentifier($identifier)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_box
+ FROM wcf1_box
WHERE identifier = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$identifier]);
return $statement->fetchObject(self::class);
public static function getBoxByName($name)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_box
+ FROM wcf1_box
WHERE name = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$name]);
return $statement->fetchObject(self::class);
public static function getBoxByMenuID($menuID)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_box
+ FROM wcf1_box
WHERE menuID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$menuID]);
return $statement->fetchObject(self::class);
// save box to page
if (!empty($this->parameters['pageIDs'])) {
- $sql = "INSERT INTO wcf" . WCF_N . "_box_to_page
+ $sql = "INSERT INTO wcf1_box_to_page
(boxID, pageID, visible)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($this->parameters['pageIDs'] as $pageID) {
$statement->execute([
// save box to page
if (isset($this->parameters['pageIDs'])) {
- $sql = "DELETE FROM wcf" . WCF_N . "_box_to_page
+ $sql = "DELETE FROM wcf1_box_to_page
WHERE boxID = ?";
- $deleteStatement = WCF::getDB()->prepareStatement($sql);
+ $deleteStatement = WCF::getDB()->prepare($sql);
- $sql = "INSERT INTO wcf" . WCF_N . "_box_to_page
+ $sql = "INSERT INTO wcf1_box_to_page
(boxID, pageID, visible)
VALUES (?, ?, ?)";
- $insertStatement = WCF::getDB()->prepareStatement($sql);
+ $insertStatement = WCF::getDB()->prepare($sql);
foreach ($this->getObjects() as $box) {
$deleteStatement->execute([$box->boxID]);
{
if ($languageID !== null) {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_box_content
+ FROM wcf1_box_content
WHERE boxID = ?
AND languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$boxID, $languageID]);
} else {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_box_content
+ FROM wcf1_box_content
WHERE boxID = ?
AND languageID IS NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$boxID]);
}
$conditions->add('languageItem IN (?)', [$languageVariables]);
$sql = "SELECT languageItemID
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$languageItemIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
WHERE showOrder > ?
AND parentCategoryID = ?
AND objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->showOrder,
$this->parentCategoryID,
AND showOrder < ?
AND parentCategoryID = ?
AND objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$showOrder,
$this->showOrder,
FROM " . static::getDatabaseTableName() . "
WHERE objectTypeID = ?
AND parentCategoryID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->objectTypeID,
$this->parentCategoryID,
WHERE showOrder <= ?
AND showOrder > ?
AND objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$showOrder,
$this->showOrder,
SET showOrder = showOrder - 1
WHERE parentCategoryID = ?
AND showOrder > ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($objectIDs as $categoryID) {
$category = CategoryHandler::getInstance()->getCategory($categoryID);
FROM " . static::getDatabaseTableName() . "
WHERE objectTypeID = ?
AND parentCategoryID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$parentCategoryID,
WHERE objectTypeID = ?
AND showOrder >= ?
AND parentCategoryID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$showOrder,
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('comment_response.responseID IN (?)', [$responseIDs]);
$sql = "SELECT comment.objectTypeID, comment_response.responseID
- FROM wcf" . WCF_N . "_comment_response comment_response
- LEFT JOIN wcf" . WCF_N . "_comment comment
+ FROM wcf1_comment_response comment_response
+ LEFT JOIN wcf1_comment comment
ON comment.commentID = comment_response.commentID
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$responses = $statement->fetchMap('responseID', 'objectTypeID');
*/
public function updatePosition()
{
- $sql = "UPDATE wcf" . WCF_N . "_contact_option
+ $sql = "UPDATE wcf1_contact_option
SET showOrder = ?
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$showOrder = 1;
WCF::getDB()->beginTransaction();
*/
public function updatePosition()
{
- $sql = "UPDATE wcf" . WCF_N . "_contact_recipient
+ $sql = "UPDATE wcf1_contact_recipient
SET showOrder = ?
WHERE recipientID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$showOrder = $this->parameters['data']['offset'];
WCF::getDB()->beginTransaction();
// fetch data directly from database during framework installation
if (!PACKAGE_ID) {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_language_category
+ FROM wcf1_language_category
WHERE languageCategory = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['wcf.acp.cronjob']);
$languageCategory = $statement->fetchObject(LanguageCategory::class);
}
// save new descriptions
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageCategoryID, packageID)
VALUES (?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE languageItemValue = VALUES(languageItemValue),
languageCategoryID = VALUES(languageCategoryID)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($languages as $language) {
$value = $defaultValue;
{
// delete language items
if (!empty($objectIDs)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_language_item
+ $sql = "DELETE FROM wcf1_language_item
WHERE languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($objectIDs as $cronjobID) {
public static function clearLogs()
{
// delete logs
- $sql = "DELETE FROM wcf" . WCF_N . "_cronjob_log";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $sql = "DELETE FROM wcf1_cronjob_log";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
}
}
$conditions->add("languageItem IN (?)", [$languageVariables]);
$sql = "SELECT languageItemID
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$languageItemIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
*/
public function updatePosition()
{
- $sql = "UPDATE wcf" . WCF_N . "_label
+ $sql = "UPDATE wcf1_label
SET showOrder = ?
WHERE labelID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$showOrder = $this->parameters['data']['offset'];
{
// shift back labels in old label group with higher showOrder
if ($this->showOrder) {
- $sql = "UPDATE wcf" . WCF_N . "_label
+ $sql = "UPDATE wcf1_label
SET showOrder = showOrder - 1
WHERE groupID = ?
AND showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->groupID, $this->showOrder]);
}
// shift labels in new label group with higher showOrder
if ($showOrder) {
- $sql = "UPDATE wcf" . WCF_N . "_label
+ $sql = "UPDATE wcf1_label
SET showOrder = showOrder + 1
WHERE groupID = ?
AND showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$groupID, $showOrder]);
}
// get maximum existing show order
$sql = "SELECT MAX(showOrder)
- FROM wcf" . WCF_N . "_label
+ FROM wcf1_label
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$groupID]);
$maxShowOrder = $statement->fetchSingleColumn() ?: 0;
$conditions->add('groupID IN (?)', [$this->objectIDs]);
$sql = "SELECT labelID
- FROM wcf" . WCF_N . "_label
+ FROM wcf1_label
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$labelIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$conditions->add('languageItem IN (?)', [$languageVariables]);
$sql = "SELECT languageItemID
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$languageItemIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
// get language items
$sql = "SELECT languageItem, languageItemValue, languageCustomItemValue,
languageUseCustomValue, languageCategoryID
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$items = [];
while ($row = $statement->fetchArray()) {
$sql = "SELECT languageItem,
" . ($exportCustomValues ? "CASE WHEN languageUseCustomValue > 0 THEN languageCustomItemValue ELSE languageItemValue END AS languageItemValue" : "languageItemValue") . ",
languageCategory
- FROM wcf" . WCF_N . "_language_item language_item
- LEFT JOIN wcf" . WCF_N . "_language_category language_category
+ FROM wcf1_language_item language_item
+ LEFT JOIN wcf1_language_category language_category
ON language_category.languageCategoryID = language_item.languageCategoryID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$items = [];
while ($row = $statement->fetchArray()) {
$conditions->add("page.packageID = ?", [$packageID]);
$conditions->add("page.originIsSystem = ?", [1]);
$sql = "SELECT page.identifier, page_content.title, page_content.content
- FROM wcf" . WCF_N . "_page page,
- wcf" . WCF_N . "_page_content page_content
+ FROM wcf1_page page,
+ wcf1_page_content page_content
" . $conditions . "
ORDER BY page.identifier";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$pages[] = $row;
$conditions->add("box.packageID = ?", [$packageID]);
$conditions->add("box.originIsSystem = ?", [1]);
$sql = "SELECT box.identifier, box_content.title, box_content.content
- FROM wcf" . WCF_N . "_box box,
- wcf" . WCF_N . "_box_content box_content
+ FROM wcf1_box box,
+ wcf1_box_content box_content
" . $conditions . "
ORDER BY box.identifier";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$boxes[] = $row;
$conditions->add("languageCategory IN (?)", [\array_keys($usedCategories)]);
$sql = "SELECT languageCategoryID, languageCategory
- FROM wcf" . WCF_N . "_language_category
+ FROM wcf1_language_category
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$usedCategories[$row['languageCategory']] = $row['languageCategoryID'];
$conditions->add("(languageUseCustomValue = ? OR isCustomLanguageItem = ?)", [1, 1]);
$sql = "SELECT languageItemID, languageItem, languageItemValue, isCustomLanguageItem
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$updateValues = $customLanguageItemIDs = [];
while ($row = $statement->fetchArray()) {
}
if (!empty($updateValues)) {
- $sql = "UPDATE wcf" . WCF_N . "_language_item
+ $sql = "UPDATE wcf1_language_item
SET languageItemOldValue = languageItemValue,
languageCustomItemDisableTime = ?,
languageUseCustomValue = ?
WHERE languageItemID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($updateValues as $languageItemID) {
// make custom language items normal ones
if (!empty($customLanguageItemIDs)) {
- $sql = "UPDATE wcf" . WCF_N . "_language_item
+ $sql = "UPDATE wcf1_language_item
SET isCustomLanguageItem = ?,
languageItemOriginIsSystem = ?,
packageID = ?
WHERE languageItemID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($updateValues as $languageItemID) {
0,
-1
);
- $sql = "INSERT" . (!$updateExistingItems ? " IGNORE" : "") . " INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT" . (!$updateExistingItems ? " IGNORE" : "") . " INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageCategoryID" . ($packageID ? ", packageID" : "") . ")
VALUES {$placeholders}";
}
}
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($parameters);
}
WCF::getDB()->commitTransaction();
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("identifier IN (?)", [\array_keys($pageContents)]);
$sql = "SELECT pageID, identifier
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$pageIDs[$row['identifier']] = $row['pageID'];
WHERE pageID = ?
AND languageID = ?";
$createLanguageVersionStatement = WCF::getDB()->prepare($sql);
- $sql = "UPDATE wcf" . WCF_N . "_page_content
+ $sql = "UPDATE wcf1_page_content
SET title = ?
WHERE pageID = ?
AND languageID = ?";
- $updateTitleStatement = WCF::getDB()->prepareStatement($sql);
- $sql = "UPDATE wcf" . WCF_N . "_page_content
+ $updateTitleStatement = WCF::getDB()->prepare($sql);
+ $sql = "UPDATE wcf1_page_content
SET content = ?
WHERE pageID = ?
AND languageID = ?";
- $updateContentStatement = WCF::getDB()->prepareStatement($sql);
+ $updateContentStatement = WCF::getDB()->prepare($sql);
foreach ($pageContents as $identifier => $pageContent) {
if (!isset($pageIDs[$identifier])) {
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("identifier IN (?)", [\array_keys($boxContents)]);
$sql = "SELECT boxID, identifier
- FROM wcf" . WCF_N . "_box
+ FROM wcf1_box
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$boxIDs[$row['identifier']] = $row['boxID'];
}
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_box_content
+ $sql = "INSERT IGNORE INTO wcf1_box_content
(boxID, languageID)
VALUES (?, ?)";
- $createLanguageVersionStatement = WCF::getDB()->prepareStatement($sql);
- $sql = "UPDATE wcf" . WCF_N . "_box_content
+ $createLanguageVersionStatement = WCF::getDB()->prepare($sql);
+ $sql = "UPDATE wcf1_box_content
SET title = ?
WHERE boxID = ?
AND languageID = ?";
- $updateTitleStatement = WCF::getDB()->prepareStatement($sql);
- $sql = "UPDATE wcf" . WCF_N . "_box_content
+ $updateTitleStatement = WCF::getDB()->prepare($sql);
+ $sql = "UPDATE wcf1_box_content
SET content = ?
WHERE boxID = ?
AND languageID = ?";
- $updateContentStatement = WCF::getDB()->prepareStatement($sql);
+ $updateContentStatement = WCF::getDB()->prepare($sql);
foreach ($boxContents as $identifier => $boxContent) {
if (!isset($boxIDs[$identifier])) {
*/
public function copy(Language $destination)
{
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
SELECT ?, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
WHERE languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$destination->languageID,
$this->languageID,
// create remaining items
if (!empty($items)) {
// bypass LanguageItemEditor::create() for performance reasons
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
VALUES (?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $itemName => $itemValue) {
$statement->execute([
public function setAsDefault()
{
// remove default flag from all languages
- $sql = "UPDATE wcf" . WCF_N . "_language
+ $sql = "UPDATE wcf1_language
SET isDefault = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([0]);
// set current language as default language
*/
public static function enableMultilingualism(array $languageIDs = [])
{
- $sql = "UPDATE wcf" . WCF_N . "_language
+ $sql = "UPDATE wcf1_language
SET hasContent = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([0]);
if (!empty($languageIDs)) {
$statementParameters[] = $languageID;
}
- $sql = "UPDATE wcf" . WCF_N . "_language
+ $sql = "UPDATE wcf1_language
SET hasContent = ?
WHERE languageID IN (" . $sql . ")";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
\array_unshift($statementParameters, 1);
$statement->execute($statementParameters);
}
public static function copyLanguageContent($sourceLanguageID, $destinationLanguageID)
{
// article content
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_article_content
+ $sql = "INSERT IGNORE INTO wcf1_article_content
(articleID, languageID, title, teaser, content, imageID, hasEmbeddedObjects)
SELECT articleID, ?, title, teaser, content, imageID, hasEmbeddedObjects
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$destinationLanguageID, $sourceLanguageID]);
// box content
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_box_content
+ $sql = "INSERT IGNORE INTO wcf1_box_content
(boxID, languageID, title, content, imageID, hasEmbeddedObjects)
SELECT boxID, ?, title, content, imageID, hasEmbeddedObjects
- FROM wcf" . WCF_N . "_box_content
+ FROM wcf1_box_content
WHERE languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$destinationLanguageID, $sourceLanguageID]);
// create tpl files
$sql = "SELECT *
- FROM wcf" . WCF_N . "_box_content
+ FROM wcf1_box_content
WHERE boxID IN (
SELECT boxID
- FROM wcf" . WCF_N . "_box
+ FROM wcf1_box
WHERE boxType = ?
)
AND languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['tpl', $destinationLanguageID]);
while ($row = $statement->fetchArray()) {
\file_put_contents(
}
// media content
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_media_content
+ $sql = "INSERT IGNORE INTO wcf1_media_content
(mediaID, languageID, title, caption, altText)
SELECT mediaID, ?, title, caption, altText
- FROM wcf" . WCF_N . "_media_content
+ FROM wcf1_media_content
WHERE languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$destinationLanguageID, $sourceLanguageID]);
// page content
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_page_content
+ $sql = "INSERT IGNORE INTO wcf1_page_content
(pageID, languageID, title, content, metaDescription, customURL, hasEmbeddedObjects)
SELECT pageID, ?, title, content, metaDescription, CASE WHEN customURL <> '' THEN CONCAT(customURL, '_', ?) ELSE '' END, hasEmbeddedObjects
- FROM wcf" . WCF_N . "_page_content
+ FROM wcf1_page_content
WHERE languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$destinationLanguageID, $destinationLanguageID, $sourceLanguageID]);
// create tpl files
$sql = "SELECT *
- FROM wcf" . WCF_N . "_page_content
+ FROM wcf1_page_content
WHERE pageID IN (
SELECT pageID
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
WHERE pageType = ?
)
AND languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['tpl', $destinationLanguageID]);
while ($row = $statement->fetchArray()) {
\file_put_contents(
public static function getLike($objectTypeID, $objectID, $userID)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_like
+ FROM wcf1_like
WHERE objectTypeID = ?
AND objectID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
public function getLikeDetails()
{
$sql = "SELECT userID, likeValue
- FROM wcf" . WCF_N . "_like
+ FROM wcf1_like
WHERE objectID = ?
AND objectTypeID = ?
ORDER BY time DESC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->parameters['data']['objectID'],
$this->objectType->objectTypeID,
{
// fetch number of pages
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_like
+ FROM wcf1_like
WHERE objectID = ?
AND objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->parameters['data']['objectID'],
$this->objectType->objectTypeID,
$pageCount = \ceil($statement->fetchSingleColumn() / 20);
$sql = "SELECT userID, likeValue
- FROM wcf" . WCF_N . "_like
+ FROM wcf1_like
WHERE objectID = ?
AND objectTypeID = ?
ORDER BY likeValue DESC, time DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
+ $statement = WCF::getDB()->prepare($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
$statement->execute([
$this->parameters['data']['objectID'],
$this->objectType->objectTypeID,
public static function getLikeObject($objectTypeID, $objectID)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_like_object
+ FROM wcf1_like_object
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
];
$sql = "SELECT *
- FROM wcf" . WCF_N . "_media_content
+ FROM wcf1_media_content
WHERE mediaID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->mediaID]);
while ($row = $statement->fetchArray()) {
$conditionBuilder->add('mediaID IN (?)', [$mediaList->getObjectIDs()]);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_media_content
+ FROM wcf1_media_content
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$mediaData = [];
$isMultilingual = $this->parameters['data']['isMultilingual'];
}
- $sql = "DELETE FROM wcf" . WCF_N . "_media_content
+ $sql = "DELETE FROM wcf1_media_content
WHERE mediaID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$media->mediaID]);
- $sql = "INSERT INTO wcf" . WCF_N . "_media_content
+ $sql = "INSERT INTO wcf1_media_content
(mediaID, languageID, title, caption, altText)
VALUES (?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
if (!$isMultilingual) {
$languageID = $media->languageID;
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('mediaID IN (?)', [$this->objectIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_media
+ $sql = "UPDATE wcf1_media
SET categoryID = ?
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge(
[$this->parameters['categoryID'] ?: null],
$conditionBuilder->getParameters()
$searchString = '%' . \addcslashes($searchString, '_%') . '%';
$this->sqlConditionJoins .= '
- LEFT JOIN wcf' . WCF_N . '_media_content media_content
+ LEFT JOIN wcf1_media_content media_content
ON media_content.mediaID = media.mediaID';
$conditionBuilder = new PreparedStatementConditionBuilder(false, 'OR');
// fetch content data
$this->sqlSelects .= "media_content.*, COALESCE(media.languageID, " . $languageID . ") AS localizedLanguageID";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_media_content media_content
+ LEFT JOIN wcf1_media_content media_content
ON media_content.mediaID = media.mediaID
AND media_content.languageID = COALESCE(media.languageID, " . $languageID . ")";
}
if (\is_array($title)) {
if (\count($title) > 1) {
$sql = "SELECT languageCategoryID
- FROM wcf" . WCF_N . "_language_category
+ FROM wcf1_language_category
WHERE languageCategory = ?";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute(['wcf.menu']);
$languageCategoryID = $statement->fetchSingleColumn();
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
VALUES (?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($title as $languageCode => $value) {
$menuList->readObjects();
if (\count($menuList)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_language_item
+ $sql = "DELETE FROM wcf1_language_item
WHERE languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($menuList as $menu) {
*/
public function updatePosition()
{
- $sql = "UPDATE wcf" . WCF_N . "_menu_item
+ $sql = "UPDATE wcf1_menu_item
SET parentItemID = ?,
showOrder = ?
WHERE itemID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->parameters['data']['structure'] as $parentItemID => $children) {
if (\is_array($title)) {
if (\count($title) > 1) {
$sql = "SELECT languageCategoryID
- FROM wcf" . WCF_N . "_language_category
+ FROM wcf1_language_category
WHERE languageCategory = ?";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute(['wcf.menu']);
$languageCategoryID = $statement->fetchSingleColumn();
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
VALUES (?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($title as $languageCode => $value) {
$menuItemList->readObjects();
if (\count($menuItemList)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_language_item
+ $sql = "DELETE FROM wcf1_language_item
WHERE languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($menuItemList as $menuItem) {
}
$sql = "SELECT isAffected
- FROM wcf" . WCF_N . "_moderation_queue_to_user
+ FROM wcf1_moderation_queue_to_user
WHERE queueID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->queueID,
$user->userID,
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("queueID IN (?)", [$queueIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_moderation_queue
+ $sql = "UPDATE wcf1_moderation_queue
SET status = " . ModerationQueue::STATUS_DONE . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
// reset number of active moderation queue items
$conditions->add("(moderation_queue.time > tracked_visit.visitTime OR tracked_visit.visitTime IS NULL)");
$sql = "SELECT moderation_queue.queueID
- FROM wcf" . WCF_N . "_moderation_queue_to_user moderation_queue_to_user
- LEFT JOIN wcf" . WCF_N . "_moderation_queue moderation_queue
+ FROM wcf1_moderation_queue_to_user moderation_queue_to_user
+ LEFT JOIN wcf1_moderation_queue moderation_queue
ON moderation_queue.queueID = moderation_queue_to_user.queueID
- LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit
+ LEFT JOIN wcf1_tracked_visit tracked_visit
ON tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.moderation.queue') . "
AND tracked_visit.objectID = moderation_queue.queueID
AND tracked_visit.userID = " . WCF::getUser()->userID . "
" . $conditions . "
ORDER BY moderation_queue.lastChangeTime DESC";
- $statement = WCF::getDB()->prepareStatement($sql, $MAX_ITEMS);
+ $statement = WCF::getDB()->prepare($sql, $MAX_ITEMS);
$statement->execute($conditions->getParameters());
$queueIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
parent::__construct();
$this->sqlSelects = "moderation_queue.*, assigned_user.username AS assignedUsername, user_table.username";
- $this->sqlConditionJoins = ", wcf" . WCF_N . "_moderation_queue moderation_queue";
- $this->sqlJoins = ", wcf" . WCF_N . "_moderation_queue moderation_queue";
+ $this->sqlConditionJoins = ", wcf1_moderation_queue moderation_queue";
+ $this->sqlJoins = ", wcf1_moderation_queue moderation_queue";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user assigned_user
+ LEFT JOIN wcf1_user assigned_user
ON assigned_user.userID = moderation_queue.assignedUserID
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = moderation_queue.userID";
$this->getConditionBuilder()->add("moderation_queue_to_user.queueID = moderation_queue.queueID");
$this->getConditionBuilder()->add("moderation_queue_to_user.userID = ?", [WCF::getUser()->userID]);
$dismissedNotices = UserStorageHandler::getInstance()->getField('dismissedNotices');
if ($dismissedNotices === null) {
$sql = "SELECT noticeID
- FROM wcf" . WCF_N . "_notice_dismissed
+ FROM wcf1_notice_dismissed
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
WCF::getUser()->userID,
]);
public function dismiss()
{
if (WCF::getUser()->userID) {
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_notice_dismissed
+ $sql = "INSERT IGNORE INTO wcf1_notice_dismissed
(noticeID, userID)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
\reset($this->objectIDs),
WCF::getUser()->userID,
*/
public function updatePosition()
{
- $sql = "UPDATE wcf" . WCF_N . "_notice
+ $sql = "UPDATE wcf1_notice
SET showOrder = ?
WHERE noticeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$showOrder = $this->parameters['data']['offset'];
WCF::getDB()->beginTransaction();
public function setShowOrder($showOrder = 0)
{
$sql = "SELECT MAX(showOrder)
- FROM wcf" . WCF_N . "_notice";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_notice";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$maxShowOrder = $statement->fetchSingleColumn();
if (!$maxShowOrder) {
$newShowOrder = $maxShowOrder + 1;
} else {
// shift other notices
- $sql = "UPDATE wcf" . WCF_N . "_notice
+ $sql = "UPDATE wcf1_notice
SET showOrder = showOrder + 1
WHERE showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$showOrder,
]);
{
$sql = "SELECT *
FROM " . self::getDatabaseTableName();
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$options = [];
$sql = "SELECT *
FROM " . self::getDatabaseTableName() . "
WHERE optionName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$optionName]);
return $statement->fetchObject(static::class);
{
// get option ids
$sql = "SELECT optionName, optionID
- FROM wcf" . WCF_N . "_option";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_option";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$optionIDs = $statement->fetchMap('optionName', 'optionID');
public static function updateAll(array $options)
{
$sql = "SELECT optionID, optionName, optionValue
- FROM wcf" . WCF_N . "_option
+ FROM wcf1_option
WHERE optionName IN (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['cache_source_type', 'visitor_use_tiny_build']);
$oldValues = [];
while ($row = $statement->fetchArray()) {
$oldValues[$row['optionID']] = $row;
}
- $sql = "UPDATE wcf" . WCF_N . "_option
+ $sql = "UPDATE wcf1_option
SET optionValue = ?
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$flushCache = false;
$flushPermissions = false;
{
if (self::$requirements === null) {
$sql = "SELECT packageID, requirement
- FROM wcf" . WCF_N . "_package_requirement";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_package_requirement";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
self::$requiredPackageIDs = [];
public static function isAlreadyInstalled($package)
{
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_package
+ FROM wcf1_package
WHERE package = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$package]);
return $statement->fetchSingleColumn() > 0;
public static function getNewProcessNo()
{
$sql = "SELECT MAX(processNo) AS processNo
- FROM wcf" . WCF_N . "_package_installation_queue";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_package_installation_queue";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$row = $statement->fetchArray();
// find matching packages
$sql = "SELECT package_update.packageUpdateID
- FROM wcf" . WCF_N . "_package_update package_update
- LEFT JOIN wcf" . WCF_N . "_package package
+ FROM wcf1_package_update package_update
+ LEFT JOIN wcf1_package package
ON package.package = package_update.package
" . $conditions . "
ORDER BY package_update.packageName ASC";
- $statement = WCF::getDB()->prepareStatement($sql, 1000);
+ $statement = WCF::getDB()->prepare($sql, 1000);
$statement->execute($conditions->getParameters());
$packageUpdateIDs = [];
while ($row = $statement->fetchArray()) {
// get installed packages
$sql = "SELECT package, packageVersion
- FROM wcf" . WCF_N . "_package";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_package";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$installedPackages = $statement->fetchMap('package', 'packageVersion');
// get excluded packages (of installed packages)
$excludedPackagesOfInstalledPackages = [];
$sql = "SELECT excludedPackage, excludedPackageVersion
- FROM wcf" . WCF_N . "_package_exclusion";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_package_exclusion";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
if (!isset($excludedPackagesOfInstalledPackages[$row['excludedPackage']])) {
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("packageUpdateID IN (?)", [\array_keys($packageUpdates)]);
$sql = "SELECT packageUpdateID, packageUpdateServerID, package
- FROM wcf" . WCF_N . "_package_update
+ FROM wcf1_package_update
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$possiblePackages = [];
while ($row = $statement->fetchArray()) {
$conditions->add("packageUpdateVersionID IN (?)", [$packageUpdateVersionIDs]);
$sql = "SELECT packageUpdateVersionID, packageUpdateID, packageVersion
- FROM wcf" . WCF_N . "_package_update_version
+ FROM wcf1_package_update_version
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$packageVersions = [];
while ($row = $statement->fetchArray()) {
$conditions->add(
"packageUpdateVersionID IN (
SELECT packageUpdateVersionID
- FROM wcf" . WCF_N . "_package_update_version
+ FROM wcf1_package_update_version
WHERE packageUpdateID = ?
)",
[$packageUpdateID]
);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_package_update_exclusion
+ FROM wcf1_package_update_exclusion
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$excludedPackages = [];
while ($row = $statement->fetchArray()) {
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("puv.packageUpdateID IN (?)", [$packageUpdateID]);
$sql = "SELECT pu.package, puv.packageUpdateVersionID, puv.packageUpdateID, puv.packageVersion, puv.isAccessible
- FROM wcf" . WCF_N . "_package_update_version puv
- LEFT JOIN wcf" . WCF_N . "_package_update pu
+ FROM wcf1_package_update_version puv
+ LEFT JOIN wcf1_package_update pu
ON pu.packageUpdateID = puv.packageUpdateID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$packageVersions = [];
while ($row = $statement->fetchArray()) {
// validate dependencies
foreach ($packageUpdates as $packageUpdateData) {
$sql = "SELECT package, minversion
- FROM wcf" . WCF_N . "_package_update_requirement
+ FROM wcf1_package_update_requirement
WHERE packageUpdateVersionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$packageUpdateData['accessible']]);
$requirements = [];
while ($row = $statement->fetchArray()) {
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("package IN (?)", [\array_keys($requirements)]);
$sql = "SELECT packageUpdateID, package
- FROM wcf" . WCF_N . "_package_update
+ FROM wcf1_package_update
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
if (!\in_array($row['package'], $openRequirements)) {
$conditions->add("packageUpdateID IN (?)", [\array_keys($updateData)]);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_package_update
+ FROM wcf1_package_update
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$packageUpdates = $packageVersionIDs = [];
while ($packageUpdate = $statement->fetchObject(PackageUpdate::class)) {
$conditions->add("packageUpdateVersionID IN (?)", [$packageVersionIDs]);
$sql = "SELECT packageUpdateVersionID, packageVersion, packageDate, license, licenseURL
- FROM wcf" . WCF_N . "_package_update_version
+ FROM wcf1_package_update_version
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
/** @var PackageUpdateVersion[] $updateVersions */
public static function resetAll(): void
{
// purge package cache
- WCF::getDB()->prepareStatement("DELETE FROM wcf" . WCF_N . "_package_update")->execute();
+ WCF::getDB()->prepare("DELETE FROM wcf1_package_update")->execute();
PackageUpdateCacheBuilder::getInstance()->reset();
// reset servers into their original state
- $sql = "UPDATE wcf" . WCF_N . "_package_update_server
+ $sql = "UPDATE wcf1_package_update_server
SET lastUpdateTime = ?,
status = ?,
errorMessage = ?,
apiVersion = ?,
metaData = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
0,
'online',
}
$this->sqlSelects .= "(
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_package_update
+ FROM wcf1_package_update
WHERE packageUpdateServerID = " . $this->getDatabaseTableAlias() . ".packageUpdateServerID
) AS packages";
$this->pageContents = [];
$sql = "SELECT *
- FROM wcf" . WCF_N . "_page_content
+ FROM wcf1_page_content
WHERE pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->pageID]);
while ($row = $statement->fetchArray()) {
$this->pageContents[$row['languageID'] ?: 0] = new PageContent(null, $row);
}
$sql = "SELECT *
- FROM wcf" . WCF_N . "_page_content
+ FROM wcf1_page_content
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute($conditions->getParameters());
$row = $statement->fetchSingleRow();
if ($row !== false) {
}
WCF::getDB()->beginTransaction();
- $sql = "UPDATE wcf" . WCF_N . "_application
+ $sql = "UPDATE wcf1_application
SET landingPageID = ?
WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->pageID,
1,
{
if ($this->boxIDs === null) {
$sql = "SELECT boxID
- FROM wcf" . WCF_N . "_box_to_page
+ FROM wcf1_box_to_page
WHERE pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->pageID]);
$this->boxIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$this->pageLanguages = [];
if ($this->isMultilingual) {
$sql = "SELECT languageID
- FROM wcf" . WCF_N . "_page_content
+ FROM wcf1_page_content
WHERE pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->pageID]);
while ($languageID = $statement->fetchColumn()) {
if (LanguageFactory::getInstance()->getLanguage($languageID) !== null) {
public static function getPageByIdentifier($identifier)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
WHERE identifier = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$identifier]);
return $statement->fetchObject(self::class);
public static function getPageByName($name)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
WHERE name = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$name]);
return $statement->fetchObject(self::class);
// save box to page assignments
if (!empty($this->parameters['boxToPage'])) {
- $sql = "INSERT INTO wcf" . WCF_N . "_box_to_page
+ $sql = "INSERT INTO wcf1_box_to_page
(boxID, pageID, visible)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($this->parameters['boxToPage'] as $boxData) {
$statement->execute([
// save box to page assignments
if (isset($this->parameters['boxToPage'])) {
- $sql = "DELETE FROM wcf" . WCF_N . "_box_to_page
+ $sql = "DELETE FROM wcf1_box_to_page
WHERE pageID = ?";
- $deleteStatement = WCF::getDB()->prepareStatement($sql);
+ $deleteStatement = WCF::getDB()->prepare($sql);
- $sql = "INSERT INTO wcf" . WCF_N . "_box_to_page
+ $sql = "INSERT INTO wcf1_box_to_page
(boxID, pageID, visible)
VALUES (?, ?, ?)";
- $insertStatement = WCF::getDB()->prepareStatement($sql);
+ $insertStatement = WCF::getDB()->prepare($sql);
foreach ($this->getObjects() as $page) {
$deleteStatement->execute([$page->pageID]);
public function search()
{
$sql = "SELECT pageID
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
WHERE name LIKE ?
AND requireObjectID = ?
ORDER BY name";
- $statement = WCF::getDB()->prepareStatement($sql, 5);
+ $statement = WCF::getDB()->prepare($sql, 5);
$statement->execute([
'%' . $this->parameters['searchString'] . '%',
0,
$conditions->add("boxID IN (?)", [$seenBoxIDs]);
$sql = "SELECT boxID
- FROM wcf" . WCF_N . "_box
+ FROM wcf1_box
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$validBoxIDs = [];
while ($boxID = $statement->fetchColumn()) {
{
$pageID = $this->pageEditor->getDecoratedObject()->pageID;
- $sql = "DELETE FROM wcf" . WCF_N . "_page_box_order
+ $sql = "DELETE FROM wcf1_page_box_order
WHERE pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$pageID]);
- $sql = "INSERT INTO wcf" . WCF_N . "_page_box_order
+ $sql = "INSERT INTO wcf1_page_box_order
(pageID, boxID, showOrder)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->parameters['position'] as $boxIDs) {
*/
public function resetPosition()
{
- $sql = "DELETE FROM wcf" . WCF_N . "_page_box_order
+ $sql = "DELETE FROM wcf1_page_box_order
WHERE pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->pageEditor->getDecoratedObject()->pageID]);
}
}
// check custom controller urls
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
WHERE controllerCustomURL = ?
AND applicationPackageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$customURL, $packageID]);
if ($statement->fetchSingleColumn()) {
return false;
// check custom urls
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_page_content
+ FROM wcf1_page_content
WHERE customURL = ?
AND pageID IN (
SELECT pageID
- FROM wcf" . WCF_N . "_page
+ FROM wcf1_page
WHERE applicationPackageID = ?
)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$customURL, $packageID]);
if ($statement->fetchSingleColumn()) {
return false;
{
if ($languageID !== null) {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_page_content
+ FROM wcf1_page_content
WHERE pageID = ?
AND languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$pageID, $languageID]);
} else {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_page_content
+ FROM wcf1_page_content
WHERE pageID = ?
AND languageID IS NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$pageID]);
}
public function setShowOrder($showOrder = 0)
{
$sql = "SELECT MAX(showOrder)
- FROM wcf" . WCF_N . "_paid_subscription";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_paid_subscription";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$maxShowOrder = $statement->fetchSingleColumn();
if (!$maxShowOrder) {
$newShowOrder = $maxShowOrder + 1;
} else {
// shift other subscriptions
- $sql = "UPDATE wcf" . WCF_N . "_paid_subscription
+ $sql = "UPDATE wcf1_paid_subscription
SET showOrder = showOrder + 1
WHERE showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$showOrder,
]);
public static function getLogByTransactionID($paymentMethodObjectTypeID, $transactionID)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_paid_subscription_transaction_log
+ FROM wcf1_paid_subscription_transaction_log
WHERE paymentMethodObjectTypeID = ?
AND transactionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$paymentMethodObjectTypeID, $transactionID]);
$row = $statement->fetchArray();
if ($row !== false) {
public static function getSubscriptionUser($subscriptionID, $userID)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_paid_subscription_user
+ FROM wcf1_paid_subscription_user
WHERE subscriptionID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$subscriptionID, $userID]);
$row = $statement->fetchArray();
if ($row !== false) {
$poll = parent::create();
// create options
- $sql = "INSERT INTO wcf" . WCF_N . "_poll_option
+ $sql = "INSERT INTO wcf1_poll_option
(pollID, optionValue, showOrder)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->parameters['options'] as $showOrder => $option) {
// check if new options should be created
if (!empty($newOptions)) {
- $sql = "INSERT INTO wcf" . WCF_N . "_poll_option
+ $sql = "INSERT INTO wcf1_poll_option
(pollID, optionValue, showOrder)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($newOptions as $option) {
$statement->execute([
$pollEditor->pollID,
// check if existing options should be updated
if (!empty($updateOptions)) {
- $sql = "UPDATE wcf" . WCF_N . "_poll_option
+ $sql = "UPDATE wcf1_poll_option
SET optionValue = ?,
showOrder = ?
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($updateOptions as $optionID => $option) {
$statement->execute([
$option['optionValue'],
// check if options should be removed
if (!empty($options)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_poll_option
+ $sql = "DELETE FROM wcf1_poll_option
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($options as $option) {
$statement->execute([$option->optionID]);
}
{
// get options
$sql = "SELECT optionID, optionValue
- FROM wcf" . WCF_N . "_poll_option
+ FROM wcf1_poll_option
WHERE pollID = ?
ORDER BY " . ($this->poll->sortByVotes ? "votes DESC" : "showOrder ASC");
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->poll->pollID]);
$options = [];
while ($row = $statement->fetchArray()) {
// get votes
$sql = "SELECT userID, optionID
- FROM wcf" . WCF_N . "_poll_option_vote
+ FROM wcf1_poll_option_vote
WHERE pollID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->poll->pollID]);
$voteData = $statement->fetchMap('optionID', 'userID', false);
// get poll
$sql = "SELECT *
- FROM wcf" . WCF_N . "_poll
+ FROM wcf1_poll
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$sourceObjectType->objectTypeID,
$this->parameters['sourceObjectID'],
// copy votes
WCF::getDB()->beginTransaction();
foreach ($newOptionIDs as $oldOptionID => $newOptionID) {
- $sql = "INSERT INTO wcf" . WCF_N . "_poll_option_vote
+ $sql = "INSERT INTO wcf1_poll_option_vote
(pollID, optionID, userID)
SELECT " . $newPoll->pollID . ", " . $newOptionID . ", userID
- FROM wcf" . WCF_N . "_poll_option_vote
+ FROM wcf1_poll_option_vote
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$oldOptionID]);
}
WCF::getDB()->commitTransaction();
public function calculateVotes()
{
// update option votes
- $sql = "UPDATE wcf" . WCF_N . "_poll_option poll_option
+ $sql = "UPDATE wcf1_poll_option poll_option
SET poll_option.votes = (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_poll_option_vote
+ FROM wcf1_poll_option_vote
WHERE optionID = poll_option.optionID
)
WHERE poll_option.pollID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->pollID]);
// update total count
- $sql = "UPDATE wcf" . WCF_N . "_poll poll
+ $sql = "UPDATE wcf1_poll poll
SET poll.votes = (
SELECT COUNT(DISTINCT userID)
- FROM wcf" . WCF_N . "_poll_option_vote
+ FROM wcf1_poll_option_vote
WHERE pollID = poll.pollID
)
WHERE poll.pollID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->pollID]);
}
*/
public function increaseVotes()
{
- $sql = "UPDATE wcf" . WCF_N . "_poll
+ $sql = "UPDATE wcf1_poll
SET votes = votes + 1
WHERE pollID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->pollID]);
}
}
// get like object
$sql = "SELECT *
- FROM wcf" . WCF_N . "_like_object
+ FROM wcf1_like_object
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$sourceObjectType->objectTypeID,
$this->parameters['sourceObjectID'],
// step 2) copy
//
- $sql = "INSERT INTO wcf" . WCF_N . "_like
+ $sql = "INSERT INTO wcf1_like
(objectID, objectTypeID, objectUserID, userID, time, likeValue, reactionTypeID)
SELECT " . $this->parameters['targetObjectID'] . ", " . $targetObjectType->objectTypeID . ", objectUserID, userID, time, likeValue, reactionTypeID
- FROM wcf" . WCF_N . "_like
+ FROM wcf1_like
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$sourceObjectType->objectTypeID,
$this->parameters['sourceObjectID'],
if ($newLikeObject->objectUserID) {
$sql = "SELECT COUNT(*) as count
- FROM wcf" . WCF_N . "_like
+ FROM wcf1_like
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$targetObjectType->objectTypeID,
$this->parameters['targetObjectID'],
public function create()
{
if (isset($this->parameters['data']['showOrder']) && $this->parameters['data']['showOrder'] !== null) {
- $sql = "UPDATE wcf" . WCF_N . "_reaction_type
+ $sql = "UPDATE wcf1_reaction_type
SET showOrder = showOrder + 1
WHERE showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->parameters['data']['showOrder'],
]);
// update show order
if (isset($this->parameters['data']['showOrder']) && $this->parameters['data']['showOrder'] !== null) {
- $sql = "UPDATE wcf" . WCF_N . "_reaction_type
+ $sql = "UPDATE wcf1_reaction_type
SET showOrder = showOrder + 1
WHERE showOrder >= ?
AND reactionTypeID <> ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->parameters['data']['showOrder'],
$object->reactionTypeID,
]);
- $sql = "UPDATE wcf" . WCF_N . "_reaction_type
+ $sql = "UPDATE wcf1_reaction_type
SET showOrder = showOrder - 1
WHERE showOrder > ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$object->showOrder,
]);
{
$returnValues = parent::delete();
- $sql = "UPDATE wcf" . WCF_N . "_reaction_type
+ $sql = "UPDATE wcf1_reaction_type
SET showOrder = showOrder - 1
WHERE showOrder > ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($this->getObjects() as $object) {
$statement->execute([
$object->showOrder,
// find users
$sql = "SELECT *
- FROM wcf" . WCF_N . "_search_keyword
+ FROM wcf1_search_keyword
WHERE keyword LIKE ?
ORDER BY searches DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 10);
+ $statement = WCF::getDB()->prepare($sql, 10);
$statement->execute([$this->parameters['data']['searchString'] . '%']);
while ($row = $statement->fetchArray()) {
$list[] = [
*/
public function registerSearch()
{
- $sql = "INSERT INTO wcf" . WCF_N . "_search_keyword
+ $sql = "INSERT INTO wcf1_search_keyword
(keyword, searches, lastSearchTime)
VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE searches = searches + VALUES(searches),
lastSearchTime = VALUES(lastSearchTime)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
\mb_substr($this->parameters['data']['keyword'], 0, 191),
($this->parameters['data']['searches'] ?? 1),
$limit = 0;
if ($this->parameters['dateGrouping'] == 'yearly') {
$sql = "SELECT MIN(date) AS date, SUM(counter) AS counter, MAX(total) AS total, objectTypeID
- FROM wcf" . WCF_N . "_stat_daily
+ FROM wcf1_stat_daily
" . $conditionBuilder . "
GROUP BY EXTRACT(YEAR FROM date), objectTypeID
ORDER BY date";
} elseif ($this->parameters['dateGrouping'] == 'monthly') {
$sql = "SELECT MIN(date) AS date, SUM(counter) AS counter, MAX(total) AS total, objectTypeID
- FROM wcf" . WCF_N . "_stat_daily
+ FROM wcf1_stat_daily
" . $conditionBuilder . "
GROUP BY EXTRACT(YEAR_MONTH FROM date), objectTypeID
ORDER BY date";
} elseif ($this->parameters['dateGrouping'] == 'weekly') {
$sql = "SELECT MIN(date) AS date, SUM(counter) AS counter, MAX(total) AS total, objectTypeID
- FROM wcf" . WCF_N . "_stat_daily
+ FROM wcf1_stat_daily
" . $conditionBuilder . "
GROUP BY EXTRACT(YEAR FROM date), EXTRACT(WEEK FROM date), objectTypeID
ORDER BY date";
$limit = 260;
} else {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_stat_daily
+ FROM wcf1_stat_daily
" . $conditionBuilder . "
ORDER BY date";
$limit = 365;
}
- $statement = WCF::getDB()->prepareStatement($sql, $limit);
+ $statement = WCF::getDB()->prepare($sql, $limit);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
$value = $row['counter'];
}
$sql = "SELECT variable.variableName, variable.defaultValue, variable.defaultValueDarkMode, value.variableValue, value.variableValueDarkMode
- FROM wcf" . WCF_N . "_style_variable variable
- LEFT JOIN wcf" . WCF_N . "_style_variable_value value
+ FROM wcf1_style_variable variable
+ LEFT JOIN wcf1_style_variable_value value
ON value.variableID = variable.variableID
AND value.styleID = ?
ORDER BY variable.variableID ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->styleID]);
while ($row = $statement->fetchArray()) {
$variableName = $row['variableName'];
{
// get unique style name
$sql = "SELECT styleName
- FROM wcf" . WCF_N . "_style
+ FROM wcf1_style
WHERE styleName LIKE ?
AND styleID <> ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->styleEditor->styleName . '%',
$this->styleEditor->styleID,
$styleDescription = 'wcf.style.styleDescription' . $newStyle->styleID;
// delete any phrases that were the result of an import
- $sql = "DELETE FROM wcf" . WCF_N . "_language_item
+ $sql = "DELETE FROM wcf1_language_item
WHERE languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$styleDescription]);
// copy language items
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
SELECT languageID, '" . $styleDescription . "', languageItemValue, 0, languageCategoryID, packageID
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
WHERE languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$newStyle->styleDescription]);
// update style description
}
// delete language items
- $sql = "DELETE FROM wcf" . WCF_N . "_language_item
+ $sql = "DELETE FROM wcf1_language_item
WHERE languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['wcf.style.styleDescription' . $this->styleID]);
}
public function setAsDefault()
{
// remove old default
- $sql = "UPDATE wcf" . WCF_N . "_style
+ $sql = "UPDATE wcf1_style
SET isDefault = ?
WHERE isDefault = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([0, 1]);
// set new default
public function getImplicitVariables()
{
$sql = "SELECT variable.variableName
- FROM wcf" . WCF_N . "_style_variable variable
- LEFT JOIN wcf" . WCF_N . "_style_variable_value variable_value
+ FROM wcf1_style_variable variable
+ LEFT JOIN wcf1_style_variable_value variable_value
ON variable_value.variableID = variable.variableID
AND variable_value.styleID = ?
WHERE variable.variableName LIKE ?
AND variable_value.variableValue IS NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->styleID,
'wcf%',
$i = 1;
while (true) {
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
WHERE templateGroupName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$templateGroupName]);
if (!$statement->fetchSingleColumn()) {
break;
$i = 1;
while (true) {
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
WHERE templateGroupFolderName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
FileUtil::addTrailingSlash($templateGroupFolderName),
]);
foreach ($packageToTemplates as $package => $templates) {
// try to find package
$sql = "SELECT *
- FROM wcf" . WCF_N . "_package
+ FROM wcf1_package
WHERE package = ?
AND isApplication = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$package,
1,
protected static function saveLocalizedDescriptions(self $styleEditor, array $descriptions)
{
// localize package information
- $sql = "REPLACE INTO wcf" . WCF_N . "_language_item
+ $sql = "REPLACE INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageCategoryID, packageID)
VALUES (?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
// get language list
$languageList = new LanguageList();
// workaround for WCFSetup
if (!PACKAGE_ID) {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_language_category
+ FROM wcf1_language_category
WHERE languageCategory = ?";
- $statement2 = WCF::getDB()->prepareStatement($sql);
+ $statement2 = WCF::getDB()->prepare($sql);
$statement2->execute(['wcf.style']);
$languageCategory = $statement2->fetchObject(LanguageCategory::class);
} else {
// fetch style description
$sql = "SELECT language.languageCode, language_item.languageItemValue
- FROM wcf" . WCF_N . "_language_item language_item
- LEFT JOIN wcf" . WCF_N . "_language language
+ FROM wcf1_language_item language_item
+ LEFT JOIN wcf1_language language
ON language.languageID = language_item.languageID
WHERE language_item.languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->styleDescription]);
$styleDescriptions = $statement->fetchMap('languageCode', 'languageItemValue');
// append templates to tar
// get templates
$sql = "SELECT template.*, package.package
- FROM wcf" . WCF_N . "_template template
- LEFT JOIN wcf" . WCF_N . "_package package
+ FROM wcf1_template template
+ LEFT JOIN wcf1_package package
ON package.packageID = template.packageID
WHERE template.templateGroupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->templateGroupID]);
while ($row = $statement->fetchArray()) {
$packageDir = 'com.woltlab.wcf';
// check if no default style is defined
$sql = "SELECT styleID
- FROM wcf" . WCF_N . "_style
+ FROM wcf1_style
WHERE isDefault = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([1]);
$row = $statement->fetchArray();
public static function getTag($name, $languageID = 0)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_tag
+ FROM wcf1_tag
WHERE languageID = ?
AND name = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$languageID, $name]);
return $statement->fetchObject(self::class);
// find tags
$sql = "SELECT tagID, name
- FROM wcf" . WCF_N . "_tag
+ FROM wcf1_tag
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql, 5);
+ $statement = WCF::getDB()->prepare($sql, 5);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
$list[] = [
}
// assign all associations for the synonym with this tag
- $sql = "UPDATE IGNORE wcf" . WCF_N . "_tag_to_object
+ $sql = "UPDATE IGNORE wcf1_tag_to_object
SET tagID = ?
WHERE tagID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->tagID, $synonym->tagID]);
// remove remaining associations (object was tagged with both tags => duplicate key previously ignored)
- $sql = "DELETE FROM wcf" . WCF_N . "_tag_to_object
+ $sql = "DELETE FROM wcf1_tag_to_object
WHERE tagID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$synonym->tagID]);
$editor = new self($synonym);
if ($id !== null) {
$sql = "SELECT template.*, template_group.templateGroupFolderName,
package.package
- FROM wcf" . WCF_N . "_template template
- LEFT JOIN wcf" . WCF_N . "_template_group template_group
+ FROM wcf1_template template
+ LEFT JOIN wcf1_template_group template_group
ON template_group.templateGroupID = template.templateGroupID
- LEFT JOIN wcf" . WCF_N . "_package package
+ LEFT JOIN wcf1_package package
ON package.packageID = template.packageID
WHERE template.templateID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$id]);
$row = $statement->fetchArray();
if ($templateGroupID != $this->templateGroupID) {
// get folder name
$sql = "SELECT templateGroupFolderName
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
WHERE templateGroupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$templateGroupID]);
$row = $statement->fetchArray();
$this->object->data['templateGroupFolderName'] = $row['templateGroupFolderName'];
{
$this->deleteFile();
- $sql = "DELETE FROM wcf" . WCF_N . "_template
+ $sql = "DELETE FROM wcf1_template
WHERE templateID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->templateID]);
}
$this->sqlSelects = 'package.package, template_group.templateGroupFolderName';
$this->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_package package
+ LEFT JOIN wcf1_package package
ON package.packageID = template.packageID
- LEFT JOIN wcf" . WCF_N . "_template_group template_group
+ LEFT JOIN wcf1_template_group template_group
ON template_group.templateGroupID = template.templateGroupID";
}
}
self::$templateGroupStructure = [];
$sql = "SELECT *
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
ORDER BY templateGroupName ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
self::$templateGroupStructure[$row['parentTemplateGroupID'] ?: 0][] = new self(null, $row);
// validate name
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
WHERE templateGroupName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->parameters['templateGroupName']]);
if ($statement->fetchSingleColumn()) {
}
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
WHERE templateGroupFolderName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->parameters['templateGroupFolderName']]);
if ($statement->fetchSingleColumn()) {
// check template group folders in other applications
$sql = "SELECT DISTINCT application
- FROM wcf" . WCF_N . "_template
+ FROM wcf1_template
WHERE templateGroupID = ?
AND application <> ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->templateGroupID, 'wcf']);
while ($row = $statement->fetchArray()) {
$application = ApplicationHandler::getInstance()->getApplication($row['application']);
// check template group folders in other applications
$sql = "SELECT DISTINCT application
- FROM wcf" . WCF_N . "_template
+ FROM wcf1_template
WHERE templateGroupID = ?
AND application <> ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->templateGroupID, 'wcf']);
while ($row = $statement->fetchArray()) {
$application = ApplicationHandler::getInstance()->getApplication($row['application']);
$userTrophyList->sqlJoins .= ' ';
}
$userTrophyList->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_trophy trophy
+ LEFT JOIN wcf1_trophy trophy
ON user_trophy.trophyID = trophy.trophyID
- LEFT JOIN wcf' . WCF_N . '_category category
+ LEFT JOIN wcf1_category category
ON trophy.categoryID = category.categoryID';
$userTrophyList->getConditionBuilder()->add('trophy.isDisabled = ?', [0]);
if (!empty($disabledTrophyIDs)) {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('trophyID IN (?)', [$disabledTrophyIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_user_special_trophy
+ $sql = "DELETE FROM wcf1_user_special_trophy
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
// update trophy points
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('trophyID IN (?)', [$disabledTrophyIDs]);
$sql = "SELECT COUNT(*) as count, userID
- FROM wcf" . WCF_N . "_user_trophy
+ FROM wcf1_user_trophy
" . $conditionBuilder . "
GROUP BY userID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('trophyID IN (?)', [$enabledTrophyIDs]);
$sql = "SELECT COUNT(*) as count, userID
- FROM wcf" . WCF_N . "_user_trophy
+ FROM wcf1_user_trophy
" . $conditionBuilder . "
GROUP BY userID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
*/
public function updatePosition()
{
- $sql = "UPDATE wcf" . WCF_N . "_trophy
+ $sql = "UPDATE wcf1_trophy
SET showOrder = ?
WHERE trophyID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$showOrder = $this->parameters['data']['offset'];
WCF::getDB()->beginTransaction();
public function setShowOrder($showOrder = 0)
{
$sql = "SELECT MAX(showOrder)
- FROM wcf" . WCF_N . "_trophy";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_trophy";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$maxShowOrder = $statement->fetchSingleColumn();
if (!$maxShowOrder) {
$newShowOrder = $maxShowOrder + 1;
} else {
// shift other trophies
- $sql = "UPDATE wcf" . WCF_N . "_trophy
+ $sql = "UPDATE wcf1_trophy
SET showOrder = showOrder + 1
WHERE showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$showOrder,
]);
{
if ($id !== null) {
$sql = "SELECT unfurl_url.*, unfurl_url_image.*
- FROM wcf" . WCF_N . "_unfurl_url unfurl_url
- LEFT JOIN wcf" . WCF_N . "_unfurl_url_image unfurl_url_image
+ FROM wcf1_unfurl_url unfurl_url
+ LEFT JOIN wcf1_unfurl_url_image unfurl_url_image
ON unfurl_url_image.imageID = unfurl_url.imageID
WHERE unfurl_url.urlID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$id]);
$row = $statement->fetchArray();
}
$sql = "SELECT unfurl_url.*, unfurl_url_image.*
- FROM wcf" . WCF_N . "_unfurl_url unfurl_url
- LEFT JOIN wcf" . WCF_N . "_unfurl_url_image unfurl_url_image
+ FROM wcf1_unfurl_url unfurl_url
+ LEFT JOIN wcf1_unfurl_url_image unfurl_url_image
ON unfurl_url_image.imageID = unfurl_url.imageID
WHERE unfurl_url.urlHash = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([\sha1($url)]);
$row = $statement->fetchArray();
if (!$row) {
}
// save object
- $sql = "INSERT INTO wcf" . WCF_N . "_unfurl_url_image
+ $sql = "INSERT INTO wcf1_unfurl_url_image
(" . $keys . ")
VALUES (" . $values . ")";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($statementParameters);
- return WCF::getDB()->getInsertID("wcf" . WCF_N . "_unfurl_url_image", "imageID");
+ return WCF::getDB()->getInsertID("wcf1_unfurl_url_image", "imageID");
}
/**
}
$this->sqlSelects .= "unfurl_url_image.*";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_unfurl_url_image unfurl_url_image
+ LEFT JOIN wcf1_unfurl_url_image unfurl_url_image
ON unfurl_url_image.imageID = unfurl_url.imageID";
}
}
public function countObjects()
{
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_group user_group,
- wcf" . WCF_N . "_user_to_group user_to_group
+ FROM wcf1_user_group user_group,
+ wcf1_user_to_group user_to_group
WHERE user_to_group.groupID = user_group.groupID
AND user_group.showOnTeamPage = 1";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
return $statement->fetchSingleColumn();
{
$this->objectIDs = [];
$sql = "SELECT user_to_group.userID AS objectID
- FROM wcf" . WCF_N . "_user_group user_group,
- wcf" . WCF_N . "_user_to_group user_to_group
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ FROM wcf1_user_group user_group,
+ wcf1_user_to_group user_to_group
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = user_to_group.userID
WHERE user_to_group.groupID = user_group.groupID
AND user_group.showOnTeamPage = 1
ORDER BY user_group.priority DESC" . (!empty($this->sqlOrderBy) ? ", " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
+ $statement = WCF::getDB()->prepare($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute();
$this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
parent::readObjects();
$sql = "SELECT user_to_group.*
- FROM wcf" . WCF_N . "_user_group user_group,
- wcf" . WCF_N . "_user_to_group user_to_group
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ FROM wcf1_user_group user_group,
+ wcf1_user_to_group user_to_group
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = user_to_group.userID
WHERE user_to_group.groupID = user_group.groupID
AND user_group.showOnTeamPage = 1
ORDER BY user_group.priority DESC" . (!empty($this->sqlOrderBy) ? ", " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
+ $statement = WCF::getDB()->prepare($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute();
while ($row = $statement->fetchArray()) {
if (!isset($this->teams[$row['groupID']])) {
{
if ($id !== null) {
$sql = "SELECT user_option_value.*, user_table.*
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
WHERE user_table.userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$id]);
$row = $statement->fetchArray();
// cache does not exist or is outdated
if ($data === null || $skipCache) {
$sql = "SELECT groupID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
$this->groupIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
// cache does not exist or is outdated
if ($data === null) {
$sql = "SELECT languageID
- FROM wcf" . WCF_N . "_user_to_language
+ FROM wcf1_user_to_language
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
$this->languageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
public static function getUserByUsername($username)
{
$sql = "SELECT user_option_value.*, user_table.*
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
WHERE user_table.username = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$username]);
$row = $statement->fetchArray();
if (!$row) {
public static function getUserByEmail($email)
{
$sql = "SELECT user_option_value.*, user_table.*
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
WHERE user_table.email = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$email]);
$row = $statement->fetchArray();
if (!$row) {
public static function getUserByAuthData($authData)
{
$sql = "SELECT user_option_value.*, user_table.*
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
WHERE user_table.authData = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$authData]);
$row = $statement->fetchArray();
if (!$row) {
$conditions->add("userID IN (?)", [$this->objectIDs]);
$sql = "SELECT DISTINCT groupID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$groupIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('userID IN (?)', [$this->objectIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET banned = ?,
banReason = ?,
banExpires = ?
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(
\array_merge([
1,
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('userID IN (?)', [$this->objectIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET banned = ?,
banExpires = ?
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(
\array_merge([
0,
if (PACKAGE_ID) {
// set default notifications
- $sql = "INSERT INTO wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "INSERT INTO wcf1_user_notification_event_to_user
(userID, eventID, mailNotificationType)
SELECT ?, eventID, presetMailNotificationType
- FROM wcf" . WCF_N . "_user_notification_event
+ FROM wcf1_user_notification_event
WHERE preset = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$user->userID, 1]);
// update user rank
WCF::getDB()->beginTransaction();
// update article
- $sql = "UPDATE wcf" . WCF_N . "_article
+ $sql = "UPDATE wcf1_article
SET username = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$username, $userID]);
// update comments
- $sql = "UPDATE wcf" . WCF_N . "_comment
+ $sql = "UPDATE wcf1_comment
SET username = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$username, $userID]);
// update comment responses
- $sql = "UPDATE wcf" . WCF_N . "_comment_response
+ $sql = "UPDATE wcf1_comment_response
SET username = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$username, $userID]);
// update media
- $sql = "UPDATE wcf" . WCF_N . "_media
+ $sql = "UPDATE wcf1_media
SET username = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$username, $userID]);
// update modification log
- $sql = "UPDATE wcf" . WCF_N . "_modification_log
+ $sql = "UPDATE wcf1_modification_log
SET username = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$username, $userID]);
WCF::getDB()->commitTransaction();
// get objects
$sql = "SELECT user_option_value.*, user_table.*
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
WHERE user_table.userID IN (" . \str_repeat('?,', \count($this->objectIDs) - 1) . "?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->objectIDs);
while ($object = $statement->fetchObject($baseClass)) {
$this->objects[] = new $this->className($object);
self::$userOptionDefaultValues = [];
$sql = "SELECT optionID, defaultValue
- FROM wcf" . WCF_N . "_user_option
+ FROM wcf1_user_option
WHERE defaultValue IS NOT NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
self::$userOptionDefaultValues[$row['optionID']] = $row['defaultValue'];
$statementParameters[] = $optionValue;
}
- $sql = "INSERT INTO wcf" . WCF_N . "_user_option_value
+ $sql = "INSERT INTO wcf1_user_option_value
(userID" . $keys . ")
VALUES (?" . $values . ")";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($statementParameters);
}
$statementParameters[] = $this->userID;
if (!empty($updateSQL)) {
- $sql = "UPDATE wcf" . WCF_N . "_user_option_value
+ $sql = "UPDATE wcf1_user_option_value
SET " . $updateSQL . "
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($statementParameters);
}
}
// remove old groups
if ($deleteOldGroups) {
- $sql = "DELETE FROM wcf" . WCF_N . "_user_to_group
+ $sql = "DELETE FROM wcf1_user_to_group
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
}
// insert new groups
if (!empty($groupIDs)) {
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_user_to_group
+ $sql = "INSERT IGNORE INTO wcf1_user_to_group
(userID, groupID)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($groupIDs as $groupID) {
$statement->execute([$this->userID, $groupID]);
}
*/
public function addToGroup(int $groupID): void
{
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_user_to_group
+ $sql = "INSERT IGNORE INTO wcf1_user_to_group
(userID, groupID)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID, $groupID]);
}
*/
public function removeFromGroup(int $groupID): void
{
- $sql = "DELETE FROM wcf" . WCF_N . "_user_to_group
+ $sql = "DELETE FROM wcf1_user_to_group
WHERE userID = ?
AND groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID, $groupID]);
}
*/
public function removeFromGroups(array $groupIDs): void
{
- $sql = "DELETE FROM wcf" . WCF_N . "_user_to_group
+ $sql = "DELETE FROM wcf1_user_to_group
WHERE userID = ?
AND groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($groupIDs as $groupID) {
$statement->execute([
$this->userID,
{
// remove previous languages
if ($deleteOldLanguages) {
- $sql = "DELETE FROM wcf" . WCF_N . "_user_to_language
+ $sql = "DELETE FROM wcf1_user_to_language
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
}
// insert language ids
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_user_to_language
+ $sql = "INSERT IGNORE INTO wcf1_user_to_language
(userID, languageID)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
if (!empty($languageIDs)) {
WCF::getDB()->beginTransaction();
}
$this->sqlSelects .= "user_option_value.*";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID";
}
}
// cache does not exist or is outdated
if ($data === null) {
$sql = "SELECT followUserID
- FROM wcf" . WCF_N . "_user_follow
+ FROM wcf1_user_follow
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
$this->followingUserIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
// cache does not exist or is outdated
if ($data === null) {
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user_follow
+ FROM wcf1_user_follow
WHERE followUserID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
$this->followerUserIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
// cache does not exist or is outdated
if ($data === null) {
$sql = "SELECT ignoreUserID, type
- FROM wcf" . WCF_N . "_user_ignore
+ FROM wcf1_user_ignore
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
$this->ignoredUserIDs = $statement->fetchMap('ignoreUserID', 'type');
// cache does not exist or is outdated
if ($data === null) {
$sql = "SELECT userID, type
- FROM wcf" . WCF_N . "_user_ignore
+ FROM wcf1_user_ignore
WHERE ignoreUserID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
$this->ignoredByUserIDs = $statement->fetchMap('userID', 'type');
if ($specialTrophies === null) {
// load special trophies for the user
$sql = "SELECT trophyID
- FROM wcf" . WCF_N . "_user_special_trophy
+ FROM wcf1_user_special_trophy
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->userID]);
$specialTrophies = $statement->fetchAll(\PDO::FETCH_COLUMN);
$conditionBuilder->add('trophyID IN (?)', [$trophyDeleteIDs]);
// reset the user special trophies
- $sql = "DELETE FROM wcf" . WCF_N . "_user_special_trophy
+ $sql = "DELETE FROM wcf1_user_special_trophy
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
UserStorageHandler::getInstance()->update($this->userID, 'specialTrophies', \serialize($specialTrophies));
$conditionBuilder->add('userID IN (?)', [$rebuildUserIDs]);
$sql = "SELECT userID, trophyID
- FROM wcf" . WCF_N . "_user_special_trophy
+ FROM wcf1_user_special_trophy
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$data = \array_combine($rebuildUserIDs, \array_fill(0, \count($rebuildUserIDs), []));
$conditionBuilder->add('(userID = ? AND trophyID IN (?))', [$userID, $trophyIDs]);
}
- $sql = "DELETE FROM wcf" . WCF_N . "_user_special_trophy
+ $sql = "DELETE FROM wcf1_user_special_trophy
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
}
$conditionBuilder->add('objectTypeID IN (?)', [\array_keys($activityPointObjectTypes)]);
$sql = "SELECT objectTypeID, activityPoints, items
- FROM wcf" . WCF_N . "_user_activity_point
+ FROM wcf1_user_activity_point
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$entries = [];
while ($row = $statement->fetchArray()) {
}
$sql = "SELECT user_rank.rankID
- FROM wcf" . WCF_N . "_user_rank user_rank
- LEFT JOIN wcf" . WCF_N . "_user_group user_group
+ FROM wcf1_user_rank user_rank
+ LEFT JOIN wcf1_user_group user_group
ON user_group.groupID = user_rank.groupID
" . $conditionBuilder . "
ORDER BY user_group.priority DESC, user_rank.requiredPoints DESC, user_rank.requiredGender DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute($conditionBuilder->getParameters());
$row = $statement->fetchArray();
if ($row === false) {
}
if (!empty($userToRank)) {
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET rankID = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($userToRank as $userID => $rankID) {
$conditionBuilder->add('groupID IN (?)', [$groupIDs]);
$sql = "SELECT groupID
- FROM wcf" . WCF_N . "_user_group
+ FROM wcf1_user_group
" . $conditionBuilder . "
ORDER BY priority DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute($conditionBuilder->getParameters());
$row = $statement->fetchArray();
if ($row['groupID'] != $user->userOnlineGroupID) {
// add users to missing default user groups
if (!empty($fixUserGroupIDs)) {
- $sql = "INSERT INTO wcf" . WCF_N . "_user_to_group
+ $sql = "INSERT INTO wcf1_user_to_group
(userID, groupID)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($fixUserGroupIDs as $userID => $groupIDs) {
}
if (!empty($userToGroup)) {
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET userOnlineGroupID = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($userToGroup as $userID => $groupID) {
$this->readObjects();
}
- $sql = "DELETE FROM wcf" . WCF_N . "_user_special_trophy
+ $sql = "DELETE FROM wcf1_user_special_trophy
WHERE userID = ?";
- $deleteStatement = WCF::getDB()->prepareStatement($sql);
+ $deleteStatement = WCF::getDB()->prepare($sql);
- $sql = "INSERT INTO wcf" . WCF_N . "_user_special_trophy
+ $sql = "INSERT INTO wcf1_user_special_trophy
(userID, trophyID)
VALUES (?, ?)";
- $insertStatement = WCF::getDB()->prepareStatement($sql);
+ $insertStatement = WCF::getDB()->prepare($sql);
foreach ($this->getObjects() as $user) {
WCF::getDB()->beginTransaction();
}
$this->sqlSelects .= "user_avatar.*";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user_avatar user_avatar
+ LEFT JOIN wcf1_user_avatar user_avatar
ON user_avatar.avatarID = user_table.avatarID";
// get current location
$this->sqlSelects .= ", session.pageID, session.pageObjectID, session.lastActivityTime AS sessionLastActivityTime";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_session session
+ LEFT JOIN wcf1_session session
ON session.userID = user_table.userID";
}
public static function countIPFailures($ipAddress)
{
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_authentication_failure
+ FROM wcf1_user_authentication_failure
WHERE ipAddress = ?
AND time > ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$ipAddress, TIME_NOW - USER_AUTHENTICATION_FAILURE_TIMEOUT]);
return $statement->fetchSingleColumn();
public static function countUserFailures($userID)
{
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_authentication_failure
+ FROM wcf1_user_authentication_failure
WHERE userID = ?
AND time > ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$userID, TIME_NOW - USER_AUTHENTICATION_FAILURE_TIMEOUT]);
return $statement->fetchSingleColumn();
*/
public function delete()
{
- $sql = "DELETE FROM wcf" . WCF_N . "_user_avatar
+ $sql = "DELETE FROM wcf1_user_avatar
WHERE avatarID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->avatarID]);
$this->deleteFiles();
public static function deleteAll(array $objectIDs = [])
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_avatar
+ FROM wcf1_user_avatar
WHERE avatarID IN (" . \str_repeat('?,', \count($objectIDs) - 1) . "?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($objectIDs);
while ($avatar = $statement->fetchObject(self::$baseClass)) {
$editor = new self($avatar);
public static function getFollow($userID, $followUserID)
{
$sql = "SELECT followID
- FROM wcf" . WCF_N . "_user_follow
+ FROM wcf1_user_follow
WHERE userID = ?
AND followUserID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$userID,
$followUserID,
// check if current user is ignored by target user
$sql = "SELECT ignoreID
- FROM wcf" . WCF_N . "_user_ignore
+ FROM wcf1_user_ignore
WHERE userID = ?
AND ignoreUserID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->parameters['data']['userID'],
WCF::getUser()->userID,
{
// resolve page count
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_follow
+ FROM wcf1_user_follow
WHERE followUserID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->parameters['userID']]);
$pageCount = \ceil($statement->fetchSingleColumn() / 20);
// get user ids
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user_follow
+ FROM wcf1_user_follow
WHERE followUserID = ?";
- $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
+ $statement = WCF::getDB()->prepare($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
$statement->execute([$this->parameters['userID']]);
$userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$this->sqlSelects .= ", user_avatar.*";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = user_follow.userID
- LEFT JOIN wcf" . WCF_N . "_user_avatar user_avatar
+ LEFT JOIN wcf1_user_avatar user_avatar
ON user_avatar.avatarID = user_table.avatarID";
}
}
{
// resolve page count
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_follow
+ FROM wcf1_user_follow
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->parameters['userID']]);
$pageCount = \ceil($statement->fetchSingleColumn() / 20);
// get user ids
$sql = "SELECT followUserID
- FROM wcf" . WCF_N . "_user_follow
+ FROM wcf1_user_follow
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
+ $statement = WCF::getDB()->prepare($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
$statement->execute([$this->parameters['userID']]);
$userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$this->sqlSelects .= "user_avatar.*, user_follow.followID, user_option_value.*";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = user_follow.followUserID
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
- LEFT JOIN wcf" . WCF_N . "_user_avatar user_avatar
+ LEFT JOIN wcf1_user_avatar user_avatar
ON user_avatar.avatarID = user_table.avatarID";
$this->sqlSelects .= ", user_table.*";
$this->groupOptions = [];
$sql = "SELECT optionName, optionID
- FROM wcf" . WCF_N . "_user_group_option";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user_group_option";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$groupOptionIDs = $statement->fetchMap('optionName', 'optionID');
$conditions->add("option_value.optionID IN (?)", [$groupOptionIDs]);
$sql = "SELECT group_option.optionName, option_value.optionValue
- FROM wcf" . WCF_N . "_user_group_option_value option_value
- LEFT JOIN wcf" . WCF_N . "_user_group_option group_option
+ FROM wcf1_user_group_option_value option_value
+ LEFT JOIN wcf1_user_group_option group_option
ON group_option.optionID = option_value.optionID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$this->groupOptions = $statement->fetchMap('optionName', 'optionValue');
}
// fetch user group option values
if ($this->parameters['copyUserGroupOptions']) {
$sql = "SELECT optionID, optionValue
- FROM wcf" . WCF_N . "_user_group_option_value
+ FROM wcf1_user_group_option_value
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->groupEditor->groupID]);
} else {
$sql = "SELECT optionID, defaultValue AS optionValue
- FROM wcf" . WCF_N . "_user_group_option";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user_group_option";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
}
$groupName = 'wcf.acp.group.group' . $group->groupID;
// create group name language item
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
SELECT languageID, '" . $groupName . "', CONCAT(languageItemValue, ' (2)'), 0, languageCategoryID, packageID
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
WHERE languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->groupEditor->groupName]);
} else {
$groupName .= ' (2)';
$groupDescription = 'wcf.acp.group.groupDescription' . $group->groupID;
// create group name language item
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
SELECT languageID, '" . $groupDescription . "', languageItemValue, 0, languageCategoryID, packageID
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
WHERE languageItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->groupEditor->groupDescription]);
}
// copy members
if ($this->parameters['copyMembers']) {
- $sql = "INSERT INTO wcf" . WCF_N . "_user_to_group
+ $sql = "INSERT INTO wcf1_user_to_group
(userID, groupID)
SELECT userID, " . $group->groupID . "
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->groupEditor->groupID]);
}
// copy acl options
if ($this->parameters['copyACLOptions']) {
- $sql = "INSERT INTO wcf" . WCF_N . "_acl_option_to_group
+ $sql = "INSERT INTO wcf1_acl_option_to_group
(optionID, objectID, groupID, optionValue)
SELECT optionID, objectID, " . $group->groupID . ", optionValue
- FROM wcf" . WCF_N . "_acl_option_to_group
+ FROM wcf1_acl_option_to_group
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->groupEditor->groupID]);
// it is likely that applications or plugins use caches
return;
}
- $sql = "DELETE FROM wcf" . WCF_N . "_user_to_group
+ $sql = "DELETE FROM wcf1_user_to_group
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($groupIDs as $groupID) {
$statement->execute([$groupID]);
}
return;
}
- $sql = "DELETE FROM wcf" . WCF_N . "_user_group_option_value
+ $sql = "DELETE FROM wcf1_user_group_option_value
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($groupIDs as $groupID) {
$statement->execute([$groupID]);
}
{
WCF::getDB()->beginTransaction();
// delete old group options
- $sql = "DELETE FROM wcf" . WCF_N . "_user_group_option_value
+ $sql = "DELETE FROM wcf1_user_group_option_value
WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->groupID]);
// insert new options
- $sql = "INSERT INTO wcf" . WCF_N . "_user_group_option_value
+ $sql = "INSERT INTO wcf1_user_group_option_value
(groupID, optionID, optionValue)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($groupOptions as $id => $value) {
$statement->execute([$this->groupID, $id, $value]);
}
protected static function updateAccessibleGroups($groupID, $delete = false)
{
$sql = "SELECT optionID
- FROM wcf" . WCF_N . "_user_group_option
+ FROM wcf1_user_group_option
WHERE optionName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['admin.user.accessibleGroups']);
$optionID = $statement->fetchSingleColumn();
$groupIDs[] = $userGroup->groupID;
}
- $sql = "UPDATE wcf" . WCF_N . "_user_group_option_value
+ $sql = "UPDATE wcf1_user_group_option_value
SET optionValue = ?
WHERE groupID = ?
AND optionID = ?";
- $updateStatement = WCF::getDB()->prepareStatement($sql);
+ $updateStatement = WCF::getDB()->prepare($sql);
$sql = "SELECT groupID, optionValue
- FROM wcf" . WCF_N . "_user_group_option_value
+ FROM wcf1_user_group_option_value
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$optionID]);
while ($row = $statement->fetchArray()) {
$valueIDs = \array_filter(
}
// remove old values
- $sql = "DELETE FROM wcf" . WCF_N . "_user_group_option_value
+ $sql = "DELETE FROM wcf1_user_group_option_value
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
if (!empty($this->parameters['values'])) {
- $sql = "INSERT INTO wcf" . WCF_N . "_user_group_option_value
+ $sql = "INSERT INTO wcf1_user_group_option_value
(optionID, groupID, optionValue)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->parameters['values'] as $groupID => $optionValue) {
public static function getIgnore($ignoreUserID)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_ignore
+ FROM wcf1_user_ignore
WHERE userID = ?
AND ignoreUserID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
WCF::getUser()->userID,
$ignoreUserID,
// check if target user is following the current user
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_follow
+ FROM wcf1_user_follow
WHERE userID = ?
AND followUserID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->parameters['data']['userID'],
WCF::getUser()->userID,
$this->sqlSelects .= ", user_avatar.*";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = user_ignore.ignoreUserID
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
- LEFT JOIN wcf" . WCF_N . "_user_avatar user_avatar
+ LEFT JOIN wcf1_user_avatar user_avatar
ON user_avatar.avatarID = user_table.avatarID";
$this->sqlSelects .= ", user_table.*";
public static function getNotification($packageID, $eventID, $objectID)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_notification
+ FROM wcf1_user_notification
WHERE packageID = ?
AND eventID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$packageID, $eventID, $objectID]);
$row = $statement->fetchArray();
if ($row !== false) {
$event = parent::create();
if ($event->preset) {
- $sql = "INSERT INTO wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "INSERT INTO wcf1_user_notification_event_to_user
(userID, eventID, mailNotificationType)
SELECT userID, ?, ?
- FROM wcf" . WCF_N . "_user";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$event->eventID,
$event->presetMailNotificationType,
public function __construct()
{
$this->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = event_to_user.userID";
$this->sqlSelects = 'user_table.*';
*/
public function getDatabaseTableName()
{
- return 'wcf' . WCF_N . '_user_notification_event_to_user';
+ return 'wcf1_user_notification_event_to_user';
}
/**
public static function getUserObjectWatch($objectTypeID, $userID, $objectID)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_object_watch
+ FROM wcf1_user_object_watch
WHERE objectTypeID = ?
AND userID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeID, $userID, $objectID]);
$row = $statement->fetch();
if (!$row) {
$this->sqlSelects .= "user_avatar.*, user_option_value.*, user_group.userOnlineMarking, user_table.*";
$this->sqlConditionJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = session.userID";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = session.userID
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID
- LEFT JOIN wcf" . WCF_N . "_user_avatar user_avatar
+ LEFT JOIN wcf1_user_avatar user_avatar
ON user_avatar.avatarID = user_table.avatarID
- LEFT JOIN wcf" . WCF_N . "_user_group user_group
+ LEFT JOIN wcf1_user_group user_group
ON user_group.groupID = user_table.userOnlineGroupID";
$this->getConditionBuilder()->add('session.lastActivityTime > ?', [TIME_NOW - USER_ONLINE_TIMEOUT]);
$conditionBuilder->add('session.spiderIdentifier IS NULL');
$sql = "SELECT user_option_value.userOption" . User::getUserOptionID('canViewOnlineStatus') . " AS canViewOnlineStatus, session.userID
- FROM wcf" . WCF_N . "_session session
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ FROM wcf1_session session
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = session.userID
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$users = $userIDs = [];
/** @var UserOption $userOption */
$userOption = parent::create($parameters);
- // alter the table "wcf".WCF_N."_user_option_value" with this new option
+ // alter the table "wcf1_user_option_value" with this new option
WCF::getDB()->getEditor()->addColumn(
- 'wcf' . WCF_N . '_user_option_value',
+ 'wcf1_user_option_value',
'userOption' . $userOption->optionID,
self::getColumnDefinition($parameters['optionType'])
);
// add the default value to this column
if (isset($parameters['defaultValue']) && $parameters['defaultValue'] !== null) {
- $sql = "UPDATE wcf" . WCF_N . "_user_option_value
+ $sql = "UPDATE wcf1_user_option_value
SET userOption" . $userOption->optionID . " = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$parameters['defaultValue']]);
}
{
parent::update($parameters);
- // alter the table "wcf".WCF_N."_user_option_value" with this new option
+ // alter the table "wcf1_user_option_value" with this new option
if (isset($parameters['optionType']) && $parameters['optionType'] != $this->optionType) {
WCF::getDB()->getEditor()->alterColumn(
- 'wcf' . WCF_N . '_user_option_value',
+ 'wcf1_user_option_value',
'userOption' . $this->optionID,
'userOption' . $this->optionID,
self::getColumnDefinition($parameters['optionType'])
*/
public function delete()
{
- $sql = "DELETE FROM wcf" . WCF_N . "_user_option
+ $sql = "DELETE FROM wcf1_user_option
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->optionID]);
- WCF::getDB()->getEditor()->dropColumn('wcf' . WCF_N . '_user_option_value', 'userOption' . $this->optionID);
+ WCF::getDB()->getEditor()->dropColumn('wcf1_user_option_value', 'userOption' . $this->optionID);
}
/**
$returnValue = parent::deleteAll($objectIDs);
foreach ($objectIDs as $objectID) {
- WCF::getDB()->getEditor()->dropColumn('wcf' . WCF_N . '_user_option_value', 'userOption' . $objectID);
+ WCF::getDB()->getEditor()->dropColumn('wcf1_user_option_value', 'userOption' . $objectID);
}
return $returnValue;
{
$value = \intval(!$enable);
- $sql = "UPDATE wcf" . WCF_N . "_user_option
+ $sql = "UPDATE wcf1_user_option
SET isDisabled = ?
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$value, $this->optionID]);
}
public static function getCategoryByName($categoryName)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_option_category
+ FROM wcf1_user_option_category
WHERE categoryName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$categoryName]);
$row = $statement->fetchArray();
if ($row === false) {
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("categoryName IN (?)", [$categoryNames]);
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_user_option
+ FROM wcf1_user_option
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$count = $statement->fetchSingleColumn();
if ($count > 0) {
}
$sql = "SELECT menuItemID
- FROM wcf" . WCF_N . "_user_profile_menu_item";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user_profile_menu_item";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$menuItemIDs = [];
while ($menuItemID = $statement->fetchColumn()) {
*/
public function updatePosition()
{
- $sql = "UPDATE wcf" . WCF_N . "_user_profile_menu_item
+ $sql = "UPDATE wcf1_user_profile_menu_item
SET showOrder = ?
WHERE menuItemID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
for ($i = 0, $length = \count($this->parameters['data']['structure'][0]); $i < $length; $i++) {
public function delete()
{
// update show order
- $sql = "UPDATE wcf" . WCF_N . "_user_profile_menu_item
+ $sql = "UPDATE wcf1_user_profile_menu_item
SET showOrder = showOrder - 1
WHERE showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->showOrder]);
parent::delete();
{
if ($this->showOrder != $showOrder) {
if ($showOrder < $this->showOrder) {
- $sql = "UPDATE wcf" . WCF_N . "_user_profile_menu_item
+ $sql = "UPDATE wcf1_user_profile_menu_item
SET showOrder = showOrder + 1
WHERE showOrder >= ?
AND showOrder < ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$showOrder,
$this->showOrder,
]);
} elseif ($showOrder > $this->showOrder) {
- $sql = "UPDATE wcf" . WCF_N . "_user_profile_menu_item
+ $sql = "UPDATE wcf1_user_profile_menu_item
SET showOrder = showOrder - 1
WHERE showOrder <= ?
AND showOrder > ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$showOrder,
$this->showOrder,
if ($showOrder == 0) {
// get next number in row
$sql = "SELECT MAX(showOrder) AS showOrder
- FROM wcf" . WCF_N . "_user_profile_menu_item";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user_profile_menu_item";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$row = $statement->fetchArray();
if (!empty($row)) {
$showOrder = 1;
}
} else {
- $sql = "UPDATE wcf" . WCF_N . "_user_profile_menu_item
+ $sql = "UPDATE wcf1_user_profile_menu_item
SET showOrder = showOrder + 1
WHERE showOrder >= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$showOrder]);
}
FROM " . static::getDatabaseTableName() . "
WHERE ownerID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$ownerID, $userID]);
if ($row = $statement->fetchArray()) {
return new self(null, $row);
use wcf\system\user\GroupedUserList;
use wcf\system\WCF;
+use wcf\system\exception\UserInputException;
+use wcf\system\user\GroupedUserList;
+use wcf\system\WCF;
+
/**
* Executes profile visitor-related actions.
*
{
// resolve page count
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_profile_visitor
+ FROM wcf1_user_profile_visitor
WHERE ownerID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->parameters['userID']]);
$pageCount = \ceil($statement->fetchSingleColumn() / 20);
// get user ids
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user_profile_visitor
+ FROM wcf1_user_profile_visitor
WHERE ownerID = ?
ORDER BY time DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
+ $statement = WCF::getDB()->prepare($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
$statement->execute([$this->parameters['userID']]);
$userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
*/
public function registerVisitor()
{
- $sql = "INSERT INTO wcf" . WCF_N . "_user_profile_visitor
+ $sql = "INSERT INTO wcf1_user_profile_visitor
(ownerID, userID, time)
VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE time = VALUES(time)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->parameters['data']['ownerID'],
$this->parameters['data']['userID'],
$this->sqlSelects .= ", user_avatar.*";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = user_profile_visitor.userID
- LEFT JOIN wcf" . WCF_N . "_user_avatar user_avatar
+ LEFT JOIN wcf1_user_avatar user_avatar
ON user_avatar.avatarID = user_table.avatarID";
}
}
}
$conditionBuilder->add('userID = ?', [$userID]);
- $sql = "DELETE FROM wcf" . WCF_N . "_user_special_trophy
+ $sql = "DELETE FROM wcf1_user_special_trophy
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
UserStorageHandler::getInstance()->reset([$userID], 'specialTrophies');
$userTrophyList->sqlConditionJoins .= ' ';
}
$userTrophyList->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_trophy trophy
+ LEFT JOIN wcf1_trophy trophy
ON user_trophy.trophyID = trophy.trophyID';
$userTrophyList->sqlConditionJoins .= '
- LEFT JOIN wcf' . WCF_N . '_trophy trophy
+ LEFT JOIN wcf1_trophy trophy
ON user_trophy.trophyID = trophy.trophyID';
// trophy category join
$userTrophyList->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_category category
+ LEFT JOIN wcf1_category category
ON trophy.categoryID = category.categoryID';
$userTrophyList->sqlConditionJoins .= '
- LEFT JOIN wcf' . WCF_N . '_category category
+ LEFT JOIN wcf1_category category
ON trophy.categoryID = category.categoryID';
$userTrophyList->getConditionBuilder()->add('trophy.isDisabled = ?', [0]);
$trophyList->sqlConditionJoins .= ' ';
}
$trophyList->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_trophy trophy
+ LEFT JOIN wcf1_trophy trophy
ON user_trophy.trophyID = trophy.trophyID';
$trophyList->sqlConditionJoins .= '
- LEFT JOIN wcf' . WCF_N . '_trophy trophy
+ LEFT JOIN wcf1_trophy trophy
ON user_trophy.trophyID = trophy.trophyID';
// trophy category join
$trophyList->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_category category
+ LEFT JOIN wcf1_category category
ON trophy.categoryID = category.categoryID';
$trophyList->sqlConditionJoins .= '
- LEFT JOIN wcf' . WCF_N . '_category category
+ LEFT JOIN wcf1_category category
ON trophy.categoryID = category.categoryID';
$trophyList->getConditionBuilder()->add('trophy.isDisabled = ?', [0]);
// get activation state
$sql = "SELECT eventID, mailNotificationType
- FROM wcf" . WCF_N . "_user_notification_event_to_user
+ FROM wcf1_user_notification_event_to_user
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([WCF::getUser()->userID]);
while ($row = $statement->fetchArray()) {
$this->settings[$row['eventID']]['enabled'] = true;
*/
protected function updateActivationStates()
{
- $sql = "DELETE FROM wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "DELETE FROM wcf1_user_notification_event_to_user
WHERE eventID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
$newSettings = [];
foreach ($this->settings as $eventID => $setting) {
}
if (!empty($newSettings)) {
- $sql = "INSERT INTO wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "INSERT INTO wcf1_user_notification_event_to_user
(eventID, userID, mailNotificationType)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($newSettings as $newSetting) {
$statement->execute([
$newSetting['eventID'],
parent::save();
if ($this->event !== null) {
- $sql = "UPDATE wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "UPDATE wcf1_user_notification_event_to_user
SET mailNotificationType = ?
WHERE userID = ?
AND eventID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
'none',
$this->user->userID,
$this->event->eventID,
]);
} else {
- $sql = "UPDATE wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "UPDATE wcf1_user_notification_event_to_user
SET mailNotificationType = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
'none',
$this->user->userID,
}
$sql = "SELECT searchID
- FROM wcf" . WCF_N . "_search
+ FROM wcf1_search
WHERE searchHash = ?
AND searchType = ?
AND searchTime > ?
" . (WCF::getUser()->userID ? 'AND userID = ?' : 'AND userID IS NULL');
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($parameters);
$row = $statement->fetchArray();
if ($row !== false) {
// perform search
$sql = "SELECT user_table.userID
- FROM wcf" . WCF_N . "_user user_table
- LEFT JOIN wcf" . WCF_N . "_user_option_value option_value
+ FROM wcf1_user user_table
+ LEFT JOIN wcf1_user_option_value option_value
ON option_value.userID = user_table.userID
{$this->conditions}";
- $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
+ $statement = WCF::getDB()->prepare($sql, $this->maxResults);
$statement->execute($this->conditions->getParameters());
$this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$conditionBuilder->add('tag_to_object.tagID IN (?)', [\array_keys($this->tags)]);
$conditionBuilder->add('tag_to_object.objectID <> ?', [$this->articleContentID]);
$sql = "SELECT MAX(article.articleID), COUNT(*) AS count
- FROM wcf" . WCF_N . "_tag_to_object tag_to_object
- INNER JOIN wcf" . WCF_N . "_article_content article_content
+ FROM wcf1_tag_to_object tag_to_object
+ INNER JOIN wcf1_article_content article_content
ON tag_to_object.objectID = article_content.articleContentID
- INNER JOIN wcf" . WCF_N . "_article article
+ INNER JOIN wcf1_article article
ON article_content.articleID = article.articleID
" . $conditionBuilder . "
GROUP BY tag_to_object.objectID
HAVING COUNT(*) >= " . \round(\count($this->tags) * ARTICLE_RELATED_ARTICLES_MATCH_THRESHOLD / 100) . "
ORDER BY count DESC, MAX(article.time) DESC";
- $statement = WCF::getDB()->prepareStatement($sql, ARTICLE_RELATED_ARTICLES * 4);
+ $statement = WCF::getDB()->prepare($sql, ARTICLE_RELATED_ARTICLES * 4);
$statement->execute($conditionBuilder->getParameters());
$articleIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$this->objectList->sqlSelects .= "(
SELECT title
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleID = article.articleID
AND (
languageID IS NULL
$this->objectList->getConditionBuilder()->add(
'article.articleID NOT IN (
SELECT objectID
- FROM wcf' . WCF_N . '_label_object
+ FROM wcf1_label_object
WHERE objectTypeID = ?
AND labelID IN (?)
)',
$this->objectList->getConditionBuilder()->add(
'article.articleID IN (
SELECT objectID
- FROM wcf' . WCF_N . '_label_object
+ FROM wcf1_label_object
WHERE objectTypeID = ?
AND labelID = ?
)',
if ($this->sortField === 'title') {
$this->objectList->sqlSelects = "(
SELECT title
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleID = article.articleID
AND (
languageID IS NULL
$this->objectList->sqlSelects = '(
SELECT COUNT(*)
- FROM wcf' . WCF_N . '_user_trophy
+ FROM wcf1_user_trophy
WHERE trophyID = trophy.trophyID
) AS awarded';
$this->objectList->getConditionBuilder()->add('isDisabled = ?', [0]);
$this->objectList->sqlSelects = '(
SELECT COUNT(*)
- FROM wcf' . WCF_N . '_user_trophy
+ FROM wcf1_user_trophy
WHERE trophyID = trophy.trophyID
) AS awarded';
$this->objectList->getConditionBuilder()->add('isDisabled = ?', [0]);
if (!WCF::getUser()->userID) {
$this->objectList->getConditionBuilder()->add('user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_option_value
+ FROM wcf1_user_option_value
WHERE COALESCE(userOption' . $canViewTrophiesOptionID . ', ' . $canViewTrophyDefaultValue . ') = 0)');
} elseif (!WCF::getSession()->getPermission('admin.general.canViewPrivateUserOptions')) {
$conditionBuilder = new PreparedStatementConditionBuilder(false, 'OR');
$conditionBuilder->add('user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_option_value
+ FROM wcf1_user_option_value
WHERE (
COALESCE(userOption' . $canViewTrophiesOptionID . ', ' . $canViewTrophyDefaultValue . ') = 0
OR COALESCE(userOption' . $canViewTrophiesOptionID . ', ' . $canViewTrophyDefaultValue . ') = 1
$friendshipConditionBuilder = new PreparedStatementConditionBuilder(false);
$friendshipConditionBuilder->add('user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_option_value
+ FROM wcf1_user_option_value
WHERE COALESCE(userOption' . $canViewTrophiesOptionID . ', ' . $canViewTrophyDefaultValue . ') = 2
)');
$friendshipConditionBuilder->add(
'user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_follow
+ FROM wcf1_user_follow
WHERE followUserID = ?
)',
[WCF::getUser()->userID]
if (WCF::getUser()->userID) {
$this->objectList->sqlConditionJoins = "
- LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit
+ LEFT JOIN wcf1_tracked_visit tracked_visit
ON tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.article') . "
AND tracked_visit.objectID = article.articleID
AND tracked_visit.userID = " . WCF::getUser()->userID;
use wcf\data\language\LanguageEditor;
use wcf\data\language\SetupLanguage;
use wcf\data\package\installation\queue\PackageInstallationQueueEditor;
-use wcf\data\package\Package;
use wcf\data\user\User;
use wcf\data\user\UserAction;
use wcf\system\cache\builder\LanguageCacheBuilder;
use wcf\system\exception\UserInputException;
use wcf\system\image\adapter\GDImageAdapter;
use wcf\system\image\adapter\ImagickImageAdapter;
-use wcf\system\io\File;
use wcf\system\io\Tar;
use wcf\system\language\LanguageFactory;
use wcf\system\package\PackageArchive;
// check innodb support
$sql = "SHOW ENGINES";
- $statement = $db->prepareStatement($sql);
+ $statement = $db->prepare($sql);
$statement->execute();
$hasInnoDB = false;
while ($row = $statement->fetchArray()) {
// check for PHP's MySQL native driver
$sql = "SELECT 1";
- $statement = $db->prepareStatement($sql);
+ $statement = $db->prepare($sql);
$statement->execute();
// MySQL native driver understands data types, libmysqlclient does not
if ($statement->fetchSingleColumn() !== 1) {
$sql = "INSERT INTO wcf1_package_installation_sql_log
(packageID, sqlTable)
VALUES (?, ?)";
- $statement = self::getDB()->prepareStatement($sql);
+ $statement = self::getDB()->prepare($sql);
foreach ($matches[1] as $tableName) {
$statement->execute([1, $tableName]);
}
$sql = "INSERT INTO wcf1_package_installation_plugin
(packageID, pluginName, priority, className)
VALUES (?, ?, ?, ?)";
- $statement = self::getDB()->prepareStatement($sql);
+ $statement = self::getDB()->prepare($sql);
$statement->execute([
1,
'packageInstallationPlugin',
$sql = "SELECT languageID
FROM wcf1_language
WHERE languageCode = ?";
- $statement = self::getDB()->prepareStatement($sql);
+ $statement = self::getDB()->prepare($sql);
$statement->execute([self::$selectedLanguageCode]);
$row = $statement->fetchArray();
if (isset($row['languageID'])) {
$conditions->add("optionID IN (?)", [\array_keys($options)]);
$conditions->add("objectID = ?", [$objectID]);
- $sql = "DELETE FROM wcf" . WCF_N . "_acl_option_to_" . $type . "
+ $sql = "DELETE FROM wcf1_acl_option_to_" . $type . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$objectTypeID = \reset($options)->objectTypeID;
$values = JSON::decode($_POST['aclValues'][$type]);
}
- $sql = "INSERT INTO wcf" . WCF_N . "_acl_option_to_" . $type . "
+ $sql = "INSERT INTO wcf1_acl_option_to_" . $type . "
(optionID, objectID, " . $type . "ID, optionValue)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($values as $typeID => $optionData) {
$conditions->add("optionID IN (?)", [$optionsIDs]);
$conditions->add("objectID IN (?)", [$objectIDs]);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_acl_option_to_" . $type . "
+ FROM wcf1_acl_option_to_" . $type . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
if (!isset($data[$type][$row['objectID']])) {
if ($type == 'group') {
$conditions->add("groupID IN (?)", [\array_keys($data[$type]['option'])]);
$sql = "SELECT groupID, groupName
- FROM wcf" . WCF_N . "_user_group
+ FROM wcf1_user_group
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
} else {
$conditions->add("userID IN (?)", [\array_keys($data[$type]['option'])]);
$sql = "SELECT userID, username
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$data['user']['label'] = $statement->fetchMap('userID', 'username');
}
WCF::getDB()->beginTransaction();
foreach (['group', 'user'] as $type) {
- $sql = "DELETE FROM wcf" . WCF_N . "_acl_option_to_" . $type . "
+ $sql = "DELETE FROM wcf1_acl_option_to_" . $type . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
WCF::getDB()->commitTransaction();
];
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_acl_simple_to_user
+ FROM wcf1_acl_simple_to_user
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
$userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$sql = "SELECT groupID
- FROM wcf" . WCF_N . "_acl_simple_to_group
+ FROM wcf1_acl_simple_to_group
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
}
// users
- $sql = "DELETE FROM wcf" . WCF_N . "_acl_simple_to_user
+ $sql = "DELETE FROM wcf1_acl_simple_to_user
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
if ($values['allowAll'] == 0 && !empty($values['user'])) {
$values['user'] = ArrayUtil::toIntegerArray($values['user']);
if (!empty($values['user'])) {
- $sql = "INSERT INTO wcf" . WCF_N . "_acl_simple_to_user
+ $sql = "INSERT INTO wcf1_acl_simple_to_user
(objectTypeID, objectID, userID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($values['user'] as $userID) {
}
// groups
- $sql = "DELETE FROM wcf" . WCF_N . "_acl_simple_to_group
+ $sql = "DELETE FROM wcf1_acl_simple_to_group
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
if ($values['allowAll'] == 0 && !empty($values['group'])) {
$values['group'] = ArrayUtil::toIntegerArray($values['group']);
if (!empty($values['group'])) {
- $sql = "INSERT INTO wcf" . WCF_N . "_acl_simple_to_group
+ $sql = "INSERT INTO wcf1_acl_simple_to_group
(objectTypeID, objectID, groupID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($values['group'] as $groupID) {
private function getInnodbFlushLogAtTrxCommit(): int
{
$sql = "SELECT @@innodb_flush_log_at_trx_commit";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
return $statement->fetchSingleColumn();
}
$string = \preg_replace(
$regex,
- '${1}' . WCF_N . '_',
+ '${1}1_',
$string
);
} else {
$string = \preg_replace(
$regex,
- '${1}' . WCF_N . '_',
+ '${1}1_',
$string
);
}
$conditions->add("tmpHash IN (?)", [$this->tmpHash]);
$conditions->add("(objectID IS NULL OR objectID = 0)");
- $sql = "UPDATE wcf" . WCF_N . "_attachment
+ $sql = "UPDATE wcf1_attachment
SET objectID = ?,
tmpHash = ''
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$parameters = $conditions->getParameters();
\array_unshift($parameters, $objectID);
$parameters = $conditions->getParameters();
\array_unshift($parameters, $newObjectID);
- $sql = "UPDATE wcf" . WCF_N . "_attachment
+ $sql = "UPDATE wcf1_attachment
SET objectID = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($parameters);
}
{
// see UserNotificationHandler::fetchNotifications()
$sql = "SELECT notification.*, notification_event.eventID, object_type.objectType
- FROM wcf" . WCF_N . "_user_notification notification
- LEFT JOIN wcf" . WCF_N . "_user_notification_event notification_event
+ FROM wcf1_user_notification notification
+ LEFT JOIN wcf1_user_notification_event notification_event
ON notification_event.eventID = notification.eventID
- LEFT JOIN wcf" . WCF_N . "_object_type object_type
+ LEFT JOIN wcf1_object_type object_type
ON object_type.objectTypeID = notification_event.objectTypeID
WHERE notification.notificationID = ?
ORDER BY notification.time DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([$this->notificationID]);
/** @var UserNotification $notification */
private static function getImageIdByUrl(string $url): ?int
{
$sql = "SELECT imageID
- FROM wcf" . WCF_N . "_unfurl_url_image
+ FROM wcf1_unfurl_url_image
WHERE imageUrlHash = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([\sha1($url)]);
$imageID = $statement->fetchSingleColumn();
$accessibleCategoryIDs = ArticleCategory::getAccessibleCategoryIDs();
if (!empty($accessibleCategoryIDs)) {
$commentList->sqlJoins .= '
- INNER JOIN wcf' . WCF_N . '_article_content article_content
+ INNER JOIN wcf1_article_content article_content
ON article_content.articleContentID = comment.objectID
- INNER JOIN wcf' . WCF_N . '_article article
+ INNER JOIN wcf1_article article
ON article.articleID = article_content.articleID';
$commentList->sqlSelects = 'article_content.title';
(box.visibleEverywhere = ?
AND boxID NOT IN (
SELECT boxID
- FROM wcf' . WCF_N . '_box_to_page
+ FROM wcf1_box_to_page
WHERE pageID = ?
AND visible = ?
)) OR
boxID IN (
SELECT boxID
- FROM wcf' . WCF_N . '_box_to_page
+ FROM wcf1_box_to_page
WHERE pageID = ?
AND visible = ?
)
$showOrders = [];
if ($pageID) {
$sql = "SELECT boxID, showOrder
- FROM wcf" . WCF_N . "_page_box_order
+ FROM wcf1_page_box_order
WHERE pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$pageID]);
while ($row = $statement->fetchArray()) {
$showOrders[$row['boxID']] = $row['showOrder'];
public static function hasCustomShowOrder($pageID)
{
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_page_box_order
+ FROM wcf1_page_box_order
WHERE pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$pageID]);
return $statement->fetchSingleColumn() > 0;
if (WCF::getSession()->getPermission('user.profile.canViewUserProfile')) {
$optionID = User::getUserOptionID('canViewProfile');
$commentList->sqlJoins .= '
- INNER JOIN wcf' . WCF_N . '_user_option_value user_option_value
+ INNER JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = comment.objectID';
if (WCF::getUser()->userID) {
$objectList->getConditionBuilder()->add(
'session.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_to_group
+ FROM wcf1_user_to_group
WHERE groupID IN (
SELECT groupID
- FROM wcf' . WCF_N . '_user_group
+ FROM wcf1_user_group
WHERE showOnTeamPage = ?
)
)',
$list->sqlConditionJoins .= ' ';
}
$list->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_trophy trophy
+ LEFT JOIN wcf1_trophy trophy
ON user_trophy.trophyID = trophy.trophyID';
$list->sqlConditionJoins .= '
- LEFT JOIN wcf' . WCF_N . '_trophy trophy
+ LEFT JOIN wcf1_trophy trophy
ON user_trophy.trophyID = trophy.trophyID';
// trophy category join
$list->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_category category
+ LEFT JOIN wcf1_category category
ON trophy.categoryID = category.categoryID';
$list->sqlConditionJoins .= '
- LEFT JOIN wcf' . WCF_N . '_category category
+ LEFT JOIN wcf1_category category
ON trophy.categoryID = category.categoryID';
$list->getConditionBuilder()->add('trophy.isDisabled = ?', [0]);
if (!WCF::getUser()->userID) {
$list->getConditionBuilder()->add('user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_option_value
+ FROM wcf1_user_option_value
WHERE userOption' . $canViewTrophiesOptionID . ' = 0
)');
} elseif (!WCF::getSession()->getPermission('admin.general.canViewPrivateUserOptions')) {
$conditionBuilder = new PreparedStatementConditionBuilder(false, 'OR');
$conditionBuilder->add('user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_option_value
+ FROM wcf1_user_option_value
WHERE (
userOption' . $canViewTrophiesOptionID . ' = 0
OR userOption' . $canViewTrophiesOptionID . ' = 1
$friendshipConditionBuilder = new PreparedStatementConditionBuilder(false);
$friendshipConditionBuilder->add('user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_option_value
+ FROM wcf1_user_option_value
WHERE userOption' . $canViewTrophiesOptionID . ' = 2
)');
$friendshipConditionBuilder->add(
'user_trophy.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_follow
+ FROM wcf1_user_follow
WHERE followUserID = ?
)',
[WCF::getUser()->userID]
}
if (($this->visible && $box->visibleEverywhere) || (!$this->visible && !$box->visibleEverywhere)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_box_to_page
+ $sql = "DELETE FROM wcf1_box_to_page
WHERE boxID = ?
AND pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($pages as $page) {
$statement->execute([$box->boxID, $page->pageID]);
}
} else {
- $sql = "REPLACE INTO wcf" . WCF_N . "_box_to_page
+ $sql = "REPLACE INTO wcf1_box_to_page
(boxID, pageID, visible)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($pages as $page) {
$statement->execute([$box->boxID, $page->pageID, $this->visible ? 1 : 0]);
}
$conditionBuilder->add('userID IN (?)', [$userList->getObjectIDs()]);
$sql = "SELECT userID, groupID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$groupIDs = $statement->fetchMap('userID', 'groupID', false);
$conditionBuilder->add(
'objectID IN (
SELECT categoryID
- FROM wcf' . WCF_N . '_category
+ FROM wcf1_category
WHERE objectTypeID = ?
)',
[CategoryHandler::getInstance()->getObjectTypeByName('com.woltlab.wcf.article.category')->objectTypeID]
);
$sql = "SELECT groupID, objectID
- FROM wcf" . WCF_N . "_label_group_to_object
+ FROM wcf1_label_group_to_object
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
return $statement->fetchMap('objectID', 'groupID', false);
// get attributes
$sql = "SELECT attribute.*, bbcode.bbcodeTag
- FROM wcf" . WCF_N . "_bbcode_attribute attribute
- LEFT JOIN wcf" . WCF_N . "_bbcode bbcode
+ FROM wcf1_bbcode_attribute attribute
+ LEFT JOIN wcf1_bbcode bbcode
ON bbcode.bbcodeID = attribute.bbcodeID
ORDER BY attribute.attributeNo";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
if (!isset($attributes[$row['bbcodeTag']])) {
$list = new CategoryList();
$list->sqlSelects = "object_type.objectType";
$list->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_object_type object_type
+ LEFT JOIN wcf1_object_type object_type
ON object_type.objectTypeID = category.objectTypeID";
$list->sqlOrderBy = "category.showOrder ASC";
$list->readObjects();
public function rebuild(array $parameters)
{
$sql = "SELECT pageClassName, actionID
- FROM wcf" . WCF_N . "_clipboard_page";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_clipboard_page";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
return $statement->fetchMap('pageClassName', 'actionID', false);
{
$sql = "SELECT MIN(nextExec) AS nextExec,
MIN(afterNextExec) AS afterNextExec
- FROM wcf" . WCF_N . "_cronjob
+ FROM wcf1_cronjob
WHERE isDisabled = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([0]);
$row = $statement->fetchArray();
];
$sql = "SELECT *
- FROM wcf" . WCF_N . "_event_listener
+ FROM wcf1_event_listener
ORDER BY niceValue ASC, listenerClassName ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
/** @var EventListener $eventListener */
// get definitions
$sql = "SELECT *
- FROM wcf" . WCF_N . "_object_type_definition";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_object_type_definition";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
$data['definitions'][$row['definitionID']] = new ObjectTypeDefinition(null, $row);
// get object types
$sql = "SELECT *
- FROM wcf" . WCF_N . "_object_type object_type";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_object_type object_type";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
$data['objectTypes'][$row['objectTypeID']] = $objectType = new ObjectType(null, $row);
// option categories
$sql = "SELECT *
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ FROM " . $this->application . "1_" . $this->tableName . "_category
ORDER BY showOrder";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($category = $statement->fetchObject(OptionCategory::class)) {
$data['categories'][$category->categoryName] = $category;
// options
$sql = "SELECT *
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ FROM " . $this->application . "1_" . $this->tableName . "
ORDER BY showOrder";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
// get page titles
$sql = "SELECT pageID, languageID, title, metaDescription
- FROM wcf" . WCF_N . "_page_content";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_page_content";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
$pageID = $row['pageID'];
$objectTypeID = SimpleAclHandler::getInstance()->getObjectTypeID($parameters['objectType']);
$sql = "SELECT objectID, userID
- FROM wcf" . WCF_N . "_acl_simple_to_user
+ FROM wcf1_acl_simple_to_user
WHERE objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeID]);
while ($row = $statement->fetchArray()) {
$objectID = $row['objectID'];
}
$sql = "SELECT objectID, groupID
- FROM wcf" . WCF_N . "_acl_simple_to_group
+ FROM wcf1_acl_simple_to_group
WHERE objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeID]);
while ($row = $statement->fetchArray()) {
$objectID = $row['objectID'];
// get smilies
$sql = "SELECT *
- FROM wcf" . WCF_N . "_smiley
+ FROM wcf1_smiley
ORDER BY showOrder";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
/** @var Smiley $object */
// get all styles
$sql = "SELECT *
- FROM wcf" . WCF_N . "_style
+ FROM wcf1_style
ORDER BY styleName ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
if ($row['isDefault']) {
$conditionBuilder->add('object.objectTypeID IN (?)', [$this->objectTypeIDs]);
$conditionBuilder->add('tag.languageID IN (?)', [$this->languageIDs]);
$sql = "SELECT tag.tagID, COUNT(*) AS counter
- FROM wcf" . WCF_N . "_tag_to_object object
- INNER JOIN wcf" . WCF_N . "_tag tag
+ FROM wcf1_tag_to_object object
+ INNER JOIN wcf1_tag tag
ON tag.tagID = object.tagID
" . $conditionBuilder . "
GROUP BY tag.tagID
ORDER BY counter DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 500);
+ $statement = WCF::getDB()->prepare($sql, 500);
$statement->execute($conditionBuilder->getParameters());
$tagIDs = $statement->fetchMap('tagID', 'counter');
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('tagID IN (?)', [\array_keys($tagIDs)]);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_tag
+ FROM wcf1_tag
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
$row['counter'] = $tagIDs[$row['tagID']];
$data = [];
$birthday = 'userOption' . $userOptionID;
$sql = "SELECT userID, " . $birthday . "
- FROM wcf" . WCF_N . "_user_option_value
+ FROM wcf1_user_option_value
WHERE " . $birthday . " LIKE ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['%-' . ($parameters['month'] < 10 ? '0' : '') . $parameters['month'] . '-%']);
while ($row = $statement->fetchArray()) {
[, $month, $day] = \explode('-', $row[$birthday]);
foreach ($parameters as $groupID) {
if (UserGroup::getGroupByID($groupID)->groupType == UserGroup::GUESTS) {
$sql = "SELECT optionName, additionalData
- FROM wcf" . WCF_N . "_user_group_option
+ FROM wcf1_user_group_option
WHERE optionType = 'boolean'";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($option = $statement->fetchObject(UserGroupOption::class)) {
if ($option->excludedInTinyBuild) {
option_value.groupID,
option_table.enableOptions,
option_table.usersOnly
- FROM wcf" . WCF_N . "_user_group_option_value option_value
- LEFT JOIN wcf" . WCF_N . "_user_group_option option_table
+ FROM wcf1_user_group_option_value option_value
+ LEFT JOIN wcf1_user_group_option option_table
ON option_table.optionID = option_value.optionID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
if (
// get all option categories
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_option_category
+ FROM wcf1_user_option_category
WHERE parentCategoryName = ?
ORDER BY showOrder ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['settings']);
while ($row = $statement->fetchArray()) {
if (!isset($data['wcf.user.menu.settings'])) {
// get all menu items
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_menu_item
+ FROM wcf1_user_menu_item
ORDER BY showOrder ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
if (!isset($data[$row['parentMenuItem']])) {
// get events
$sql = "SELECT event.*, object_type.objectType
- FROM wcf" . WCF_N . "_user_notification_event event
- LEFT JOIN wcf" . WCF_N . "_object_type object_type
+ FROM wcf1_user_notification_event event
+ LEFT JOIN wcf1_object_type object_type
ON object_type.objectTypeID = event.objectTypeID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
if (!isset($data[$row['objectType']])) {
// number of members
$sql = "SELECT COUNT(*) AS amount
- FROM wcf" . WCF_N . "_user";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$data['members'] = $statement->fetchColumn();
// newest member
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
ORDER BY userID DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute();
$data['newestMember'] = UserProfileRuntimeCache::getInstance()->getObject($statement->fetchSingleColumn());
$userIDs = [];
$sql = "(
SELECT userID
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
WHERE lastActivityTime > ?
) UNION (
SELECT userID
- FROM wcf" . WCF_N . "_session
+ FROM wcf1_session
WHERE userID IS NOT NULL
AND lastActivityTime > ?
)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([TIME_NOW - 86400, TIME_NOW - USER_ONLINE_TIMEOUT]);
while ($userID = $statement->fetchColumn()) {
$userIDs[] = $userID;
// move child categories to parent category
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add("categoryID IN (?)", [$categoryIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_category
+ $sql = "UPDATE wcf1_category
SET parentCategoryID = ?
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$categoryEditor->parentCategoryID], $conditionBuilder->getParameters()));
}
$userTrophyList->sqlJoins .= ' ';
}
$userTrophyList->sqlJoins .= '
- LEFT JOIN wcf' . WCF_N . '_trophy trophy
+ LEFT JOIN wcf1_trophy trophy
ON user_trophy.trophyID = trophy.trophyID
- LEFT JOIN wcf' . WCF_N . '_category category
+ LEFT JOIN wcf1_category category
ON trophy.categoryID = category.categoryID';
$userTrophyList->getConditionBuilder()->add('trophy.isDisabled = ?', [0]);
// step 1) previous import
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_import_mapping";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_import_mapping";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
if ($statement->fetchSingleColumn()) {
CLIWCF::getReader()->println(StringUtil::stripHTML(WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.existingMapping.notice')));
// remove existing entries first, prevents conflict with INSERT
$this->unmark($objectIDs, $objectTypeID);
- $sql = "INSERT INTO wcf" . WCF_N . "_clipboard_item
+ $sql = "INSERT INTO wcf1_clipboard_item
(objectTypeID, userID, objectID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($objectIDs as $objectID) {
$statement->execute([
$objectTypeID,
$conditions->add("objectID IN (?)", [$objectIDs]);
$conditions->add("userID = ?", [WCF::getUser()->userID]);
- $sql = "DELETE FROM wcf" . WCF_N . "_clipboard_item
+ $sql = "DELETE FROM wcf1_clipboard_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
*/
public function unmarkAll($objectTypeID)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_clipboard_item
+ $sql = "DELETE FROM wcf1_clipboard_item
WHERE objectTypeID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
WCF::getUser()->userID,
// fetch object ids
$sql = "SELECT objectTypeID, objectID
- FROM wcf" . WCF_N . "_clipboard_item
+ FROM wcf1_clipboard_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
// group object ids by type name
$conditions->add("userID = ?", [WCF::getUser()->userID]);
$conditions->add("objectID IN (?)", [$objectData['objectIDs']]);
- $sql = "DELETE FROM wcf" . WCF_N . "_clipboard_item
+ $sql = "DELETE FROM wcf1_clipboard_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
}
$conditions->add("objectTypeID = ?", [$typeID]);
}
- $sql = "DELETE FROM wcf" . WCF_N . "_clipboard_item
+ $sql = "DELETE FROM wcf1_clipboard_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
}
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_clipboard_item
+ FROM wcf1_clipboard_item
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
return $statement->fetchSingleColumn() ? 1 : 0;
$conditions->add("userID IN (?)", [$userIDs]);
$sql = "SELECT userID, groupID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$userToGroup = $statement->fetchMap('userID', 'groupID', false);
);
$notificationList->getConditionBuilder()->add('user_notification.userID = ?', [WCF::getUser()->userID]);
$notificationList->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_comment comment
+ LEFT JOIN wcf1_comment comment
ON comment.commentID = user_notification.objectID
AND comment.objectTypeID = " . \intval($this->getObjectTypeID($objectType));
$notificationList->getConditionBuilder()->add('comment.objectID IN (?)', [$objectIDs]);
);
$notificationList->getConditionBuilder()->add('user_notification.userID = ?', [WCF::getUser()->userID]);
$notificationList->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_comment comment
+ LEFT JOIN wcf1_comment comment
ON comment.commentID = user_notification.baseObjectID
AND comment.objectTypeID = " . \intval($this->getObjectTypeID($objectType));
$notificationList->getConditionBuilder()->add('comment.objectID IN (?)', [$objectIDs]);
);
$notificationList->getConditionBuilder()->add('user_notification.userID = ?', [WCF::getUser()->userID]);
$notificationList->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_comment_response comment_response
+ LEFT JOIN wcf1_comment_response comment_response
ON comment_response.responseID = user_notification.objectID
- LEFT JOIN wcf" . WCF_N . "_comment comment
+ LEFT JOIN wcf1_comment comment
ON comment.commentID = comment_response.commentID";
$notificationList->getConditionBuilder()->add(
'comment.objectTypeID IN (?)',
);
$notificationList->getConditionBuilder()->add('user_notification.userID = ?', [WCF::getUser()->userID]);
$notificationList->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_comment_response comment_response
+ LEFT JOIN wcf1_comment_response comment_response
ON comment_response.responseID = user_notification.baseObjectID
- LEFT JOIN wcf" . WCF_N . "_comment comment
+ LEFT JOIN wcf1_comment comment
ON comment.commentID = comment_response.commentID";
$notificationList->getConditionBuilder()->add(
'comment.objectTypeID IN (?)',
$objectList->getConditionBuilder()->add(
$tableName . '.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_to_group
+ FROM wcf1_user_to_group
WHERE groupID IN (?)
GROUP BY userID
HAVING COUNT(userID) = ?
$objectList->getConditionBuilder()->add(
$tableName . '.userID NOT IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_to_group
+ FROM wcf1_user_to_group
WHERE groupID IN (?)
)',
[$conditionData['notGroupIDs']]
$objectList->getConditionBuilder()->add(
'user_table.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_trophy
+ FROM wcf1_user_trophy
WHERE trophyID IN (?)
GROUP BY userID
HAVING COUNT(DISTINCT trophyID) = ?
$objectList->getConditionBuilder()->add(
'user_table.userID NOT IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_trophy
+ FROM wcf1_user_trophy
WHERE trophyID IN (?)
)',
[$conditionData['notUserTrophyIDs']]
protected function getOldContactAttachmentIDs()
{
$sql = "SELECT attachmentID
- FROM wcf" . WCF_N . "_attachment
+ FROM wcf1_attachment
WHERE objectTypeID = ?
AND uploadTime < ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
ObjectTypeCache::getInstance()
->getObjectTypeIDByName('com.woltlab.wcf.attachment.objectType', 'com.woltlab.wcf.contact'),
$uniqueJobs = [];
try {
$sql = "SELECT jobID, job
- FROM wcf" . WCF_N . "_background_job
+ FROM wcf1_background_job
WHERE status = ?
AND time <= ?
ORDER BY time ASC, jobID ASC
FOR UPDATE";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
'processing',
TIME_NOW - 600, // running longer than 10 minutes
// delete jobs
$condition = new PreparedStatementConditionBuilder();
$condition->add('jobID IN (?)', [$jobIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_background_job
+ $sql = "DELETE FROM wcf1_background_job
" . $condition;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($condition->getParameters());
WCF::getDB()->commitTransaction();
$committed = false;
try {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_cronjob
+ FROM wcf1_cronjob
WHERE state <> ?
AND isDisabled = ?
AND afterNextExec <= ?
FOR UPDATE";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
Cronjob::READY,
0,
$committed = false;
try {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_cronjob
+ FROM wcf1_cronjob
WHERE isDisabled = ?
AND state = ?
AND nextExec <= ?
ORDER BY failCount ASC
FOR UPDATE";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
0,
Cronjob::READY,
// get user ids
$sql = "SELECT DISTINCT userID
- FROM wcf" . WCF_N . "_user_notification
+ FROM wcf1_user_notification
WHERE mailNotified = ?
AND time < ?
AND confirmTime = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
0,
TIME_NOW - 3600 * 23,
$conditions->add("notification.confirmTime = ?", [0]);
$sql = "SELECT notification.*, notification_event.eventID, object_type.objectType
- FROM wcf" . WCF_N . "_user_notification notification
- LEFT JOIN wcf" . WCF_N . "_user_notification_event notification_event
+ FROM wcf1_user_notification notification
+ LEFT JOIN wcf1_user_notification_event notification_event
ON notification_event.eventID = notification.eventID
- LEFT JOIN wcf" . WCF_N . "_object_type object_type
+ LEFT JOIN wcf1_object_type object_type
ON object_type.objectTypeID = notification_event.objectTypeID
" . $conditions . "
ORDER BY notification.time";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
// mark notifications as done
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$userIDs]);
$conditions->add("mailNotified = ?", [0]);
- $sql = "UPDATE wcf" . WCF_N . "_user_notification
+ $sql = "UPDATE wcf1_user_notification
SET mailNotified = 1
" . $conditions;
- $statement2 = WCF::getDB()->prepareStatement($sql);
+ $statement2 = WCF::getDB()->prepare($sql);
$statement2->execute($conditions->getParameters());
// collect data
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("notificationID IN (?)", [\array_keys($notificationObjects)]);
$sql = "SELECT notificationID, authorID
- FROM wcf" . WCF_N . "_user_notification_author
+ FROM wcf1_user_notification_author
" . $conditions . "
ORDER BY time ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$authorIDs = $authorToNotification = [];
while ($row = $statement->fetchArray()) {
$paidSubscriptionUserList = new PaidSubscriptionUserList();
$paidSubscriptionUserList->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_paid_subscription paid_subscription
+ LEFT JOIN wcf1_paid_subscription paid_subscription
ON paid_subscription.subscriptionID = paid_subscription_user.subscriptionID";
$paidSubscriptionUserList->getConditionBuilder()->add('paid_subscription_user.endDate <> ?', [0]);
$paidSubscriptionUserList->getConditionBuilder()->add(
parent::execute($cronjob);
$sql = "SELECT queueID
- FROM wcf" . WCF_N . "_moderation_queue
+ FROM wcf1_moderation_queue
WHERE status IN (?, ?, ?)
AND lastChangeTime < ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
ModerationQueue::STATUS_DONE,
ModerationQueue::STATUS_REJECTED,
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("queueID IN (?)", [$queueIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_moderation_queue
+ $sql = "DELETE FROM wcf1_moderation_queue
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
// reset moderation count for all users
return;
}
- $this->columns['wcf' . WCF_N . '_user']['registrationIpAddress'] = 'registrationDate';
+ $this->columns['wcf1_user']['registrationIpAddress'] = 'registrationDate';
parent::execute($cronjob);
SET {$ipAddressColumn} = ?
WHERE {$timestampColumn} <= ?
AND {$ipAddressColumn} <> ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
'',
TIME_NOW - 86400 * PRUNE_IP_ADDRESS, // 86400 = 1 day
$date = $d->getTimestamp();
// prepare insert statement
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_stat_daily
+ $sql = "INSERT IGNORE INTO wcf1_stat_daily
(objectTypeID, date, counter, total)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
// get object types
foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.statDailyHandler') as $objectType) {
parent::execute($cronjob);
// unban users
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET banned = ?,
banExpires = ?
WHERE banned = ?
AND banExpires <> ?
AND banExpires <= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
0,
0,
]);
// enable avatars
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET disableAvatar = ?,
disableAvatarExpires = ?
WHERE disableAvatar = ?
AND disableAvatarExpires <> ?
AND disableAvatarExpires <= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
0,
0,
]);
// enable signatures
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET disableSignature = ?,
disableSignatureExpires = ?
WHERE disableSignature = ?
AND disableSignatureExpires <> ?
AND disableSignatureExpires <= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
0,
0,
]);
// enable cover photos
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET disableCoverPhoto = ?,
disableCoverPhotoExpires = ?
WHERE disableCoverPhoto = ?
AND disableCoverPhotoExpires <> ?
AND disableCoverPhotoExpires <= ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
0,
0,
parent::execute($cronjob);
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
WHERE quitStarted > ?
AND quitStarted < ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
0,
TIME_NOW - 7 * 24 * 3600,
public function getVersion()
{
try {
- $statement = $this->prepareStatement('SELECT VERSION()');
+ $statement = $this->prepare('SELECT VERSION()');
$statement->execute();
return $statement->fetchSingleColumn();
{
$existingTables = [];
$sql = "SHOW TABLES FROM `" . $this->dbObj->getDatabaseName() . "`";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray(\PDO::FETCH_NUM)) {
$existingTables[] = $row[0];
$regex = new Regex('([a-z]+)\((.+)\)', Regex::CASE_INSENSITIVE);
$sql = "SHOW COLUMNS FROM `" . $tableName . "`";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
$regex->match($row['Type']);
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA = ?
AND TABLE_NAME = ?";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute([
$this->dbObj->getDatabaseName(),
$tableName,
$sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
" . $conditionBuilder;
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$keyColumnUsage = $statement->fetchAll(\PDO::FETCH_ASSOC);
{
$sql = "SHOW INDEX
FROM `" . $tableName . "`";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
$indices = $statement->fetchAll(\PDO::FETCH_ASSOC);
{
$indices = [];
$sql = "SHOW INDEX FROM `" . $tableName . "`";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
$indices[] = $row['Key_name'];
" . (!empty($indexDefinition) ? ',' : '') . "
" . $indexDefinition . "
) ENGINE=InnoDB ROW_FORMAT=dynamic DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
}
public function dropTable($tableName)
{
$sql = "DROP TABLE IF EXISTS `" . $tableName . "`";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
}
public function addColumn($tableName, $columnName, $columnData)
{
$sql = "ALTER TABLE `" . $tableName . "` ADD COLUMN " . $this->buildColumnDefinition($columnName, $columnData);
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
}
$newColumnName,
$newColumnData
);
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
}
}
}
- $this->dbObj->prepareStatement("ALTER TABLE `{$tableName}` " . \rtrim($queries, ','))->execute();
+ $this->dbObj->prepare("ALTER TABLE `{$tableName}` " . \rtrim($queries, ','))->execute();
}
/**
{
try {
$sql = "ALTER TABLE `" . $tableName . "` DROP COLUMN `" . $columnName . "`";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
} catch (DatabaseQueryExecutionException $e) {
if ($e->getCode() != '42000') {
public function addIndex($tableName, $indexName, $indexData)
{
$sql = "ALTER TABLE `" . $tableName . "` ADD " . $this->buildIndexDefinition($indexName, $indexData);
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
}
$sql .= " ON UPDATE " . $indexData['ON UPDATE'];
}
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
}
{
try {
$sql = "ALTER TABLE `" . $tableName . "` DROP INDEX `" . $indexName . "`";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
} catch (DatabaseQueryExecutionException $e) {
if ($e->getCode() != '42000') {
{
try {
$sql = "ALTER TABLE " . $tableName . " DROP PRIMARY KEY";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
} catch (DatabaseQueryExecutionException $e) {
if ($e->getCode() != '42000') {
{
try {
$sql = "ALTER TABLE `" . $tableName . "` DROP FOREIGN KEY `" . $indexName . "`";
- $statement = $this->dbObj->prepareStatement($sql);
+ $statement = $this->dbObj->prepare($sql);
$statement->execute();
} catch (DatabaseQueryExecutionException $e) {
if ($e->getCode() != '42000') {
*/
protected function executeStandardStatement($query)
{
- $statement = WCF::getDB()->prepareStatement($query);
+ $statement = WCF::getDB()->prepare($query);
$statement->execute();
}
*/
protected function deleteObject(\DOMElement $element)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_language_item
+ $sql = "DELETE FROM wcf1_language_item
WHERE languageItem = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$element->getAttribute('name')]);
}
}
$sqlData = $this->findExistingItem($this->getElementData($oldElement, true));
if ($sqlData !== null) {
- $statement = WCF::getDB()->prepareStatement($sqlData['sql']);
+ $statement = WCF::getDB()->prepare($sqlData['sql']);
$statement->execute($sqlData['parameters']);
$existingRow = $statement->fetchArray() ?: [];
}
// save new entry
- $sql = "INSERT INTO wcf" . WCF_N . "_edit_history_entry
+ $sql = "INSERT INTO wcf1_edit_history_entry
(objectTypeID, objectID, message, time, obsoletedAt, userID, username, editReason, obsoletedByUserID)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->getObjectTypeID($objectType),
$objectID,
$conditionBuilder->add('objectTypeID = ?', [$objectTypeID]);
$conditionBuilder->add('objectID IN (?)', [$batchObjectIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_edit_history_entry
+ $sql = "DELETE FROM wcf1_edit_history_entry
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
WCF::getDB()->commitTransaction();
// b) by a non offending user
$userIDPlaceholders = '?' . \str_repeat(',?', \count($userIDs) - 1);
$sql = "SELECT MAX(entryID)
- FROM wcf" . WCF_N . "_edit_history_entry revertTo
+ FROM wcf1_edit_history_entry revertTo
INNER JOIN (
SELECT vandalizedEntries.objectID,
vandalizedEntries.objectTypeID
- FROM wcf" . WCF_N . "_edit_history_entry vandalizedEntries
+ FROM wcf1_edit_history_entry vandalizedEntries
INNER JOIN (
SELECT MAX(newestEntries.entryID) AS entryID
- FROM wcf" . WCF_N . "_edit_history_entry newestEntries
+ FROM wcf1_edit_history_entry newestEntries
WHERE newestEntries.obsoletedAt > ?
GROUP BY newestEntries.objectTypeID, newestEntries.objectID
) newestEntries2
OR revertTo.userID NOT IN(" . $userIDPlaceholders . ")
)
GROUP BY revertTo.objectTypeID, revertTo.objectID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge(
[TIME_NOW - $timeframe],
$userIDs,
$databaseTable['username'] = 'username';
}
- $sql = "UPDATE " . \str_replace('{WCF_N}', WCF_N, $databaseTable['name']) . "
+ $sql = "UPDATE " . \str_replace('{WCF_N}', 1, $databaseTable['name']) . "
SET " . $databaseTable['username'] . " = ?
WHERE " . $databaseTable['userID'] . " = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$username, $userID]);
}
$sql = "UPDATE" . (!empty($databaseTable['ignore']) ? " IGNORE" : "") . " " . \str_replace(
'{WCF_N}',
- WCF_N,
+ 1,
$databaseTable['name']
) . "
SET " . $databaseTable['userID'] . " = ?
" . (!empty($databaseTable['username']) ? ", " . $databaseTable['username'] . " = ? " : "")
. $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge($parameters, $conditionBuilder->getParameters()));
}
}
{
$sql = "SELECT MAX(" . $columnName . ") AS maxID
FROM " . $tableName;
- $statement = $this->database->prepareStatement($sql);
+ $statement = $this->database->prepare($sql);
$statement->execute();
$row = $statement->fetchArray();
if ($row !== false) {
}
$sql = "SELECT optionName
- FROM wcf" . WCF_N . "_option
+ FROM wcf1_option
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$availableOptions = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$sql = "SELECT optionName
- FROM wcf" . WCF_N . "_user_group_option
+ FROM wcf1_user_group_option
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$availableOptions = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$sql = "SELECT userID, username
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$users = $statement->fetchMap('userID', 'username');
{
// get options
$sql = "SELECT optionName, optionID
- FROM wcf" . WCF_N . "_acl_option
+ FROM wcf1_acl_option
WHERE objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->objectTypeID]);
$this->options = $statement->fetchMap('optionName', 'optionID');
}
return 0;
}
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_acl_option_to_group
+ $sql = "INSERT IGNORE INTO wcf1_acl_option_to_group
(optionID, objectID, groupID, optionValue)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$data['optionID'], $data['objectID'], $data['groupID'], $data['optionValue']]);
return 1;
return 0;
}
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_acl_option_to_user
+ $sql = "INSERT IGNORE INTO wcf1_acl_option_to_user
(optionID, objectID, userID, optionValue)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$data['optionID'], $data['objectID'], $data['userID'], $data['optionValue']]);
return 1;
$response = CommentResponseEditor::create($data);
$sql = "SELECT responseID
- FROM wcf" . WCF_N . "_comment_response
+ FROM wcf1_comment_response
WHERE commentID = ?
ORDER BY time ASC, responseID ASC";
- $statement = WCF::getDB()->prepareStatement($sql, 5);
+ $statement = WCF::getDB()->prepare($sql, 5);
$statement->execute([$response->commentID]);
$responseIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
// update parent comment
- $sql = "UPDATE wcf" . WCF_N . "_comment
+ $sql = "UPDATE wcf1_comment
SET responseIDs = ?,
responses = responses + 1
WHERE commentID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
\serialize($responseIDs),
$response->commentID,
// get package id
$packageID = PackageCache::getInstance()->getPackageID($package);
- $sql = "INSERT INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageCategoryID, packageID)
VALUES (?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE languageItemValue = VALUES(languageItemValue)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($items as $itemData) {
$statement->execute([
if (!isset($languageCategoryIDs[$languageCategory])) {
// get language category id
$sql = "SELECT languageCategoryID
- FROM wcf" . WCF_N . "_language_category
+ FROM wcf1_language_category
WHERE languageCategory = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$languageCategory]);
$languageCategoryIDs[$languageCategory] = $statement->fetchSingleColumn();
return 0;
}
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_like
+ $sql = "INSERT IGNORE INTO wcf1_like
(objectID, objectTypeID, objectUserID, userID, time, likeValue, reactionTypeID)
VALUES (?, ?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$data['objectID'],
$this->objectTypeID,
protected static function getDislikeReactionTypeID()
{
if (self::$dislikeReactionTypeID === null) {
- $sql = "SELECT reactionTypeID FROM wcf" . WCF_N . "_reaction_type WHERE iconFile = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $sql = "SELECT reactionTypeID FROM wcf1_reaction_type WHERE iconFile = ?";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['thumbsDown.svg']);
$reaction = $statement->fetchObject(ReactionType::class);
if ($reaction === null) {
- $sql = "SELECT MAX(showOrder) FROM wcf" . WCF_N . "_reaction_type";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $sql = "SELECT MAX(showOrder) FROM wcf1_reaction_type";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$showOrder = $statement->fetchColumn();
$reaction = ReactionTypeEditor::create(['iconFile' => 'thumbsDown.svg', 'showOrder' => $showOrder + 1]);
$sql = "SELECT languageCategoryID
- FROM wcf" . WCF_N . "_language_category
+ FROM wcf1_language_category
WHERE languageCategory = ?";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute(['wcf.reactionType']);
$languageCategoryID = $statement->fetchSingleColumn();
return 0;
}
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_poll_option_vote
+ $sql = "INSERT IGNORE INTO wcf1_poll_option_vote
(pollID, optionID, userID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$data['pollID'], $data['optionID'], $data['userID']]);
return 1;
->getObjectTypeIDByName('com.woltlab.wcf.category', 'com.woltlab.wcf.article.category');
$sql = "SELECT categoryID
- FROM wcf" . WCF_N . "_category
+ FROM wcf1_category
WHERE objectTypeID = ?
AND parentCategoryID = ?
AND title = ?
ORDER BY categoryID";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([$objectTypeID, 0, 'Import']);
$categoryID = $statement->fetchSingleColumn();
if ($categoryID) {
$this->importCategoryID = $categoryID;
} else {
- $sql = "INSERT INTO wcf" . WCF_N . "_category
+ $sql = "INSERT INTO wcf1_category
(objectTypeID, parentCategoryID, title, showOrder, time)
VALUES (?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeID, 0, 'Import', 0, TIME_NOW]);
- $this->importCategoryID = WCF::getDB()->getInsertID("wcf" . WCF_N . "_category", 'categoryID');
+ $this->importCategoryID = WCF::getDB()->getInsertID("wcf1_category", 'categoryID');
}
}
}
$sql = "SELECT import_mapping.newID
- FROM wcf" . WCF_N . "_import_mapping import_mapping
+ FROM wcf1_import_mapping import_mapping
" . ($tableName ? "
LEFT JOIN " . $tableName . " object_table
ON object_table." . $indexName . " = import_mapping.newID
AND import_mapping.objectTypeID = ?
AND import_mapping.oldID = ?
" . ($tableName ? "AND object_table." . $indexName . " IS NOT NULL" : '');
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->importHash, $objectTypeID, $oldID]);
$row = $statement->fetchArray();
if ($row !== false) {
$objectTypeID = $this->objectTypes[$type]->objectTypeID;
if ($statement === null) {
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_import_mapping
+ $sql = "INSERT IGNORE INTO wcf1_import_mapping
(importHash, objectTypeID, oldID, newID)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
}
try {
$statement->execute([$this->importHash, $objectTypeID, $oldID, $newID]);
} catch (DatabaseException $e) {
// Re-prepare the statement once.
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_import_mapping
+ $sql = "INSERT IGNORE INTO wcf1_import_mapping
(importHash, objectTypeID, oldID, newID)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->importHash, $objectTypeID, $oldID, $newID]);
}
*/
public function resetMapping()
{
- $sql = "DELETE FROM wcf" . WCF_N . "_import_mapping";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $sql = "DELETE FROM wcf1_import_mapping";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$this->idMappingCache = [];
// save objects
if (!empty($additionalData['objects'])) {
- $sql = "INSERT INTO wcf" . WCF_N . "_label_group_to_object
+ $sql = "INSERT INTO wcf1_label_group_to_object
(groupID, objectTypeID, objectID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($additionalData['objects'] as $objectTypeID => $objectIDs) {
foreach ($objectIDs as $objectID) {
}
// save media content
- $sql = "INSERT INTO wcf" . WCF_N . "_media_content
+ $sql = "INSERT INTO wcf1_media_content
(mediaID, languageID, title, caption, altText)
VALUES (?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($contents as $languageID => $contentData) {
$statement->execute([
$media->mediaID,
public function __construct()
{
$sql = "SELECT smileyID, smileyCode, aliases
- FROM wcf" . WCF_N . "_smiley";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_smiley";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
->getObjectTypeIDByName('com.woltlab.wcf.category', 'com.woltlab.wcf.trophy.category');
$sql = "SELECT categoryID
- FROM wcf" . WCF_N . "_category
+ FROM wcf1_category
WHERE objectTypeID = ?
AND parentCategoryID = ?
AND title = ?
ORDER BY categoryID";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([$objectTypeID, 0, 'Import']);
$categoryID = $statement->fetchSingleColumn();
if ($categoryID) {
$this->importCategoryID = $categoryID;
} else {
- $sql = "INSERT INTO wcf" . WCF_N . "_category
+ $sql = "INSERT INTO wcf1_category
(objectTypeID, parentCategoryID, title, showOrder, time)
VALUES (?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeID, 0, 'Import', 0, TIME_NOW]);
- $this->importCategoryID = WCF::getDB()->getInsertID("wcf" . WCF_N . "_category", 'categoryID');
+ $this->importCategoryID = WCF::getDB()->getInsertID("wcf1_category", 'categoryID');
}
}
}
// update owner
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET avatarID = ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$avatar->avatarID, $data['userID']]);
return $avatar->avatarID;
$data['time'] = 0;
}
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_user_follow
+ $sql = "INSERT IGNORE INTO wcf1_user_follow
(userID, followUserID, time)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$data['userID'],
$data['followUserID'],
$data['time'],
]);
- return WCF::getDB()->getInsertID('wcf' . WCF_N . '_user_follow', 'followID');
+ return WCF::getDB()->getInsertID('wcf1_user_follow', 'followID');
}
}
{
// get default notification events
$sql = "SELECT eventID
- FROM wcf" . WCF_N . "_user_notification_event
+ FROM wcf1_user_notification_event
WHERE preset = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([1]);
$this->eventIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$this->defaultGroups[$user->pendingActivation() ? 'notActivated' : 'activated']
);
$placeholders = '(?,?)' . \str_repeat(',(?,?)', \count($groupIDs) - 1);
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_user_to_group
+ $sql = "INSERT IGNORE INTO wcf1_user_to_group
(userID, groupID)
VALUES {$placeholders}";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$parameters = [];
foreach ($groupIDs as $groupID) {
$parameters[] = $user->userID;
$statement->execute($parameters);
// save languages
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_user_to_language
+ $sql = "INSERT IGNORE INTO wcf1_user_to_language
(userID, languageID)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($languageIDs as $languageID) {
$statement->execute([
$user->userID,
if (!empty($this->eventIDs)) {
// save default user events
$placeholders = '(?,?)' . \str_repeat(',(?,?)', \count($this->eventIDs) - 1);
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_user_notification_event_to_user
+ $sql = "INSERT IGNORE INTO wcf1_user_notification_event_to_user
(userID, eventID)
VALUES {$placeholders}";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$parameters = [];
foreach ($this->eventIDs as $eventID) {
$parameters[] = $user->userID;
$newUsername = 'Duplicate' . ($i > 1 ? $i : '') . ' ' . $username;
// try username
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
WHERE username = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$newUsername]);
$row = $statement->fetchArray();
if (empty($row['userID'])) {
{
// get language category id
$sql = "SELECT languageCategoryID
- FROM wcf" . WCF_N . "_language_category
+ FROM wcf1_language_category
WHERE languageCategory = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['wcf.user.option']);
$row = $statement->fetchArray();
$this->languageCategoryID = $row['languageCategoryID'];
]);
// save name
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_language_item
+ $sql = "INSERT IGNORE INTO wcf1_language_item
(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
VALUES (?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
LanguageFactory::getInstance()->getDefaultLanguageID(),
'wcf.user.option.option' . $userOption->optionID,
$conditions->add("objectTypeID = ?", [$objectTypeID]);
$conditions->add("objectID = ?", [$objectID]);
- $sql = "DELETE FROM wcf" . WCF_N . "_label_object
+ $sql = "DELETE FROM wcf1_label_object
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
// insert new labels
if (!empty($labelIDs)) {
- $sql = "INSERT INTO wcf" . WCF_N . "_label_object
+ $sql = "INSERT INTO wcf1_label_object
(labelID, objectTypeID, objectID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($labelIDs as $labelID) {
$statement->execute([
$labelID,
$conditionBuilder->add("objectTypeID = ?", [$objectTypeID]);
$conditionBuilder->add("objectID = ?", [$objectID]);
- $sql = "DELETE FROM wcf" . WCF_N . "_label_object
+ $sql = "DELETE FROM wcf1_label_object
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
// assign new labels
if (!empty($labelIDs)) {
- $sql = "INSERT INTO wcf" . WCF_N . "_label_object
+ $sql = "INSERT INTO wcf1_label_object
(labelID, objectTypeID, objectID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($labelIDs as $labelID) {
$statement->execute([
$labelID,
$conditions->add("objectTypeID = ?", [$objectTypeID]);
$conditions->add("objectID IN (?)", [$objectIDs]);
$sql = "SELECT objectID, labelID
- FROM wcf" . WCF_N . "_label_object
+ FROM wcf1_label_object
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$labels = $statement->fetchMap('labelID', 'objectID', false);
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("objectTypeID = ?", [$objectTypeID]);
$conditions->add("objectID IN (?)", [$objectIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_label_object
+ $sql = "DELETE FROM wcf1_label_object
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
}
// called within WCFSetup
if ($this->cache === false || empty($this->cache['codes'])) {
$sql = "SELECT languageID
- FROM wcf" . WCF_N . "_language
+ FROM wcf1_language
WHERE languageCode = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$languageCode]);
$row = $statement->fetchArray();
if (isset($row['languageID'])) {
public function makeDefault($languageID)
{
// remove old default language
- $sql = "UPDATE wcf" . WCF_N . "_language
+ $sql = "UPDATE wcf1_language
SET isDefault = 0
WHERE isDefault = 1";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
// make this language to default
- $sql = "UPDATE wcf" . WCF_N . "_language
+ $sql = "UPDATE wcf1_language
SET isDefault = 1
WHERE languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$languageID]);
// rebuild language cache
public function countRecentlyDisabledCustomValues()
{
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
WHERE languageCustomItemDisableTime >= ?";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([TIME_NOW - 86400 * 7]);
return $statement->fetchSingleColumn();
{
$sql = "SELECT like_object.likes, like_object.dislikes, like_object.cumulativeLikes,
CASE WHEN like_table.likeValue IS NOT NULL THEN like_table.likeValue ELSE 0 END AS liked
- FROM wcf" . WCF_N . "_like_object like_object
- LEFT JOIN wcf" . WCF_N . "_like like_table
+ FROM wcf1_like_object like_object
+ LEFT JOIN wcf1_like like_table
ON like_table.objectTypeID = ?
AND like_table.objectID = like_object.objectID
AND like_table.userID = ?
WHERE like_object.likeObjectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$likeObject->objectTypeID,
$user->userID,
$conditionBuilder->add('action NOT IN (?)', [$ignoredActions]);
}
- $sql = "DELETE FROM wcf" . WCF_N . "_modification_log
+ $sql = "DELETE FROM wcf1_modification_log
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
$conditionBuilder->add('objectTypeID = ?', [$this->objectType->objectTypeID]);
$conditionBuilder->add('parentObjectID IN (?)', [$parentObjectIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_modification_log
+ $sql = "DELETE FROM wcf1_modification_log
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
$conditionBuilder->add('objectTypeID = ?', [$this->objectType->objectTypeID]);
$conditionBuilder->add('objectID IN (?)', [$objectIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_modification_log
+ $sql = "UPDATE wcf1_modification_log
SET parentObjectID = ?
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([$newParentObjectID], $conditionBuilder->getParameters()));
}
}
$conditions->add("languageID = ?", [$contentLanguageID]);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_media_content
+ FROM wcf1_media_content
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$viewableMedia[$row['mediaID']]->setLocalizedContent($row['languageID'], $row);
$statement = null;
if (!$isBulk) {
// prepare statement
- $sql = "INSERT INTO wcf" . WCF_N . "_message_embedded_object
+ $sql = "INSERT INTO wcf1_message_embedded_object
(messageObjectTypeID, messageID, embeddedObjectTypeID, embeddedObjectID)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
}
WCF::getDB()->commitTransaction();
// prepare statement
- $sql = "INSERT INTO wcf" . WCF_N . "_message_embedded_object
+ $sql = "INSERT INTO wcf1_message_embedded_object
(messageObjectTypeID, messageID, embeddedObjectTypeID, embeddedObjectID)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->bulkData['insert'] as $parameters) {
}
// prepare statement
- $sql = "INSERT INTO wcf" . WCF_N . "_message_embedded_object
+ $sql = "INSERT INTO wcf1_message_embedded_object
(messageObjectTypeID, messageID, embeddedObjectTypeID, embeddedObjectID)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
// call embedded object handlers
WCF::getDB()->beginTransaction();
);
$conditionBuilder->add('messageID IN (?)', [$messageIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_message_embedded_object
+ $sql = "DELETE FROM wcf1_message_embedded_object
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
// get object ids
$sql = "SELECT *
- FROM wcf" . WCF_N . "_message_embedded_object
+ FROM wcf1_message_embedded_object
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$embeddedObjects = [];
while ($row = $statement->fetchArray()) {
$conditions->add("comment_response.responseID IN (?)", [$responseIDs]);
$sql = "SELECT comment_response.responseID, comment.commentID, comment.objectTypeID, comment.objectID
- FROM wcf" . WCF_N . "_comment_response comment_response
- LEFT JOIN wcf" . WCF_N . "_comment comment
+ FROM wcf1_comment_response comment_response
+ LEFT JOIN wcf1_comment comment
ON comment.commentID = comment_response.commentID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$comments = $responses = [];
while ($row = $statement->fetchArray()) {
$sql = "SELECT " . $indexName . "
FROM " . $tableName . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
unset($queues[$row[$indexName]]);
$conditions->add("objectID IN (?)", [$objectIDs]);
$sql = "SELECT queueID
- FROM wcf" . WCF_N . "_moderation_queue
+ FROM wcf1_moderation_queue
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$queueIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
protected function addEntry($objectTypeID, $objectID, $containerID = 0, array $additionalData = [])
{
$sql = "SELECT queueID
- FROM wcf" . WCF_N . "_moderation_queue
+ FROM wcf1_moderation_queue
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
$conditionBuilder->add('objectID IN (?)', [$objectIDs]);
$sql = "SELECT queueID, objectID
- FROM wcf" . WCF_N . "_moderation_queue
+ FROM wcf1_moderation_queue
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$existingQueueIDs = $statement->fetchMap('objectID', 'queueID');
]);
}
- $sql = "INSERT INTO wcf" . WCF_N . "_moderation_queue
+ $sql = "INSERT INTO wcf1_moderation_queue
(objectTypeID, objectID, containerID, userID, time, lastChangeTime, additionalData)
VALUES (?, ?, ?, ?, ?, ?, ?)" . \str_repeat(
', (?, ?, ?, ?, ?, ?, ?)',
\count($batchObjectIDs) - 1
);
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($parameters);
}
WCF::getDB()->commitTransaction();
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('queueID IN (?)', [$batchQueueIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_moderation_queue
+ $sql = "UPDATE wcf1_moderation_queue
SET status = ?,
containerID = ?,
userID = ?,
lastChangeTime = ?,
additionalData = ?
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge(
[
ModerationQueue::STATUS_OUTSTANDING,
);
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_moderation_queue_to_user moderation_queue_to_user
- LEFT JOIN wcf" . WCF_N . "_moderation_queue moderation_queue
+ FROM wcf1_moderation_queue_to_user moderation_queue_to_user
+ LEFT JOIN wcf1_moderation_queue moderation_queue
ON moderation_queue.queueID = moderation_queue_to_user.queueID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$count = $statement->fetchSingleColumn();
$conditions->add("(moderation_queue.time > tracked_visit.visitTime OR tracked_visit.visitTime IS NULL)");
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_moderation_queue_to_user moderation_queue_to_user
- LEFT JOIN wcf" . WCF_N . "_moderation_queue moderation_queue
+ FROM wcf1_moderation_queue_to_user moderation_queue_to_user
+ LEFT JOIN wcf1_moderation_queue moderation_queue
ON moderation_queue.queueID = moderation_queue_to_user.queueID
- LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit
+ LEFT JOIN wcf1_tracked_visit tracked_visit
ON tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.moderation.queue') . "
AND tracked_visit.objectID = moderation_queue.queueID
AND tracked_visit.userID = " . WCF::getUser()->userID . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$count = $statement->fetchSingleColumn();
{
$queueList = new ModerationQueueList();
$queueList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_moderation_queue_to_user moderation_queue_to_user
+ LEFT JOIN wcf1_moderation_queue_to_user moderation_queue_to_user
ON moderation_queue_to_user.queueID = moderation_queue.queueID
AND moderation_queue_to_user.userID = " . WCF::getUser()->userID;
$queueList->getConditionBuilder()->add("moderation_queue_to_user.queueID IS NULL");
);
}
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_moderation_queue_to_user
+ $sql = "INSERT IGNORE INTO wcf1_moderation_queue_to_user
(queueID, userID, isAffected)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($assignments as $queueID => $isAffected) {
public function identifyOrphans()
{
$sql = "SELECT moderation_queue.queueID, moderation_queue.objectTypeID, moderation_queue.objectID
- FROM wcf" . WCF_N . "_moderation_queue_to_user moderation_queue_to_user
- LEFT JOIN wcf" . WCF_N . "_moderation_queue moderation_queue
+ FROM wcf1_moderation_queue_to_user moderation_queue_to_user
+ LEFT JOIN wcf1_moderation_queue moderation_queue
ON moderation_queue.queueID = moderation_queue_to_user.queueID
WHERE moderation_queue_to_user.userID = ?
AND moderation_queue_to_user.isAffected = ?
AND moderation_queue.status <> ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
WCF::getUser()->userID,
1,
if (!empty($queueIDs)) {
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("queueID IN (?)", [$queueIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_moderation_queue
+ $sql = "DELETE FROM wcf1_moderation_queue
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
CommentHandler::getInstance()->deleteObjects('com.woltlab.wcf.moderation.queue', $queueIDs);
$objectTypeID = $this->getObjectTypeID($objectType);
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_moderation_queue
+ FROM wcf1_moderation_queue
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
$objectTypeID = $this->getObjectTypeID($objectType);
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_moderation_queue
+ FROM wcf1_moderation_queue
WHERE objectTypeID = ?
AND objectID = ?
AND status IN (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
protected function addEntry($objectTypeID, $objectID, $containerID = 0, array $additionalData = [])
{
$sql = "SELECT queueID
- FROM wcf" . WCF_N . "_moderation_queue
+ FROM wcf1_moderation_queue
WHERE objectTypeID = ?
AND objectID = ?
AND status <> ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
if (self::$userOptions === null) {
self::$userOptions = [];
$sql = "SELECT optionName
- FROM wcf" . WCF_N . "_user_option
+ FROM wcf1_user_option
WHERE categoryName IN (
SELECT categoryName
- FROM wcf" . WCF_N . "_user_option_category
+ FROM wcf1_user_option_category
WHERE parentCategoryName = 'profile'
)
AND optionType <> 'boolean'";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
self::$userOptions = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
}
$sql = "SELECT packageID, templateName
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$lockedFiles = $statement->fetchMap('templateName', 'packageID');
$conditions->add('application = ?', [$this->application]);
$sql = "SELECT templateName
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($templateName = $statement->fetchColumn()) {
}
if (!empty($files)) {
- $sql = "INSERT INTO wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "INSERT INTO wcf1_" . $this->tableName . "
(packageID, templateName, application)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($files as $file) {
$statement->execute([
public static function findForm(PackageInstallationQueue $queue, $formName)
{
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_package_installation_form
+ FROM wcf1_package_installation_form
WHERE queueID = ?
AND formName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$queue->queueID,
$formName,
*/
private static function insertForm(PackageInstallationQueue $queue, FormDocument $document)
{
- $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_form
+ $sql = "INSERT INTO wcf1_package_installation_form
(queueID, formName, document)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$queue->queueID,
$document->getName(),
*/
private static function updateForm(PackageInstallationQueue $queue, FormDocument $document)
{
- $sql = "UPDATE wcf" . WCF_N . "_package_installation_form
+ $sql = "UPDATE wcf1_package_installation_form
SET document = ?
WHERE queueID = ?
AND formName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
\base64_encode(\serialize($document)),
$queue->queueID,
*/
public static function deleteForms(PackageInstallationQueue $queue)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_package_installation_form
+ $sql = "DELETE FROM wcf1_package_installation_form
WHERE queueID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$queue->queueID]);
}
public static function getForm(PackageInstallationQueue $queue, $formName)
{
$sql = "SELECT document
- FROM wcf" . WCF_N . "_package_installation_form
+ FROM wcf1_package_installation_form
WHERE queueID = ?
AND formName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$queue->queueID,
$formName,
);
$queueList->getConditionBuilder()->add("package_installation_queue.queueID NOT IN (
SELECT queueID
- FROM wcf" . WCF_N . "_package_installation_node
+ FROM wcf1_package_installation_node
)");
$queueList->readObjects();
{
// tables
foreach ($this->tableLog as $logEntry) {
- $sql = "DELETE FROM wcf" . WCF_N . "_package_installation_sql_log
+ $sql = "DELETE FROM wcf1_package_installation_sql_log
WHERE sqlTable = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$logEntry['tableName']]);
if ($logEntry['action'] == 'insert') {
- $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_sql_log
+ $sql = "INSERT INTO wcf1_package_installation_sql_log
(packageID, sqlTable)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$logEntry['packageID'],
$logEntry['tableName'],
// columns
if (!empty($this->columnLog)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_package_installation_sql_log
+ $sql = "DELETE FROM wcf1_package_installation_sql_log
WHERE sqlTable = ?
AND sqlColumn = ?";
- $deleteStatement = WCF::getDB()->prepareStatement($sql);
+ $deleteStatement = WCF::getDB()->prepare($sql);
- $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_sql_log
+ $sql = "INSERT INTO wcf1_package_installation_sql_log
(packageID, sqlTable, sqlColumn)
VALUES (?, ?, ?)";
- $insertStatement = WCF::getDB()->prepareStatement($sql);
+ $insertStatement = WCF::getDB()->prepare($sql);
foreach ($this->columnLog as $logEntry) {
$deleteStatement->execute([
// indices
if (!empty($this->indexLog)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_package_installation_sql_log
+ $sql = "DELETE FROM wcf1_package_installation_sql_log
WHERE sqlTable = ?
AND sqlIndex = ?";
- $deleteStatement = WCF::getDB()->prepareStatement($sql);
+ $deleteStatement = WCF::getDB()->prepare($sql);
- $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_sql_log
+ $sql = "INSERT INTO wcf1_package_installation_sql_log
(packageID, sqlTable, sqlIndex)
VALUES (?, ?, ?)";
- $insertStatement = WCF::getDB()->prepareStatement($sql);
+ $insertStatement = WCF::getDB()->prepare($sql);
foreach ($this->indexLog as $logEntry) {
$deleteStatement->execute([
protected function getKnownTables()
{
$sql = "SELECT packageID, sqlTable
- FROM wcf" . WCF_N . "_package_installation_sql_log
+ FROM wcf1_package_installation_sql_log
WHERE sqlColumn = ''
AND sqlIndex = ''";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$this->knownTables = $statement->fetchMap('sqlTable', 'packageID');
}
protected function getColumnOwnerID($tableName, $columnName)
{
$sql = "SELECT packageID
- FROM wcf" . WCF_N . "_package_installation_sql_log
+ FROM wcf1_package_installation_sql_log
WHERE sqlTable = ?
AND sqlColumn = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$tableName,
$columnName,
protected function getIndexOwnerID($tableName, $indexName)
{
$sql = "SELECT packageID
- FROM wcf" . WCF_N . "_package_installation_sql_log
+ FROM wcf1_package_installation_sql_log
WHERE sqlTable = ?
AND sqlIndex = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$tableName,
$indexName,
PackageEditor::deleteAll([$this->queue->packageID]);
// remove localized package info
- $sql = "DELETE FROM wcf" . WCF_N . "_language_item
+ $sql = "DELETE FROM wcf1_language_item
WHERE languageItem IN (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
'wcf.acp.package.packageName.package' . $this->queue->packageID,
'wcf.acp.package.packageDescription.package' . $this->queue->packageID,
// get existing templates
$updateTemplateIDs = [];
$sql = "SELECT templateName, templateID
- FROM wcf" . WCF_N . "_template
+ FROM wcf1_template
WHERE packageID = ?
AND application = ?
AND templateGroupID IS NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$packageID, $this->application]);
$existingTemplates = $statement->fetchMap('templateName', 'templateID');
// save new templates
- $sql = "INSERT INTO wcf" . WCF_N . "_template
+ $sql = "INSERT INTO wcf1_template
(packageID, templateName, lastModificationTime, application)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($files as $file) {
if (isset($existingTemplates[$file])) {
$updateTemplateIDs[] = $existingTemplates[$file];
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('templateID IN (?)', [$updateTemplateIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_template
+ $sql = "UPDATE wcf1_template
SET lastModificationTime = ?
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([TIME_NOW], $conditionBuilder->getParameters()));
}
}
}
if (!empty($options)) {
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE optionName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($options as $option) {
$statement->execute([
if (!empty($categories)) {
// delete options for given categories
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE categoryName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($categories as $category) {
$statement->execute([
$category['name'],
}
// delete categories
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "_category
WHERE categoryName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($categories as $category) {
$statement->execute([
if ($this->editedEntry === null) {
// search existing category
$sql = "SELECT categoryID
- FROM wcf" . WCF_N . "_" . $this->tableName . "_category
+ FROM wcf1_" . $this->tableName . "_category
WHERE categoryName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$category['categoryName'],
$objectTypeID,
$row = $statement->fetchArray();
if (!$row) {
// insert new category
- $sql = "INSERT INTO wcf" . WCF_N . "_" . $this->tableName . "_category
+ $sql = "INSERT INTO wcf1_" . $this->tableName . "_category
(packageID, objectTypeID, categoryName)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->installation->getPackageID(),
$objectTypeID,
$editedData = $this->getElementData($this->editedEntry, true);
$sql = "SELECT categoryID
- FROM wcf" . WCF_N . "_" . $this->tableName . "_category
+ FROM wcf1_" . $this->tableName . "_category
WHERE categoryName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$editedData['categoryName'],
$editedData['objectTypeID'],
// validate category name
if (isset($data['categoryname'])) {
$sql = "SELECT COUNT(categoryID)
- FROM wcf" . WCF_N . "_" . $this->tableName . "_category
+ FROM wcf1_" . $this->tableName . "_category
WHERE categoryName = ?
AND objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$data['categoryname'],
$objectTypeID,
{
// check for option existence
$sql = "SELECT optionID
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE optionName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$option['optionName'],
$option['objectTypeID'],
]);
$row = $statement->fetchArray();
if (!$row) {
- $sql = "INSERT INTO wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "INSERT INTO wcf1_" . $this->tableName . "
(packageID, objectTypeID, optionName, categoryName)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->installation->getPackageID(),
$option['objectTypeID'],
$categoryName,
]);
} else {
- $sql = "UPDATE wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "UPDATE wcf1_" . $this->tableName . "
SET categoryName = ?
WHERE optionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$categoryName,
$row['optionID'],
switch ($this->entryType) {
case 'categories':
// also delete options
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE categoryName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$name,
$this->getObjectTypeID($objectType),
$this->installation->getPackageID(),
]);
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "_category
WHERE categoryName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$name,
$this->getObjectTypeID($objectType),
break;
case 'options':
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE optionName = ?
AND objectTypeID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$name,
$this->getObjectTypeID($objectType),
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE providerName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($items as $item) {
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE providerName = ?
AND packageID = ?";
$parameters = [
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE menuItem = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
}
$sql = "SELECT COUNT(menuItemID)
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ FROM " . $this->application . "1_" . $this->tableName . "
WHERE menuItem = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$data['parentMenuItem']]);
if (!$statement->fetchSingleColumn()) {
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ FROM " . $this->application . "1_" . $this->tableName . "
WHERE menuItem = ?
AND packageID = ?";
$parameters = [
}
if (!empty($options)) {
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE optionName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($options as $option) {
$statement->execute([
if (!empty($categories)) {
// delete options for given categories
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE categoryName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($categories as $category) {
$statement->execute([
$category,
}
// delete categories
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "_category
WHERE categoryName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($categories as $category) {
$statement->execute([
// validate parent
if (!empty($data['parentCategoryName'])) {
$sql = "SELECT COUNT(categoryID)
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ FROM " . $this->application . "1_" . $this->tableName . "_category
WHERE categoryName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$data['parentCategoryName']]);
if (!$statement->fetchSingleColumn()) {
{
$hasUninstallOptions = parent::hasUninstall();
$sql = "SELECT COUNT(categoryID)
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ FROM " . $this->application . "1_" . $this->tableName . "_category
WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->installation->getPackageID()]);
return $hasUninstallOptions || $statement->fetchSingleColumn() > 0;
parent::uninstall();
// delete categories
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "_category
WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->installation->getPackageID()]);
}
protected function getExistingCategory($category)
{
$sql = "SELECT categoryID, packageID
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ FROM " . $this->application . "1_" . $this->tableName . "_category
WHERE categoryName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$category,
]);
$row = $this->getExistingCategory($category['categoryName']);
if (empty($row['categoryID'])) {
// insert new category
- $sql = "INSERT INTO " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ $sql = "INSERT INTO " . $this->application . "1_" . $this->tableName . "_category
(packageID, categoryName, parentCategoryName, permissions,
options" . ($category['showOrder'] !== null ? ",showOrder" : "") . ")
VALUES (?, ?, ?, ?, ?" . ($category['showOrder'] !== null ? ", ?" : "") . ")";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$data = [
$this->installation->getPackageID(),
}
// update existing category
- $sql = "UPDATE " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ $sql = "UPDATE " . $this->application . "1_" . $this->tableName . "_category
SET parentCategoryName = ?,
permissions = ?,
options = ?
" . (isset($category['showOrder']) ? ", showOrder = ?" : "") . "
WHERE categoryID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$data = [
$category['parentCategoryName'] ?? '',
// check if option already exists
$sql = "SELECT *
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ FROM " . $this->application . "1_" . $this->tableName . "
WHERE optionName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$data['name'],
]);
switch ($this->entryType) {
case 'categories':
// also delete options
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE categoryName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$name,
$this->installation->getPackageID(),
]);
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "_category
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "_category
WHERE categoryName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$name,
$this->installation->getPackageID(),
break;
case 'options':
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE optionName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$name,
$this->installation->getPackageID(),
EventHandler::getInstance()->fireAction($this, 'hasUninstall');
$sql = "SELECT COUNT(*)
- FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ FROM " . $this->application . "1_" . $this->tableName . "
WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->installation->getPackageID()]);
return $statement->fetchSingleColumn() > 0;
// call 'uninstall' event
EventHandler::getInstance()->fireAction($this, 'uninstall');
- $sql = "DELETE FROM " . $this->application . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM " . $this->application . "1_" . $this->tableName . "
WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->installation->getPackageID()]);
}
if ($sqlData === null) {
$row = false;
} else {
- $statement = WCF::getDB()->prepareStatement($sqlData['sql']);
+ $statement = WCF::getDB()->prepare($sqlData['sql']);
$statement->execute($sqlData['parameters']);
$row = $statement->fetchArray();
}
}
$sql = "SELECT MAX(showOrder) AS showOrder
- FROM " . $this->application . WCF_N . "_" . $this->tableName . $tableNameExtension . "
+ FROM " . $this->application . "1_" . $this->tableName . $tableNameExtension . "
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$maxShowOrder = $statement->fetchArray();
return (!$maxShowOrder) ? 1 : ($maxShowOrder['showOrder'] + 1);
} else {
// increase all showOrder values which are >= $showOrder
- $sql = "UPDATE " . $this->application . WCF_N . "_" . $this->tableName . $tableNameExtension . "
+ $sql = "UPDATE " . $this->application . "1_" . $this->tableName . $tableNameExtension . "
SET showOrder = showOrder + 1
WHERE showOrder >= ?
" . ($columnName !== null ? "AND " . $columnName . " = ?" : "");
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$data = [$showOrder];
if ($columnName !== null) {
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE bbcodeTag = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
{
// check if bbcode tag already exists
$sqlData = $this->findExistingItem($data);
- $statement = WCF::getDB()->prepareStatement($sqlData['sql']);
+ $statement = WCF::getDB()->prepare($sqlData['sql']);
$statement->execute($sqlData['parameters']);
$row = $statement->fetchArray();
if ($row && $row['packageID'] != $this->installation->getPackageID()) {
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE bbcodeTag = ?";
$parameters = [$data['bbcodeTag']];
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_box
+ FROM wcf1_box
WHERE identifier = ?
AND packageID = ?";
$parameters = [
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE actionName = ?
AND actionClassName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE actionName = ?
AND actionClassName = ?
AND packageID = ?";
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE objectName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE objectName = ?
AND packageID = ?";
$parameters = [
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND cronjobName = ?";
$parameters = [
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND environment = ?
AND eventClassName = ?
AND eventName = ?
AND inherit = ?
AND listenerClassName = ?";
- $legacyStatement = WCF::getDB()->prepareStatement($sql);
+ $legacyStatement = WCF::getDB()->prepare($sql);
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND listenerName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
if (!isset($item['attributes']['name'])) {
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND listenerName = ?";
$parameters = [
}
if (!empty($itemIDs)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE languageItemID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($itemIDs as $itemID) {
$statement->execute([
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND name = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$this->installation->getPackageID(),
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND name = ?";
$parameters = [
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_menu_item
+ FROM wcf1_menu_item
WHERE identifier = ?
AND packageID = ?";
$parameters = [
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_menu
+ FROM wcf1_menu
WHERE identifier = ?
AND packageID = ?";
$parameters = [
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE definitionName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE definitionName = ?";
$parameters = [$data['definitionName']];
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE objectType = ?
AND definitionID = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE objectType = ?
AND definitionID = ?
AND packageID = ?";
$className,
UserIntegerPropertyCondition::class,
$prefix . 'UserIntegerPropertyName',
- 'wcf' . WCF_N . '_user'
+ 'wcf1_user'
)->required()
);
$this->definitionElementChildren[$objectTypeDefinition]['propertyname'] = '';
$className,
UserTimestampPropertyCondition::class,
$prefix . 'UserTimestampPropertyName',
- 'wcf' . WCF_N . '_user'
+ 'wcf1_user'
)->required()
);
// already added above:
// try to find an existing option for updating
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE optionName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$optionName,
]);
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE pluginName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE pluginName = ?
AND packageID = ?";
$parameters = [
$parentPageID = null;
if (!empty($data['elements']['parent'])) {
$sql = "SELECT pageID
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE identifier = ?";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([$data['elements']['parent']]);
$row = $statement->fetchSingleRow();
if ($row === false) {
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE identifier = ?
AND packageID = ?";
$parameters = [
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE smileyCode = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE smileyCode = ?
AND packageID = ?";
$parameters = [
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND environment = ?
AND eventName = ?
AND name = ?
AND templateName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$this->installation->getPackageID(),
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND name = ?
AND templateName = ?
}
// save values
- $sql = "INSERT INTO wcf" . WCF_N . "_user_group_option_value
+ $sql = "INSERT INTO wcf1_user_group_option_value
(groupID, optionID, optionValue)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($values as $groupID => $value) {
$statement->execute([
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE packageID = ?
AND objectTypeID = ?
AND eventName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$this->installation->getPackageID(),
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE objectTypeID = ?
AND eventName = ?";
$parameters = [
// get optionID if it was installed by this package already
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE optionName = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$optionName,
$this->installation->getPackageID(),
$statement->execute([$this->installation->getPackageID()]);
while ($row = $statement->fetchArray()) {
WCF::getDB()->getEditor()->dropColumn(
- 'wcf' . WCF_N . '_user_option_value',
+ 'wcf1_user_option_value',
'userOption' . $row['optionID']
);
}
*/
protected function handleDelete(array $items)
{
- $sql = "DELETE FROM wcf" . WCF_N . "_" . $this->tableName . "
+ $sql = "DELETE FROM wcf1_" . $this->tableName . "
WHERE menuItem = ?
AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($items as $item) {
$statement->execute([
$item['attributes']['name'],
protected function findExistingItem(array $data)
{
$sql = "SELECT *
- FROM wcf" . WCF_N . "_" . $this->tableName . "
+ FROM wcf1_" . $this->tableName . "
WHERE menuItem = ?
AND packageID = ?";
$parameters = [
$articleList = new ViewableArticleList();
$articleList->sqlSelects = "(
SELECT title
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleID = article.articleID
AND (
languageID IS NULL
$articleList->getConditionBuilder()->add(
'article.articleID IN (
SELECT articleID
- FROM wcf' . WCF_N . '_article_content
+ FROM wcf1_article_content
WHERE title LIKE ?
)',
['%' . $searchString . '%']
{
$sql = "SELECT EXISTS(
SELECT *
- FROM wcf" . WCF_N . "_contact_recipient
+ FROM wcf1_contact_recipient
WHERE isDisabled = ?
)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([0]);
return $statement->fetchSingleColumn();
['%' . $searchString . '%', '%' . $searchString . '%']
);
$sql = "SELECT DISTINCT categoryID
- FROM wcf" . WCF_N . "_category category
- LEFT JOIN wcf" . WCF_N . "_language_item language_item
+ FROM wcf1_category category
+ LEFT JOIN wcf1_language_item language_item
ON language_item.languageItem = category.title
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql, 10);
+ $statement = WCF::getDB()->prepare($sql, 10);
$statement->execute($conditionBuilder->getParameters());
$results = [];
while ($categoryID = $statement->fetchColumn()) {
$trophyList->sqlJoins .= ', ';
}
$trophyList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_language_item language_item
+ LEFT JOIN wcf1_language_item language_item
ON language_item.languageItem = trophy.title";
$trophyList->getConditionBuilder()->add(
'(trophy.title LIKE ? OR language_item.languageItemValue LIKE ?)',
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("pollID IN (?)", [$pollIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_poll
+ $sql = "DELETE FROM wcf1_poll
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
// load poll options
$sql = "SELECT optionID, optionValue
- FROM wcf" . WCF_N . "_poll_option
+ FROM wcf1_poll_option
WHERE pollID = ?
ORDER BY showOrder ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->poll->pollID]);
while ($row = $statement->fetchArray()) {
$this->pollOptions[] = $row;
if (WCF::getUser()->userID) {
$optionList->sqlSelects = "CASE WHEN poll_option_vote.optionID IS NULL THEN '0' ELSE '1' END AS voted";
$optionList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_poll_option_vote poll_option_vote
+ LEFT JOIN wcf1_poll_option_vote poll_option_vote
ON poll_option_vote.optionID = poll_option.optionID
AND poll_option_vote.userID = " . WCF::getUser()->userID;
} else {
$sql = "SELECT like_object.*,
COALESCE(like_table.reactionTypeID, 0) AS reactionTypeID,
COALESCE(like_table.likeValue, 0) AS liked
- FROM wcf" . WCF_N . "_like_object like_object
- LEFT JOIN wcf" . WCF_N . "_like like_table
+ FROM wcf1_like_object like_object
+ LEFT JOIN wcf1_like like_table
ON like_table.objectTypeID = like_object.objectTypeID
AND like_table.objectID = like_object.objectID
AND like_table.userID = ?
\array_unshift($parameters, WCF::getUser()->userID);
} else {
$sql = "SELECT like_object.*, 0 AS liked
- FROM wcf" . WCF_N . "_like_object like_object
+ FROM wcf1_like_object like_object
" . $conditions;
}
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($parameters);
while ($row = $statement->fetchArray()) {
$this->likeObjectCache[$objectType->objectTypeID][$row['objectID']] = new LikeObject(null, $row);
$sql = "SELECT like_object.likes, like_object.dislikes, like_object.cumulativeLikes,
COALESCE(like_table.reactionTypeID, 0) AS reactionTypeID,
COALESCE(like_table.likeValue, 0) AS liked
- FROM wcf" . WCF_N . "_like_object like_object
- LEFT JOIN wcf" . WCF_N . "_like like_table
+ FROM wcf1_like_object like_object
+ LEFT JOIN wcf1_like like_table
ON like_table.objectTypeID = ?
AND like_table.objectID = like_object.objectID
AND like_table.userID = ?
WHERE like_object.likeObjectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$likeObject->objectTypeID,
$user->userID,
{
// get definition id
$sql = "SELECT definitionID
- FROM wcf" . WCF_N . "_object_type_definition
+ FROM wcf1_object_type_definition
WHERE definitionName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['com.woltlab.wcf.searchableObjectType']);
$row = $statement->fetchArray();
*/
public function getTableName(): string
{
- return 'wcf' . WCF_N . '_article_content';
+ return 'wcf1_article_content';
}
/**
*/
public function getUsernameFieldName(): string
{
- return 'wcf' . WCF_N . '_article.username';
+ return 'wcf1_article.username';
}
/**
*/
public function getTimeFieldName(): string
{
- return 'wcf' . WCF_N . '_article.time';
+ return 'wcf1_article.time';
}
/**
$conditionBuilder->add('1=0');
} else {
$conditionBuilder->add(
- 'wcf' . WCF_N . '_article.categoryID IN (?) AND wcf' . WCF_N . '_article.publicationStatus = ?',
+ 'wcf1_article.categoryID IN (?) AND wcf1_article.publicationStatus = ?',
[$articleCategoryIDs, Article::PUBLISHED]
);
}
public function getJoins(): string
{
return '
- INNER JOIN wcf' . WCF_N . '_article
- ON wcf' . WCF_N . '_article.articleID = ' . $this->getTableName() . '.articleID';
+ INNER JOIN wcf1_article
+ ON wcf1_article.articleID = ' . $this->getTableName() . '.articleID';
}
/**
*/
public function getTableName(): string
{
- return 'wcf' . WCF_N . '_page_content';
+ return 'wcf1_page_content';
}
/**
*/
public function getTimeFieldName(): string
{
- return 'wcf' . WCF_N . '_page_content.pageContentID';
+ return 'wcf1_page_content.pageContentID';
}
/**
{
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add(
- 'wcf' . WCF_N . '_page.pageType IN (?) AND wcf' . WCF_N . '_page.isDisabled = ?',
+ 'wcf1_page.pageType IN (?) AND wcf1_page.isDisabled = ?',
[['text', 'html'], 0]
);
// Exclude versions of disabled languages.
$conditionBuilder->add(
- '(wcf' . WCF_N . '_page_content.languageID IS NULL OR wcf' . WCF_N . '_page_content.languageID IN (?))',
+ '(wcf1_page_content.languageID IS NULL OR wcf1_page_content.languageID IN (?))',
[\array_keys(LanguageFactory::getInstance()->getLanguages())]
);
$this->initAclCondition($conditionBuilder);
$objectTypeID = ObjectTypeCache::getInstance()
->getObjectTypeIDByName('com.woltlab.wcf.acl.simple', 'com.woltlab.wcf.page');
$conditionBuilder->add('(
- wcf' . WCF_N . '_page_content.pageID NOT IN (
+ wcf1_page_content.pageID NOT IN (
SELECT objectID
- FROM wcf' . WCF_N . '_acl_simple_to_group
+ FROM wcf1_acl_simple_to_group
WHERE objectTypeID = ?
UNION
SELECT objectID
- FROM wcf' . WCF_N . '_acl_simple_to_user
+ FROM wcf1_acl_simple_to_user
WHERE objectTypeID = ?
)
OR
- wcf' . WCF_N . '_page_content.pageID IN (
+ wcf1_page_content.pageID IN (
SELECT objectID
- FROM wcf' . WCF_N . '_acl_simple_to_group
+ FROM wcf1_acl_simple_to_group
WHERE objectTypeID = ?
AND groupID IN (?)
UNION
SELECT objectID
- FROM wcf' . WCF_N . '_acl_simple_to_user
+ FROM wcf1_acl_simple_to_user
WHERE objectTypeID = ?
AND userID = ?
)
public function getJoins(): string
{
return '
- INNER JOIN wcf' . WCF_N . '_page
- ON wcf' . WCF_N . '_page.pageID = ' . $this->getTableName() . '.pageID';
+ INNER JOIN wcf1_page
+ ON wcf1_page.pageID = ' . $this->getTableName() . '.pageID';
}
/**
}
$sql = "SELECT searchID
- FROM wcf" . WCF_N . "_search
+ FROM wcf1_search
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
if ($searchID = $statement->fetchSingleColumn()) {
return new Search($searchID);
}
}
- return 'wcf' . WCF_N . '_search_index_' . \substr(\sha1($objectType->objectType), 0, 8);
+ return 'wcf1_search_index_' . \substr(\sha1($objectType->objectType), 0, 8);
}
}
$conditions->add("languageItemValue LIKE ?", ['%' . $query . '%']);
$sql = "SELECT languageItem, languageItemValue
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions . "
ORDER BY languageItemValue ASC";
- $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
+ $statement = WCF::getDB()->prepare($sql); // don't use a limit here
$statement->execute($conditions->getParameters());
$languageItems = $statement->fetchMap('languageItem', 'languageItemValue');
$conditions->add("menuItemController <> ''");
$sql = "SELECT *
- FROM wcf" . WCF_N . "_acp_menu_item
+ FROM wcf1_acp_menu_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
+ $statement = WCF::getDB()->prepare($sql); // don't use a limit here
$statement->execute($conditions->getParameters());
$menuItems = ACPMenu::getInstance()->menuItemList;
$conditions->add("languageItemValue LIKE ?", ['%' . $query . '%']);
$sql = "SELECT languageItem
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions . "
ORDER BY languageItemValue ASC";
- $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
+ $statement = WCF::getDB()->prepare($sql); // don't use a limit here
$statement->execute($conditions->getParameters());
$optionNames = $categoryNames = [];
while ($languageItem = $statement->fetchColumn()) {
}
$sql = "SELECT optionName, categoryName, options, permissions, hidden
- FROM wcf" . WCF_N . "_option
+ FROM wcf1_option
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
+ $statement = WCF::getDB()->prepare($sql); // don't use a limit here
$statement->execute($conditions->getParameters());
$optionCategories = OptionCacheBuilder::getInstance()->getData([], 'categories');
$conditions->add("languageItemValue LIKE ?", ['%' . $query . '%']);
$sql = "SELECT languageItem
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$packageIDs = [];
}
$sql = "SELECT *
- FROM wcf" . WCF_N . "_package
+ FROM wcf1_package
WHERE packageName LIKE ?
OR package LIKE ?
" . (\count($conditions->getParameters()) ? "OR " . $conditions : "");
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([
'%' . $query . '%',
'%' . $query . '%',
$conditions->add("languageItemValue LIKE ?", ['%' . $query . '%']);
$sql = "SELECT languageItem
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$trophyIDs = [];
}
$sql = "SELECT *
- FROM wcf" . WCF_N . "_trophy
+ FROM wcf1_trophy
WHERE title LIKE ?
" . (!empty($conditions->getParameters()) ? "OR " . $conditions : "");
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge([
'%' . $query . '%',
], $conditions->getParameters()));
}
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
{$conditionBuilder}";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$results = [];
$conditions->add("languageItemValue LIKE ?", ['%' . $query . '%']);
$sql = "SELECT languageItem
- FROM wcf" . WCF_N . "_language_item
+ FROM wcf1_language_item
" . $conditions . "
ORDER BY languageItemValue ASC";
- $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
+ $statement = WCF::getDB()->prepare($sql); // don't use a limit here
$statement->execute($conditions->getParameters());
$languageItems = [];
while ($languageItem = $statement->fetchColumn()) {
}
$sql = "SELECT optionID, optionName, categoryName, permissions, options
- FROM wcf" . WCF_N . "_user_group_option
+ FROM wcf1_user_group_option
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here
+ $statement = WCF::getDB()->prepare($sql); // don't use a limit here
$statement->execute($conditions->getParameters());
$optionCategories = UserGroupOptionCacheBuilder::getInstance()->getData([], 'categories');
try {
$messages = [];
- $statement = WCF::getDB()->prepareStatement($sql, $limit);
+ $statement = WCF::getDB()->prepare($sql, $limit);
$statement->execute($parameters);
while ($row = $statement->fetchArray()) {
$messages[] = [
if (!isset($this->minTokenSize)) {
try {
$sql = "SELECT @@innodb_ft_min_token_size";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$this->minTokenSize = $statement->fetchSingleColumn();
} catch (DatabaseQueryExecutionException $e) {
$sql = "REPLACE INTO " . SearchIndexManager::getTableName($objectType) . "
(objectID, subject, message, time, userID, username, languageID, metaData)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectID, $subject, $message, $time, $userID, $username, $languageID, $metaData]);
}
$sql = "DELETE FROM " . $tableName . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
WCF::getDB()->commitTransaction();
$this->createSearchIndex(SearchIndexManager::getInstance()->getObjectType($objectType));
$sql = "TRUNCATE TABLE " . SearchIndexManager::getTableName($objectType);
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
}
// check if table already exists
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_package_installation_sql_log
+ FROM wcf1_package_installation_sql_log
WHERE sqlTable = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$tableName]);
if ($statement->fetchSingleColumn()) {
// add comment
$sql = "ALTER TABLE " . $tableName . "
COMMENT = 'Search index for " . $objectType->objectType . "'";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
// log table
- $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_sql_log
+ $sql = "INSERT INTO wcf1_package_installation_sql_log
(packageID, sqlTable)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectType->packageID,
$tableName,
$pageList = parent::getObjectList();
$pageList->sqlConditionJoins = '
- LEFT JOIN wcf' . WCF_N . '_page page
+ LEFT JOIN wcf1_page page
ON page_content.pageID = page.pageID';
$pageList->sqlJoins = '
- LEFT JOIN wcf' . WCF_N . '_page page
+ LEFT JOIN wcf1_page page
ON page_content.pageID = page.pageID';
$pageList->getConditionBuilder()->add('page.isMultilingual = ?', [1]);
$pageList->getConditionBuilder()->add('page.allowSpidersToIndex = ?', [1]);
$sql = "SELECT (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_comment
+ FROM wcf1_comment
WHERE objectTypeID = ?
AND time BETWEEN ? AND ?
) + (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_comment_response comment_response
- LEFT JOIN wcf" . WCF_N . "_comment comment
+ FROM wcf1_comment_response comment_response
+ LEFT JOIN wcf1_comment comment
ON comment.commentID = comment_response.commentID
WHERE comment.objectTypeID = ?
AND comment_response.time BETWEEN ? AND ?
)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$date,
$sql = "SELECT (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_comment
+ FROM wcf1_comment
WHERE objectTypeID = ?
AND time < ?
) + (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_comment_response comment_response
- LEFT JOIN wcf" . WCF_N . "_comment comment
+ FROM wcf1_comment_response comment_response
+ LEFT JOIN wcf1_comment comment
ON comment.commentID = comment_response.commentID
WHERE comment.objectTypeID = ?
AND comment_response.time < ?
)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$date + 86400,
$sql = "SELECT CEIL(SUM(" . $this->columnName . ") / 1000)
FROM " . $tableName . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
return $statement->fetchSingleColumn();
$sql = "SELECT CEIL(SUM(" . $this->columnName . ") / 1000)
FROM " . $tableName . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
return $statement->fetchSingleColumn();
$sql = "SELECT COUNT(*)
FROM " . $tableName . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
return $statement->fetchSingleColumn();
$sql = "SELECT COUNT(*)
FROM " . $tableName . "
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
return $statement->fetchSingleColumn();
public function getData($date)
{
return [
- 'counter' => $this->getCounter($date, 'wcf' . WCF_N . '_attachment', 'uploadTime'),
- 'total' => $this->getTotal($date, 'wcf' . WCF_N . '_attachment', 'uploadTime'),
+ 'counter' => $this->getCounter($date, 'wcf1_attachment', 'uploadTime'),
+ 'total' => $this->getTotal($date, 'wcf1_attachment', 'uploadTime'),
];
}
}
public function getData($date)
{
return [
- 'counter' => $this->getCounter($date, 'wcf' . WCF_N . '_attachment', 'uploadTime'),
- 'total' => $this->getTotal($date, 'wcf' . WCF_N . '_attachment', 'uploadTime'),
+ 'counter' => $this->getCounter($date, 'wcf1_attachment', 'uploadTime'),
+ 'total' => $this->getTotal($date, 'wcf1_attachment', 'uploadTime'),
];
}
}
public function getData($date)
{
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_like
+ FROM wcf1_like
WHERE time BETWEEN ? AND ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$date, $date + 86399]);
$counter = \intval($statement->fetchSingleColumn());
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_like
+ FROM wcf1_like
WHERE time < ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$date + 86400]);
$total = \intval($statement->fetchSingleColumn());
public function getData($date)
{
return [
- 'counter' => $this->getCounter($date, 'wcf' . WCF_N . '_user', 'registrationDate'),
- 'total' => $this->getTotal($date, 'wcf' . WCF_N . '_user', 'registrationDate'),
+ 'counter' => $this->getCounter($date, 'wcf1_user', 'registrationDate'),
+ 'total' => $this->getTotal($date, 'wcf1_user', 'registrationDate'),
];
}
}
public static function getDefaultVariables(): array
{
$sql = "SELECT variable.variableName, variable.defaultValue
- FROM wcf" . WCF_N . "_style_variable variable
+ FROM wcf1_style_variable variable
ORDER BY variable.variableID ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$variables = $statement->fetchMap('variableName', 'defaultValue');
// read stylesheets in dependency order
$sql = "SELECT filename, application
- FROM wcf" . WCF_N . "_package_installation_file_log
+ FROM wcf1_package_installation_file_log
WHERE CONVERT(filename using utf8) REGEXP ?
AND packageID <> ?
ORDER BY packageID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
'^style/([a-zA-Z0-9\-\.]+)\.scss',
1,
// read default values
$sql = "SELECT variableName, defaultValue, defaultValueDarkMode
- FROM wcf" . WCF_N . "_style_variable
+ FROM wcf1_style_variable
ORDER BY variableID ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$variables = [];
while ($row = $statement->fetchArray()) {
// remove tags prior to apply the new ones (prevents duplicate entries)
if ($replace) {
$sql = "DELETE tag_to_object
- FROM wcf" . WCF_N . "_tag_to_object tag_to_object
- INNER JOIN wcf" . WCF_N . "_tag tag
+ FROM wcf1_tag_to_object tag_to_object
+ INNER JOIN wcf1_tag tag
ON tag.tagID = tag_to_object.tagID
WHERE tag_to_object.objectTypeID = ?
AND tag_to_object.objectID = ?
AND tag.languageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
}
// save tags
- $sql = "INSERT INTO wcf" . WCF_N . "_tag_to_object
+ $sql = "INSERT INTO wcf1_tag_to_object
(objectID, tagID, objectTypeID, languageID)
VALUES (?, ?, ?, ?)";
WCF::getDB()->beginTransaction();
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($tagIDs as $tagID) {
$statement->execute([$objectID, $tagID, $objectTypeID, $languageID]);
}
$objectTypeID = $this->getObjectTypeID($objectType);
$sql = "DELETE tag_to_object
- FROM wcf" . WCF_N . "_tag_to_object tag_to_object
- INNER JOIN wcf" . WCF_N . "_tag tag
+ FROM wcf1_tag_to_object tag_to_object
+ INNER JOIN wcf1_tag tag
ON tag.tagID = tag_to_object.tagID
WHERE tag_to_object.objectTypeID = ?
AND tag_to_object.objectID = ?
" . ($languageID !== null ? "AND tag.languageID = ?" : "");
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$parameters = [
$objectTypeID,
$objectID,
$conditionsBuilder->add('objectTypeID = ?', [$objectTypeID]);
$conditionsBuilder->add('objectID IN (?)', [$objectIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_tag_to_object
+ $sql = "DELETE FROM wcf1_tag_to_object
" . $conditionsBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionsBuilder->getParameters());
}
}
$sql = "SELECT tag.*, tag_to_object.objectID
- FROM wcf" . WCF_N . "_tag_to_object tag_to_object
- LEFT JOIN wcf" . WCF_N . "_tag tag
+ FROM wcf1_tag_to_object tag_to_object
+ LEFT JOIN wcf1_tag tag
ON tag.tagID = tag_to_object.tagID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$tags = [];
$parameters[] = \count($tags);
$sql = "SELECT objectID
- FROM wcf" . WCF_N . "_tag_to_object
+ FROM wcf1_tag_to_object
WHERE objectTypeID = ?
AND tagID IN (" . $tagIDs . ")
GROUP BY objectID
if (!$initialized) {
$sql = "SELECT templateGroupID
- FROM wcf" . WCF_N . "_template_group
+ FROM wcf1_template_group
WHERE templateGroupFolderName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['_wcf_email/']);
parent::setTemplateGroupID($statement->fetchSingleColumn());
{
$userList = new UserList();
$userList->sqlConditionJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID";
$conditions = $trophy->getConditions();
$userList->getConditionBuilder()->add(
'user_table.userID NOT IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_trophy
+ FROM wcf1_user_trophy
WHERE trophyID IN (?)
)',
[$trophy->trophyID]
// We joining the user_trophy table to receive the userTrophyID, which should be deleted.
$userList->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user_trophy user_trophy
+ LEFT JOIN wcf1_user_trophy user_trophy
ON user_table.userID = user_trophy.userID";
// We do not need the complete user object, but only the userTrophyID.
$userList->getConditionBuilder()->add(
'user_table.userID IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_trophy
+ FROM wcf1_user_trophy
WHERE trophyID IN (?)
)',
[$trophy->trophyID]
$articleList->getConditionBuilder()->add(
"article.articleID IN (
SELECT articleID
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleContentID IN (?)
)",
[$this->commentObjectIDs]
$articleList->getConditionBuilder()->add(
"article.articleID IN (
SELECT articleID
- FROM wcf" . WCF_N . "_article_content
+ FROM wcf1_article_content
WHERE articleContentID IN (?)
)",
[$articleContentIDs]
]);
}
- $sql = "INSERT INTO wcf" . WCF_N . "_user_activity_event
+ $sql = "INSERT INTO wcf1_user_activity_event
(objectTypeID, objectID, languageID, userID, time, additionalData)
VALUES (?, ?, ?, ?, ?, ?)" . \str_repeat(', (?, ?, ?, ?, ?, ?)', \count($batchEventData) - 1);
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($parameters);
}
WCF::getDB()->commitTransaction();
$userID = WCF::getUser()->userID;
}
- $sql = "DELETE FROM wcf" . WCF_N . "_user_activity_event
+ $sql = "DELETE FROM wcf1_user_activity_event
WHERE objectTypeID = ?
AND objectID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
$conditions->add("objectTypeID = ?", [$objectTypeID]);
$conditions->add("objectID IN (?)", [$objectIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_user_activity_event
+ $sql = "DELETE FROM wcf1_user_activity_event
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
// remove orphaned event ids
if (!empty($eventIDs)) {
- $sql = "DELETE FROM wcf" . WCF_N . "_user_activity_event
+ $sql = "DELETE FROM wcf1_user_activity_event
WHERE eventID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($eventIDs as $eventID) {
$statement->execute([$eventID]);
}
// update user_activity_point
- $sql = "INSERT INTO wcf" . WCF_N . "_user_activity_point
+ $sql = "INSERT INTO wcf1_user_activity_point
(userID, objectTypeID, activityPoints, items)
VALUES (?, ?, ?, 1)
ON DUPLICATE KEY UPDATE activityPoints = activityPoints + VALUES(activityPoints),
items = items + 1";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$userID,
$objectTypeObj->objectTypeID,
$objectTypeObj->points,
]);
- $sql = "UPDATE wcf" . WCF_N . "_user
+ $sql = "UPDATE wcf1_user
SET activityPoints = activityPoints + ?
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeObj->points,
$userID,
$userIDs[] = $userID;
}
- $sql = "INSERT INTO wcf" . WCF_N . "_user_activity_point
+ $sql = "INSERT INTO wcf1_user_activity_point
(userID, objectTypeID, activityPoints, items)
VALUES " . $values . "
ON DUPLICATE KEY UPDATE activityPoints = activityPoints + VALUES(activityPoints),
items = items + VALUES(items)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($parameters);
// update activity points for given user ids
}
// remove activity points
- $sql = "UPDATE wcf" . WCF_N . "_user_activity_point
+ $sql = "UPDATE wcf1_user_activity_point
SET activityPoints = activityPoints - ?,
items = items - ?
WHERE objectTypeID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($userToItems as $userID => $items) {
$statement->execute([
$items * $objectTypeObj->points,
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", [$userIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_user user_table
+ $sql = "UPDATE wcf1_user user_table
SET activityPoints = COALESCE((
SELECT SUM(activityPoints) AS activityPoints
- FROM wcf" . WCF_N . "_user_activity_point
+ FROM wcf1_user_activity_point
WHERE userID = user_table.userID
GROUP BY userID
), 0)
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
// update user ranks
throw new InvalidObjectTypeException($objectType, 'com.woltlab.wcf.user.activityPointEvent');
}
- $sql = "UPDATE wcf" . WCF_N . "_user_activity_point
+ $sql = "UPDATE wcf1_user_activity_point
SET activityPoints = 0,
items = 0
WHERE objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeObj->objectTypeID]);
}
// cache does not exist or is outdated
if ($data === null) {
$sql = "SELECT objectID
- FROM wcf" . WCF_N . "_user_collapsible_content
+ FROM wcf1_user_collapsible_content
WHERE objectTypeID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
WCF::getUser()->userID,
if ($userID) {
$sql = "SELECT *
- FROM wcf" . WCF_N . "_user_collapsible_content
+ FROM wcf1_user_collapsible_content
WHERE objectTypeID = ?
AND objectID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
$row = $statement->fetchArray();
if (!$row) {
- $sql = "INSERT INTO wcf" . WCF_N . "_user_collapsible_content
+ $sql = "INSERT INTO wcf1_user_collapsible_content
(objectTypeID, objectID, userID)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
}
if ($userID) {
- $sql = "DELETE FROM wcf" . WCF_N . "_user_collapsible_content
+ $sql = "DELETE FROM wcf1_user_collapsible_content
WHERE objectTypeID = ?
AND objectID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
$objectID,
public function reset($objectTypeID)
{
if (WCF::getUser()->userID) {
- $sql = "DELETE FROM wcf" . WCF_N . "_user_collapsible_content
+ $sql = "DELETE FROM wcf1_user_collapsible_content
WHERE objectTypeID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeID,
WCF::getUser()->userID,
$conditionBuilder->add('objectID = ?', [$objectID]);
}
- $sql = "DELETE FROM wcf" . WCF_N . "_user_collapsible_content
+ $sql = "DELETE FROM wcf1_user_collapsible_content
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
UserStorageHandler::getInstance()->resetAll('collapsedContent-' . $objectTypeID);
)
AND optionValue = ?
)";
- $statement = WCF::getDB()->prepareStatement($sql, 100);
+ $statement = WCF::getDB()->prepare($sql, 100);
$statement->execute([
'admin.user.canSearchUser',
1,
$userList->getConditionBuilder()->add(
'user_table.userID NOT IN (
SELECT userID
- FROM wcf' . WCF_N . '_user_to_group
+ FROM wcf1_user_to_group
WHERE groupID = ?
)',
[$assignment->groupID]
$conditions->add("confirmTime = ?", [0]);
$sql = "SELECT notificationID, userID
- FROM wcf" . WCF_N . "_user_notification
+ FROM wcf1_user_notification
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$notifications = $statement->fetchMap('userID', 'notificationID');
}
$sql = "SELECT notificationID
- FROM wcf" . WCF_N . "_user_notification_author
+ FROM wcf1_user_notification_author
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$notificationIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
if (!empty($notificationIDs)) {
// update trigger count
- $sql = "UPDATE wcf" . WCF_N . "_user_notification
+ $sql = "UPDATE wcf1_user_notification
SET timesTriggered = timesTriggered + ?,
guestTimesTriggered = guestTimesTriggered + ?
WHERE notificationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($notificationIDs as $notificationID) {
$conditions->add("ignoreUserID = ?", [$userProfile->getUserID()]);
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user_ignore
+ FROM wcf1_user_ignore
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$userIDs = [];
while ($userID = $statement->fetchColumn()) {
// cache does not exist or is outdated
if ($data === null || $skipCache) {
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_notification
+ FROM wcf1_user_notification
WHERE userID = ?
AND confirmTime = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
WCF::getUser()->userID,
0,
public function countAllNotifications()
{
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user_notification
+ FROM wcf1_user_notification
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([WCF::getUser()->userID]);
return $statement->fetchSingleColumn();
}
$sql = "SELECT notification.*, notification_event.eventID, object_type.objectType
- FROM wcf" . WCF_N . "_user_notification notification
- LEFT JOIN wcf" . WCF_N . "_user_notification_event notification_event
+ FROM wcf1_user_notification notification
+ LEFT JOIN wcf1_user_notification_event notification_event
ON notification_event.eventID = notification.eventID
- LEFT JOIN wcf" . WCF_N . "_object_type object_type
+ LEFT JOIN wcf1_object_type object_type
ON object_type.objectTypeID = notification_event.objectTypeID
" . $conditions . "
ORDER BY notification.time DESC";
- $statement = WCF::getDB()->prepareStatement($sql, $limit, $offset);
+ $statement = WCF::getDB()->prepare($sql, $limit, $offset);
$statement->execute($conditions->getParameters());
return $statement->fetchObjects(UserNotification::class, 'notificationID');
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("notificationID IN (?)", [$notificationIDs]);
$sql = "SELECT notificationID, authorID
- FROM wcf" . WCF_N . "_user_notification_author
+ FROM wcf1_user_notification_author
" . $conditions . "
ORDER BY time ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$authorIDs = $authorToNotification = [];
while ($row = $statement->fetchArray()) {
}
$sql = "SELECT notificationID
- FROM wcf" . WCF_N . "_user_notification
+ FROM wcf1_user_notification
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$row = $statement->fetchArray();
// get event ids
$sql = "SELECT eventID
- FROM wcf" . WCF_N . "_user_notification_event
+ FROM wcf1_user_notification_event
WHERE objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectTypeObj->objectTypeID,
]);
$conditions->add("objectID IN (?)", [$objectIDs]);
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user_notification
+ FROM wcf1_user_notification
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
EventHandler::getInstance()->fireAction($this, 'removeNotifications', $parameters);
// delete notifications
- $sql = "DELETE FROM wcf" . WCF_N . "_user_notification
+ $sql = "DELETE FROM wcf1_user_notification
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
}
}
$conditions->add("objectID IN (?)", [$objectIDs]);
}
- $sql = "UPDATE wcf" . WCF_N . "_user_notification
+ $sql = "UPDATE wcf1_user_notification
SET confirmTime = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$parameters = $conditions->getParameters();
\array_unshift($parameters, TIME_NOW);
$statement->execute($parameters);
$conditions->add("confirmTime = ?", [0]);
// mark notifications as confirmed
- $sql = "UPDATE wcf" . WCF_N . "_user_notification
+ $sql = "UPDATE wcf1_user_notification
SET confirmTime = ?
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$parameters = $conditions->getParameters();
\array_unshift($parameters, TIME_NOW);
$statement->execute($parameters);
// get setting
$sql = "SELECT mailNotificationType
- FROM wcf" . WCF_N . "_user_notification_event_to_user
+ FROM wcf1_user_notification_event_to_user
WHERE eventID = ?
AND userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$event->eventID, WCF::getUser()->userID]);
$row = $statement->fetchArray();
if ($row === false) {
$conditionBuilder->add('like_table_join.likeID = ?', [$this->getUserNotificationObject()->getObjectID()]);
$sql = "SELECT like_table.reactionTypeID, COUNT(like_table.reactionTypeID) as count
- FROM wcf" . WCF_N . "_like like_table
- LEFT JOIN wcf" . WCF_N . "_like like_table_join
+ FROM wcf1_like like_table
+ LEFT JOIN wcf1_like like_table_join
ON like_table_join.objectTypeID = like_table.objectTypeID
AND like_table_join.objectID = like_table.objectID
" . $conditionBuilder . "
GROUP BY like_table.reactionTypeID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$this->cachedReactions = $statement->fetchMap('reactionTypeID', 'count');
WCF::getSession()->changeUser($originalUser, true);
$sql = "SELECT *
- FROM wcf" . WCF_N . "_moderation_queue
+ FROM wcf1_moderation_queue
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeID, $reportedUser->userID]);
$moderationQueue = $statement->fetchObject(ModerationQueue::class);
$conditionBuilder->add('queueID = ?', [$comment->objectID]);
$conditionBuilder->add('isAffected = ?', [1]);
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_moderation_queue_to_user
+ FROM wcf1_moderation_queue_to_user
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$recipientIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
{
// find all userIDs with the permission to manage pages
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user_to_group
- INNER JOIN wcf" . WCF_N . "_user_group_option_value
- ON wcf" . WCF_N . "_user_to_group.groupID = wcf" . WCF_N . "_user_group_option_value.groupID
- AND wcf" . WCF_N . "_user_group_option_value.optionValue = ?
- INNER JOIN wcf" . WCF_N . "_user_group_option
- ON wcf" . WCF_N . "_user_group_option_value.optionID = wcf" . WCF_N . "_user_group_option.optionID
- AND wcf" . WCF_N . "_user_group_option.optionName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user_to_group
+ INNER JOIN wcf1_user_group_option_value
+ ON wcf1_user_to_group.groupID = wcf1_user_group_option_value.groupID
+ AND wcf1_user_group_option_value.optionValue = ?
+ INNER JOIN wcf1_user_group_option
+ ON wcf1_user_group_option_value.optionID = wcf1_user_group_option.optionID
+ AND wcf1_user_group_option.optionName = ?";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
1,
'admin.content.cms.canManagePage',
public function getOwnerID($objectID)
{
$sql = "SELECT objectID
- FROM wcf" . WCF_N . "_comment
+ FROM wcf1_comment
WHERE commentID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectID]);
$row = $statement->fetchArray();
$conditionsBuilder->add('objectTypeID = ?', [$objectTypeObj->objectTypeID]);
$conditionsBuilder->add('objectID IN (?)', [$objectIDs]);
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user_object_watch
+ FROM wcf1_user_object_watch
" . $conditionsBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionsBuilder->getParameters());
$userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$conditionsBuilder->add('userID IN (?)', [$userIDs]);
}
- $sql = "DELETE FROM wcf" . WCF_N . "_user_object_watch
+ $sql = "DELETE FROM wcf1_user_object_watch
" . $conditionsBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionsBuilder->getParameters());
}
->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', $objectType);
$sql = "SELECT userID, notification
- FROM wcf" . WCF_N . "_user_object_watch
+ FROM wcf1_user_object_watch
WHERE objectTypeID = ?
AND objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectTypeObj->objectTypeID, $objectID]);
return $statement->fetchMap('userID', 'notification');
$sql = "INSERT INTO " . $this->getTableName($objectType) . "_version
(objectID, userID, username, time, data)
VALUES (?, ?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$object->getObjectID(),
WCF::getUser()->userID,
$sql = "SELECT COUNT(*) as count
FROM " . $this->getTableName($objectType) . "_version
WHERE objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectID]);
return $statement->fetchSingleColumn();
FROM " . $this->getTableName($objectType) . "_version
WHERE objectID = ?
ORDER BY versionID DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([$objectID]);
return $statement->fetchObject(VersionTrackerEntry::class);
FROM " . $this->getTableName($objectType) . "_version
WHERE objectID = ?
ORDER BY versionID DESC";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectID]);
$versions = [];
while ($version = $statement->fetchObject(VersionTrackerEntry::class)) {
$sql = "SELECT *
FROM " . $this->getTableName($objectType) . "_version
WHERE versionID = ?";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([$versionID]);
return $statement->fetchObject(VersionTrackerEntry::class);
{
// get definition id
$sql = "SELECT definitionID
- FROM wcf" . WCF_N . "_object_type_definition
+ FROM wcf1_object_type_definition
WHERE definitionName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(['com.woltlab.wcf.versionTracker.objectType']);
$row = $statement->fetchArray();
$sql = "DELETE FROM " . $this->getTableName($objectType) . "_version
WHERE objectID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$objectID]);
}
// check if table already exists
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_package_installation_sql_log
+ FROM wcf1_package_installation_sql_log
WHERE sqlTable = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$tableName]);
if ($statement->fetchSingleColumn()) {
\md5($tableName . '_userID') . '_fk',
[
'columns' => 'userID',
- 'referencedTable' => 'wcf' . WCF_N . '_user',
+ 'referencedTable' => 'wcf1_user',
'referencedColumns' => 'userID',
'ON DELETE' => 'SET NULL',
]
// add comment
$sql = "ALTER TABLE " . $tableName . "
COMMENT = 'Version tracking for " . $objectType->objectType . "'";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
// log table
- $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_sql_log
+ $sql = "INSERT INTO wcf1_package_installation_sql_log
(packageID, sqlTable)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectType->packageID,
$tableName,
$conditions->add("userID IN (?)", [$userIDs]);
$sql = "SELECT userID, groupID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$groupData = [];
$commentObjectType = ObjectTypeCache::getInstance()
->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.articleComment');
$sql = "SELECT COUNT(*) AS comments, SUM(responses) AS responses
- FROM wcf" . WCF_N . "_comment
+ FROM wcf1_comment
WHERE objectTypeID = ?
AND objectID = ?";
- $commentStatement = WCF::getDB()->prepareStatement($sql);
+ $commentStatement = WCF::getDB()->prepare($sql);
$comments = [];
// update article content
$conditions->add("objectID IN (?)", [$this->objectList->getObjectIDs()]);
$sql = "SELECT objectID, cumulativeLikes
- FROM wcf" . WCF_N . "_like_object
+ FROM wcf1_like_object
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$cumulativeLikes = $statement->fetchMap('objectID', 'cumulativeLikes');
// disable mysql strict mode
$sql = "SET SESSION sql_mode = 'ANSI,ONLY_FULL_GROUP_BY'";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$this->getExporter()->exportData($this->parameters['objectType'], $this->loopCount);
$this->conditions->add(
"user.userID IN (
SELECT userID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
WHERE groupID IN (?)
)",
[$this->mailData['groupIDs']]
}
$sql = "SELECT COUNT(*)
- FROM wcf" . WCF_N . "_user user
+ FROM wcf1_user user
" . $this->conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->conditions->getParameters());
$this->count = $statement->fetchSingleColumn();
// get users
$sql = "SELECT user_option.*, user.*
- FROM wcf" . WCF_N . "_user user
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option
+ FROM wcf1_user user
+ LEFT JOIN wcf1_user_option_value user_option
ON user_option.userID = user.userID
" . $this->conditions . "
ORDER BY user.userID";
- $statement = WCF::getDB()->prepareStatement($sql, $this->limit, $this->limit * $this->loopCount);
+ $statement = WCF::getDB()->prepare($sql, $this->limit, $this->limit * $this->loopCount);
$statement->execute($this->conditions->getParameters());
while ($row = $statement->fetchArray()) {
$user = new User(null, $row);
// update poll options
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('poll_option.pollID IN (?)', [$pollIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_poll_option poll_option
+ $sql = "UPDATE wcf1_poll_option poll_option
SET votes = (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_poll_option_vote
+ FROM wcf1_poll_option_vote
WHERE optionID = poll_option.optionID
)
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
// update polls
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('poll.pollID IN (?)', [$pollIDs]);
- $sql = "UPDATE wcf" . WCF_N . "_poll poll
+ $sql = "UPDATE wcf1_poll poll
SET votes = (
SELECT COUNT(DISTINCT userID)
- FROM wcf" . WCF_N . "_poll_option_vote
+ FROM wcf1_poll_option_vote
WHERE pollID = poll.pollID
)
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
}
}
private function registerSitemapFiles()
{
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_package_installation_file_log
+ $sql = "INSERT IGNORE INTO wcf1_package_installation_file_log
(packageID, filename, application)
VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->workerData['filesToPackage'] as $packageID => $files) {
if (!$this->loopCount) {
// delete existing stat
- $sql = "DELETE FROM wcf" . WCF_N . "_stat_daily";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $sql = "DELETE FROM wcf1_stat_daily";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
}
// prepare insert statement
- $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_stat_daily
+ $sql = "INSERT IGNORE INTO wcf1_stat_daily
(objectTypeID, date, counter, total)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$this->getStartDate();
$d = DateUtil::getDateTimeByTimestamp($this->startDate);
}
$sql = "SELECT MIN(registrationDate)
- FROM wcf" . WCF_N . "_user";
- $statement = WCF::getDB()->prepareStatement($sql);
+ FROM wcf1_user";
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute();
$this->startDate = $statement->fetchSingleColumn();
}
$i = 0;
foreach ($this->objectTypes as $objectType) {
if ($i == $this->loopCount) {
- $sql = "UPDATE wcf" . WCF_N . "_user_activity_point
+ $sql = "UPDATE wcf1_user_activity_point
SET activityPoints = items * ?
WHERE objectTypeID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$objectType->points,
$objectType->objectTypeID,
$this->objectList->sqlSelects = 'user_option_value.userOption' . User::getUserOptionID('aboutMe') . ' AS aboutMe';
$this->objectList->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_user_option_value user_option_value
+ LEFT JOIN wcf1_user_option_value user_option_value
ON user_option_value.userID = user_table.userID";
}
}
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($userID = $statement->fetchColumn()) {
$userIDs[] = $userID;
}
$sql = "SELECT user_table.username
- FROM wcf" . WCF_N . "_user_to_group user_to_group
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ FROM wcf1_user_to_group user_to_group
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = user_to_group.userID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($username = $statement->fetchColumn()) {
$usernames[] = $username;
public static function isAvailableUsername($name): bool
{
$sql = "SELECT COUNT(username)
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
WHERE username = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$name]);
return $statement->fetchSingleColumn() == 0;
public static function isAvailableEmail($email): bool
{
$sql = "SELECT COUNT(email)
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
WHERE email = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$email]);
return $statement->fetchSingleColumn() == 0;