mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Fixed errors originating from WoltLab/WCF@92b007d51d
This commit is contained in:
parent
335fa0ea7a
commit
2ad6fb2dc9
@ -63,7 +63,7 @@ public function save() {
|
||||
|
||||
$this->title = 'wcf.chat.room.title'.$this->roomObj->roomID;
|
||||
if (I18nHandler::getInstance()->isPlainValue('title')) {
|
||||
I18nHandler::getInstance()->remove($this->title, \wcf\util\ChatUtil::getPackageID());
|
||||
I18nHandler::getInstance()->remove($this->title);
|
||||
$this->title = I18nHandler::getInstance()->getValue('title');
|
||||
}
|
||||
else {
|
||||
@ -72,7 +72,7 @@ public function save() {
|
||||
|
||||
$this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID;
|
||||
if (I18nHandler::getInstance()->isPlainValue('topic')) {
|
||||
I18nHandler::getInstance()->remove($this->topic, \wcf\util\ChatUtil::getPackageID());
|
||||
I18nHandler::getInstance()->remove($this->topic);
|
||||
$this->topic = I18nHandler::getInstance()->getValue('topic');
|
||||
}
|
||||
else {
|
||||
|
@ -110,10 +110,9 @@ public function countUsers() {
|
||||
wcf".WCF_N."_user_storage
|
||||
WHERE
|
||||
field = ?
|
||||
AND packageID = ?
|
||||
AND fieldValue = ?";
|
||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||
$stmt->execute(array('roomID', \wcf\util\ChatUtil::getPackageID(), $this->roomID));
|
||||
$stmt->execute(array('roomID', $this->roomID));
|
||||
|
||||
return $stmt->fetchColumn();
|
||||
}
|
||||
@ -158,18 +157,15 @@ public function getTitle() {
|
||||
* @return array<\wcf\data\user\User>
|
||||
*/
|
||||
public function getUsers() {
|
||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
||||
|
||||
$sql = "SELECT
|
||||
userID
|
||||
FROM
|
||||
wcf".WCF_N."_user_storage
|
||||
WHERE
|
||||
field = ?
|
||||
AND packageID = ?
|
||||
AND fieldValue = ?";
|
||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||
$stmt->execute(array('roomID', $packageID, $this->roomID));
|
||||
$stmt->execute(array('roomID', $this->roomID));
|
||||
$userIDs = array();
|
||||
while ($userIDs[] = $stmt->fetchColumn());
|
||||
|
||||
@ -184,15 +180,14 @@ public function getUsers() {
|
||||
wcf".WCF_N."_user_storage st
|
||||
ON (
|
||||
u.userID = st.userID
|
||||
AND st.field = ?
|
||||
AND st.packageID = ?
|
||||
AND st.field = ?
|
||||
)
|
||||
WHERE
|
||||
u.userID IN (".rtrim(str_repeat('?,', count($userIDs)), ',').")
|
||||
ORDER BY
|
||||
u.username ASC";
|
||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||
array_unshift($userIDs, 'away', $packageID);
|
||||
array_unshift($userIDs, 'away');
|
||||
$stmt->execute($userIDs);
|
||||
|
||||
return $stmt->fetchObjects('\wcf\data\user\User');
|
||||
|
@ -65,12 +65,11 @@ public function prune() {
|
||||
FROM
|
||||
wcf".WCF_N."_user_storage
|
||||
WHERE
|
||||
packageID = ?
|
||||
AND field = ?
|
||||
AND fieldValue IS NOT NULL
|
||||
)";
|
||||
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
|
||||
$stmt->execute(array(0, \wcf\util\ChatUtil::getPackageID(), 'roomID'));
|
||||
$stmt->execute(array(0, 'roomID'));
|
||||
$objectIDs = array();
|
||||
|
||||
while ($objectIDs[] = $stmt->fetchColumn());
|
||||
|
@ -22,12 +22,10 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data
|
||||
* @see \wcf\data\DatabaseObjectEditor::deleteAll()
|
||||
*/
|
||||
public static function deleteAll(array $objectIDs = array()) {
|
||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
||||
|
||||
WCF::getDB()->beginTransaction();
|
||||
foreach ($objectIDs as $objectID) {
|
||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID, $packageID);
|
||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID, $packageID);
|
||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID);
|
||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID);
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
|
@ -21,9 +21,8 @@ class ChatSuspensionEditor extends \wcf\data\DatabaseObjectEditor implements \wc
|
||||
* Clears the suspension cache.
|
||||
*/
|
||||
public static function resetCache() {
|
||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
||||
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
|
||||
|
||||
$ush->resetAll('suspensions', $packageID);
|
||||
$ush->resetAll('suspensions');
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ final class ChatUtil {
|
||||
* @return array
|
||||
*/
|
||||
public static function getDiedUsers() {
|
||||
$packageID = self::getPackageID();
|
||||
if (self::nodePushRunning()) {
|
||||
$time = TIME_NOW - 120;
|
||||
}
|
||||
@ -66,17 +65,15 @@ public static function getDiedUsers() {
|
||||
wcf".WCF_N."_user_storage a
|
||||
ON a.userID = r.userID
|
||||
AND a.field = ?
|
||||
AND a.packageID = ?
|
||||
WHERE
|
||||
r.field = ?
|
||||
AND r.packageID = ?
|
||||
AND r.fieldValue IS NOT NULL
|
||||
AND (
|
||||
a.fieldValue < ?
|
||||
OR a.fieldValue IS NULL
|
||||
)";
|
||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||
$stmt->execute(array('lastActivity', $packageID, 'roomID', $packageID, $time - 30));
|
||||
$stmt->execute(array('lastActivity', 'roomID', $time - 30));
|
||||
$users = array();
|
||||
while ($users[] = $stmt->fetchArray());
|
||||
|
||||
@ -152,11 +149,10 @@ public static function nodePushRunning() {
|
||||
public static function readUserData($field, \wcf\data\user\User $user = null) {
|
||||
if ($user === null) $user = WCF::getUser();
|
||||
$ush = UserStorageHandler::getInstance();
|
||||
$packageID = self::getPackageID();
|
||||
|
||||
// load storage
|
||||
$ush->loadStorage(array($user->userID), $packageID);
|
||||
$data = $ush->getStorage(array($user->userID), $field, $packageID);
|
||||
$ush->loadStorage(array($user->userID));
|
||||
$data = $ush->getStorage(array($user->userID), $field);
|
||||
|
||||
if ($data[$user->userID] === null) {
|
||||
switch ($field) {
|
||||
@ -254,10 +250,9 @@ public static function timeModifier($time) {
|
||||
public static function writeUserData(array $data, \wcf\data\user\User $user = null) {
|
||||
if ($user === null) $user = WCF::getUser();
|
||||
$ush = UserStorageHandler::getInstance();
|
||||
$packageID = self::getPackageID();
|
||||
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$ush->update($user->userID, $key, (isset(static::$serialize[$key])) ? serialize($value) : $value, $packageID);
|
||||
$ush->update($user->userID, $key, (isset(static::$serialize[$key])) ? serialize($value) : $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user