2011-11-27 19:20:13 +00:00
|
|
|
<?php
|
|
|
|
namespace wcf\data\chat\room;
|
2012-02-04 20:57:39 +00:00
|
|
|
use \wcf\system\WCF;
|
2011-11-27 19:20:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides functions to edit chat rooms.
|
|
|
|
*
|
|
|
|
* @author Tim Düsterhus
|
2012-01-28 16:50:33 +00:00
|
|
|
* @copyright 2010-2012 Tim Düsterhus
|
2011-11-27 19:20:13 +00:00
|
|
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
|
|
|
* @package timwolla.wcf.chat
|
|
|
|
* @subpackage data.chat.room
|
|
|
|
*/
|
2011-12-13 21:18:04 +00:00
|
|
|
class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject {
|
2011-11-27 19:20:13 +00:00
|
|
|
/**
|
|
|
|
* @see wcf\data\DatabaseObjectDecorator::$baseClass
|
|
|
|
*/
|
|
|
|
protected static $baseClass = '\wcf\data\chat\room\ChatRoom';
|
|
|
|
|
|
|
|
/**
|
2011-12-13 21:18:04 +00:00
|
|
|
* Clears the room cache.
|
2011-11-27 19:20:13 +00:00
|
|
|
*/
|
2011-12-13 21:18:04 +00:00
|
|
|
public static function resetCache() {
|
2012-02-04 20:06:44 +00:00
|
|
|
ChatRoom::getCache();
|
|
|
|
\wcf\system\cache\CacheHandler::getInstance()->clearResource('chatrooms');
|
2011-11-27 19:20:13 +00:00
|
|
|
}
|
2012-02-04 20:57:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see \wcf\data\DatabaseObjectEditor::deleteAll()
|
|
|
|
*/
|
|
|
|
public static function deleteAll(array $objectIDs = array()) {
|
|
|
|
parent::deleteAll($objectIDs);
|
|
|
|
$packageID = \wcf\system\package\PackageDependencyHandler::getPackageID('timwolla.wcf.chat');
|
|
|
|
$sql = "DELETE FROM wcf".WCF_N."_language_item
|
|
|
|
WHERE languageItem = ? AND packageID = ?";
|
|
|
|
$statement = WCF::getDB()->prepareStatement($sql);
|
|
|
|
|
|
|
|
WCF::getDB()->beginTransaction();
|
|
|
|
foreach ($objectIDs as $objectID) {
|
|
|
|
$statement->execute(array('wcf.chat.room.title.room'.$objectID, $packageID));
|
|
|
|
$statement->execute(array('wcf.chat.room.topic.room'.$objectID, $packageID));
|
|
|
|
}
|
|
|
|
WCF::getDB()->commitTransaction();
|
|
|
|
|
|
|
|
return count($objectIDs);
|
|
|
|
}
|
2011-11-27 19:20:13 +00:00
|
|
|
}
|