mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2025-01-09 00:20:08 +00:00
Use fetchColumn to fetch the object-ids
This commit is contained in:
parent
7e0dd0517d
commit
0eb439e75f
@ -24,7 +24,7 @@ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor {
|
|||||||
* @return integer Number of deleted messages.
|
* @return integer Number of deleted messages.
|
||||||
*/
|
*/
|
||||||
public static function cleanup($lifetime = CHAT_ARCHIVETIME) {
|
public static function cleanup($lifetime = CHAT_ARCHIVETIME) {
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
".static::getDatabaseIndexName()."
|
".static::getDatabaseIndexName()."
|
||||||
FROM
|
FROM
|
||||||
".static::getDatabaseTableName()."
|
".static::getDatabaseTableName()."
|
||||||
@ -33,9 +33,7 @@ public static function cleanup($lifetime = CHAT_ARCHIVETIME) {
|
|||||||
$statement = \wcf\system\WCF::getDB()->prepareStatement($sql);
|
$statement = \wcf\system\WCF::getDB()->prepareStatement($sql);
|
||||||
$statement->execute(TIME_NOW - $lifetime);
|
$statement->execute(TIME_NOW - $lifetime);
|
||||||
$objectIDs = array();
|
$objectIDs = array();
|
||||||
while ($row = $statement->fetchArray()) {
|
while ($objectIDs[] = $statement->fetchColumn());
|
||||||
$objectIDs[] = $row[static::getDatabaseIndexName()];
|
|
||||||
}
|
|
||||||
return static::deleteAll($objectIDs);
|
return static::deleteAll($objectIDs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user