1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Fixing ChatXEditor::prune()

This commit is contained in:
Tim Düsterhus 2012-04-15 18:00:59 +02:00
parent 0a0c3165e7
commit 3248b14097
2 changed files with 9 additions and 9 deletions

View File

@ -24,11 +24,10 @@ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor {
* @return integer Number of deleted messages. * @return integer Number of deleted messages.
*/ */
public static function prune($lifetime = CHAT_LOG_ARCHIVETIME) { public static function prune($lifetime = CHAT_LOG_ARCHIVETIME) {
$baseClass = self::$baseClass;
$sql = "SELECT $sql = "SELECT
".$baseClass::getDatabaseTableIndexName()." ".static::getDatabaseTableIndexName()."
FROM FROM
".$baseClass::getDatabaseTableName()." ".static::getDatabaseTableName()."
WHERE WHERE
time < ?"; time < ?";
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql); $stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);

View File

@ -41,21 +41,22 @@ public static function deleteAll(array $objectIDs = array()) {
* @return integer Number of deleted rooms * @return integer Number of deleted rooms
*/ */
public static function prune() { public static function prune() {
$baseClass = self::$baseClass;
$sql = "SELECT $sql = "SELECT
".$baseClass::getDatabaseTableIndexName()." ".static::getDatabaseTableIndexName()."
FROM FROM
".$baseClass::getDatabaseTableName()." ".static::getDatabaseTableName()."
WHERE WHERE
permanent = ? permanent = ?
AND roomID NOT IN( AND roomID NOT IN (
SELECT SELECT
fieldValue AS roomID fieldValue AS roomID
FROM FROM
wcf".WCF_N."_user_storage wcf".WCF_N."_user_storage
WHERE WHERE
packageID = ? packageID = ?
AND field = ?)"; AND field = ?
AND fieldValue IS NOT NULL
)";
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql); $stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
$stmt->execute(array(0, \wcf\util\ChatUtil::getPackageID(), 'roomID')); $stmt->execute(array(0, \wcf\util\ChatUtil::getPackageID(), 'roomID'));
$objectIDs = array(); $objectIDs = array();