diff options
author | Florian Pritz <bluewind@xinu.at> | 2011-09-22 19:24:32 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2011-09-24 18:41:47 +0200 |
commit | 8648e3c43c26da898c17798f89d60c9505d149b3 (patch) | |
tree | 34e10780eca9ec004900163f958f79192a0f226c /lib | |
parent | 9c550e8e9f52efa9c117ef1b577386e555010547 (diff) | |
download | nextcloud-server-8648e3c43c26da898c17798f89d60c9505d149b3.tar.gz nextcloud-server-8648e3c43c26da898c17798f89d60c9505d149b3.zip |
only call error_log() if DEBUG is true
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/db.php | 8 | ||||
-rw-r--r-- | lib/filestorage/local.php | 2 | ||||
-rw-r--r-- | lib/filesystem.php | 6 | ||||
-rw-r--r-- | lib/installer.php | 16 | ||||
-rw-r--r-- | lib/preferences.php | 2 |
5 files changed, 17 insertions, 17 deletions
diff --git a/lib/db.php b/lib/db.php index 0b7065eec8b..ede8ba897e9 100644 --- a/lib/db.php +++ b/lib/db.php @@ -92,8 +92,8 @@ class OC_DB { if( PEAR::isError( self::$DBConnection )){ echo( '<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>'); $error = self::$DBConnection->getMessage(); - error_log( $error); - error_log( self::$DBConnection->getUserInfo()); + if(defined("DEBUG") && DEBUG) {error_log( $error);} + if(defined("DEBUG") && DEBUG) {error_log( self::$DBConnection->getUserInfo());} die( $error ); } @@ -129,7 +129,7 @@ class OC_DB { if( PEAR::isError($result)) { $entry = 'DB Error: "'.$result->getMessage().'"<br />'; $entry .= 'Offending command was: '.$query.'<br />'; - error_log( $entry ); + if(defined("DEBUG") && DEBUG) {error_log( $entry );} die( $entry ); } @@ -155,7 +155,7 @@ class OC_DB { if( PEAR::isError($result)) { $entry = 'DB Error: "'.$result->getMessage().'"<br />'; $entry .= 'Offending command was: '.$query.'<br />'; - error_log( $entry ); + if(defined("DEBUG") && DEBUG) {error_log( $entry );} die( $entry ); } diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 07759b0e88c..180b056f344 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -195,7 +195,7 @@ class OC_Filestorage_Local extends OC_Filestorage{ } private function delTree($dir) { - error_log('del'.$dir); + if(defined("DEBUG") && DEBUG) {error_log('del'.$dir);} $dirRelative=$dir; $dir=$this->datadir.$dir; if (!file_exists($dir)) return true; diff --git a/lib/filesystem.php b/lib/filesystem.php index 76032fae204..f242a1b158e 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -286,7 +286,7 @@ class OC_Filesystem{ return self::basicOperation('file_get_contents',$path,array('read')); } static public function file_put_contents($path,$data){ - error_log($data); + if(defined("DEBUG") && DEBUG) {error_log($data);} return self::basicOperation('file_put_contents',$path,array('create','write'),$data); } static public function unlink($path){ @@ -393,7 +393,7 @@ class OC_Filesystem{ } } static public function fromUploadedFile($tmpFile,$path){ - error_log('upload'); + if(defined("DEBUG") && DEBUG) {error_log('upload');} if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){ $run=true; $exists=self::file_exists($path); @@ -403,7 +403,7 @@ class OC_Filesystem{ if($run){ OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run)); } - error_log('upload2'); + if(defined("DEBUG") && DEBUG) {error_log('upload2');} if($run){ $result=$storage->fromUploadedFile($tmpFile,self::getInternalPath($path)); if(!$exists){ diff --git a/lib/installer.php b/lib/installer.php index 83c575032ec..9416a42c972 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -56,7 +56,7 @@ class OC_Installer{ */ public static function installApp( $data = array()){ if(!isset($data['source'])){ - error_log("No source specified when installing app"); + if(defined("DEBUG") && DEBUG) {error_log("No source specified when installing app");} return false; } @@ -64,13 +64,13 @@ class OC_Installer{ if($data['source']=='http'){ $path=tempnam(sys_get_temp_dir(),'oc_installer_'); if(!isset($data['href'])){ - error_log("No href specified when installing app from http"); + if(defined("DEBUG") && DEBUG) {error_log("No href specified when installing app from http");} return false; } copy($data['href'],$path); }else{ if(!isset($data['path'])){ - error_log("No path specified when installing app from local file"); + if(defined("DEBUG") && DEBUG) {error_log("No path specified when installing app from local file");} return false; } $path=$data['path']; @@ -85,7 +85,7 @@ class OC_Installer{ $zip->extractTo($extractDir); $zip->close(); } else { - error_log("Failed to open archive when installing app"); + if(defined("DEBUG") && DEBUG) {error_log("Failed to open archive when installing app");} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); @@ -95,7 +95,7 @@ class OC_Installer{ //load the info.xml file of the app if(!is_file($extractDir.'/appinfo/info.xml')){ - error_log("App does not provide an info.xml file"); + if(defined("DEBUG") && DEBUG) {error_log("App does not provide an info.xml file");} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); @@ -107,7 +107,7 @@ class OC_Installer{ //check if an app with the same id is already installed if(self::isInstalled( $info['id'] )){ - error_log("App already installed"); + if(defined("DEBUG") && DEBUG) {error_log("App already installed");} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); @@ -117,7 +117,7 @@ class OC_Installer{ //check if the destination directory already exists if(is_dir($basedir)){ - error_log("App's directory already exists"); + if(defined("DEBUG") && DEBUG) {error_log("App's directory already exists");} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); @@ -131,7 +131,7 @@ class OC_Installer{ //copy the app to the correct place if(!mkdir($basedir)){ - error_log('Can\'t create app folder ('.$basedir.')'); + if(defined("DEBUG") && DEBUG) {error_log('Can\'t create app folder ('.$basedir.')');} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); diff --git a/lib/preferences.php b/lib/preferences.php index 5af007f0223..b4bd6777f9e 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -140,7 +140,7 @@ class OC_Preferences{ // Check if the key does exist $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); $values=$query->execute(array($user,$app,$key))->fetchAll(); - error_log(print_r($values,true)); + if(defined("DEBUG") && DEBUG) {error_log(print_r($values,true));} $exists=(count($values)>0); if( !$exists ){ |