diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-11-06 13:39:14 -0800 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-11-06 13:39:14 -0800 |
commit | 349822d221bce8166fb024aefdcf04111e5f537a (patch) | |
tree | 1552d24c937b1dabcab7690f766464a1112f2bea /lib | |
parent | d490b8f97247fdd2382330e9c2be7ac8e0471ca4 (diff) | |
parent | 7b84b404358ae98aa14d67530852303ba0331a16 (diff) | |
download | nextcloud-server-349822d221bce8166fb024aefdcf04111e5f537a.tar.gz nextcloud-server-349822d221bce8166fb024aefdcf04111e5f537a.zip |
Merge pull request #5726 from owncloud/more_debug_output_stable5
add debug output related to app enablement
Diffstat (limited to 'lib')
-rw-r--r-- | lib/appconfig.php | 20 | ||||
-rw-r--r-- | lib/db.php | 9 |
2 files changed, 21 insertions, 8 deletions
diff --git a/lib/appconfig.php b/lib/appconfig.php index e615d838173..8bc68f45de0 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -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 ) + ); } } diff --git a/lib/db.php b/lib/db.php index 01f88647600..0dd4b32adf7 100644 --- a/lib/db.php +++ b/lib/db.php @@ -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)); } } |