]> source.dussan.org Git - nextcloud-server.git/commitdiff
add debug output related to app enablement
authorJörn Friedrich Dreyer <jfd@butonic.de>
Wed, 6 Nov 2013 17:14:43 +0000 (18:14 +0100)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Wed, 6 Nov 2013 17:14:43 +0000 (18:14 +0100)
lib/appconfig.php
lib/db.php

index e615d838173e9a182d2397be10a9d5cad98577f9..8bc68f45de06b72f16b5397dcb9e8aea5b4471c7 100644 (file)
@@ -125,14 +125,22 @@ class OC_Appconfig{
        public static function setValue( $app, $key, $value ) {
                // Does the key exist? yes: update. No: insert
                if(! self::hasKey($app, $key)) {
-                       $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*appconfig` ( `appid`, `configkey`, `configvalue` )'
-                               .' VALUES( ?, ?, ? )' );
-                       $query->execute( array( $app, $key, $value ));
+                       OC_DB::executeAudited('
+                               INSERT INTO `*PREFIX*appconfig` (
+                                       `appid`, `configkey`, `configvalue`
+                               ) VALUES (
+                                       ?, ?, ?
+                               )
+                               ', array( $app, $key, $value )
+                       );
                }
                else{
-                       $query = OC_DB::prepare( 'UPDATE `*PREFIX*appconfig` SET `configvalue` = ?'
-                               .' WHERE `appid` = ? AND `configkey` = ?' );
-                       $query->execute( array( $value, $app, $key ));
+                       OC_DB::executeAudited('
+                               UPDATE `*PREFIX*appconfig`
+                                       SET `configvalue` = ?
+                               WHERE `appid` = ? AND `configkey` = ?
+                               ', array( $value, $app, $key )
+                       );
                }
        }
 
index 01f886476004c8847e9facdbced2f95fa4669a4c..0dd4b32adf73711b02b93e45b6774fa95864c318 100644 (file)
@@ -465,7 +465,7 @@ class OC_DB {
                if ($stmt instanceof PDOStatementWrapper || $stmt instanceof MDB2_Statement_Common) {
                        /** @var $stmt PDOStatementWrapper|MDB2_Statement_Common */
                        $result = $stmt->execute($parameters);
-                       self::raiseExceptionOnError($result, 'Could not execute statement');
+                       self::raiseExceptionOnError($result, 'Could not execute statement', $parameters);
                } else {
                        if (is_object($stmt)) {
                                $message = 'Expected a prepared statement or array got ' . get_class($stmt);
@@ -592,6 +592,8 @@ class OC_DB {
 
                file_put_contents( $file2, $content );
 
+               \OC_Log::write('db','creating table from schema: '.$content,\OC_Log::DEBUG);
+
                // Try to create tables
                $definition = self::$schema->parseDatabaseDefinitionFile( $file2 );
 
@@ -1058,13 +1060,16 @@ class OC_DB {
         * @return void
         * @throws DatabaseException
         */
-       public static function raiseExceptionOnError($result, $message = null) {
+       public static function raiseExceptionOnError($result, $message = null, array $params = null) {
                if(self::isError($result)) {
                        if ($message === null) {
                                $message = self::getErrorMessage($result);
                        } else {
                                $message .= ', Root cause:' . self::getErrorMessage($result);
                        }
+                       if ($params) {
+                               $message .= ', params: ' . json_encode($params);
+                       }
                        throw new DatabaseException($message, self::getErrorCode($result));
                }
        }