Fixed user storage and exception handling
authorAlexander Ebert <ebert@woltlab.com>
Tue, 4 Dec 2012 22:26:34 +0000 (23:26 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 4 Dec 2012 22:26:34 +0000 (23:26 +0100)
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php

index b7fa2463fd3c876ca800330e8ab1045b02a1adb9..0f1b9c004b8087cac30c4139813d1e7623bebeb2 100644 (file)
@@ -146,7 +146,7 @@ class WCF {
                        UserStorageHandler::getInstance()->shutdown();
                }
                catch (\Exception $exception) {
-                       die("WCF::destruct() Unhandled exception: ".$exception->getMessage()."\n".base64_encode($exception->getTraceAsString()));
+                       die("<pre>WCF::destruct() Unhandled exception: ".$exception->getMessage()."\n\n".$exception->getTraceAsString());
                }
        }
        
@@ -246,7 +246,7 @@ class WCF {
                        self::handleException(new exception\SystemException($e->getMessage(), $e->getCode(), '', $e));
                }
                catch (\Exception $exception) {
-                       die("WCF::handleException() Unhandled exception: ".$exception->getMessage()."\n".base64_encode($exception->getTraceAsString()));
+                       die("<pre>WCF::handleException() Unhandled exception: ".$exception->getMessage()."\n\n".$exception->getTraceAsString());
                }
        }
        
index 1b9ec3adb671eb177357a32c9007b8e606f2506f..108bf331dca7218207ea7193d109329f6f64d721 100644 (file)
@@ -146,21 +146,19 @@ class UserStorageHandler extends SingletonFactory {
         */
        public function shutdown() {
                WCF::getDB()->beginTransaction();
+               
                // remove outdated entries
                if (!empty($this->resetFields)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_user_storage
                                WHERE           userID = ?
                                                AND field = ?";
                        $statement = WCF::getDB()->prepareStatement($sql);
-                       
-                       foreach ($this->resetFields as $userID => $data) {
-                               foreach ($data as $fields) {
-                                       foreach ($fields as $field) {
-                                               $statement->execute(array(
-                                                       $userID,
-                                                       $field
-                                               ));
-                                       }
+                       foreach ($this->resetFields as $userID => $fields) {
+                               foreach ($fields as $field) {
+                                       $statement->execute(array(
+                                               $userID,
+                                               $field
+                                       ));
                                }
                        }
                }
@@ -172,18 +170,17 @@ class UserStorageHandler extends SingletonFactory {
                                VALUES          (?, ?, ?)";
                        $statement = WCF::getDB()->prepareStatement($sql);
                        
-                       foreach ($this->updateFields as $userID => $data) {
-                               foreach ($data as $fieldValues) {
-                                       foreach ($fieldValues as $field => $fieldValue) {
-                                               $statement->execute(array(
-                                                       $userID,
-                                                       $field,
-                                                       $fieldValue
-                                               ));
-                                       }
+                       foreach ($this->updateFields as $userID => $fieldValues) {
+                               foreach ($fieldValues as $field => $fieldValue) {
+                                       $statement->execute(array(
+                                               $userID,
+                                               $field,
+                                               $fieldValue
+                                       ));
                                }
                        }
                }
+               
                WCF::getDB()->commitTransaction();
                
                $this->resetFields = $this->updateFields = array();