use OC_Log instead of error_log

remotes/origin/stable
Robin Appelman 13 years ago
parent d9372ac766
commit b0127e3918

@ -26,14 +26,14 @@ if (isset($_POST['admin_export'])) {
$root = OC::$SERVERROOT . "/";
$zip = new ZipArchive();
$filename = sys_get_temp_dir() . "/owncloud_export_" . date("y-m-d_H-i-s") . ".zip";
error_log("Creating export file at: " . $filename);
OC_Log::write('admin_export',"Creating export file at: " . $filename,OC_Log::INFO);
if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
exit("Cannot open <$filename>\n");
}
if (isset($_POST['owncloud_system'])) {
// adding owncloud system files
error_log("Adding owncloud system files to export");
OC_Log::write('admin_export',"Adding owncloud system files to export",OC_Log::INFO);
zipAddDir($root, $zip, false);
foreach (array(".git", "3rdparty", "apps", "core", "files", "l10n", "lib", "ocs", "search", "settings", "tests") as $dirname) {
zipAddDir($root . $dirname, $zip, true, basename($root) . "/");
@ -43,7 +43,7 @@ if (isset($_POST['admin_export'])) {
if (isset($_POST['owncloud_config'])) {
// adding owncloud config
// todo: add database export
error_log("Adding owncloud config to export");
OC_Log::write('admin_export',"Adding owncloud config to export",OC_Log::INFO);
zipAddDir($root . "config/", $zip, true, basename($root) . "/");
$zip->addFile($root . '/data/.htaccess', basename($root) . "/data/owncloud.db");
}
@ -53,7 +53,7 @@ if (isset($_POST['admin_export'])) {
$zip->addFile($root . '/data/.htaccess', basename($root) . "/data/.htaccess");
$zip->addFile($root . '/data/index.html', basename($root) . "/data/index.html");
foreach (OC_User::getUsers() as $i) {
error_log("Adding owncloud user files of $i to export");
OC_Log::write('admin_export',"Adding owncloud user files of $i to export",OC_Log::INFO);
zipAddDir($root . "data/" . $i, $zip, true, basename($root) . "/data/");
}
}
@ -78,19 +78,19 @@ function zipAddDir($dir, $zip, $recursive=true, $internalDir='') {
$internalDir.=$dirname.='/';
if ($dirhandle = opendir($dir)) {
while (false !== ( $file = readdir($dirhandle))) {
while (false !== ( $file = readdir($dirhandle))) {
if (( $file != '.' ) && ( $file != '..' )) {
if (( $file != '.' ) && ( $file != '..' )) {
if (is_dir($dir . '/' . $file) && $recursive) {
zipAddDir($dir . '/' . $file, $zip, $recursive, $internalDir);
} elseif (is_file($dir . '/' . $file)) {
$zip->addFile($dir . '/' . $file, $internalDir . $file);
if (is_dir($dir . '/' . $file) && $recursive) {
zipAddDir($dir . '/' . $file, $zip, $recursive, $internalDir);
} elseif (is_file($dir . '/' . $file)) {
$zip->addFile($dir . '/' . $file, $internalDir . $file);
}
}
}
}
}
closedir($dirhandle);
closedir($dirhandle);
} else {
error_log("Was not able to open directory: " . $dir);
OC_Log::write('admin_export',"Was not able to open directory: " . $dir,OC_Log::ERROR);
}
}

@ -30,9 +30,7 @@ $RUNTIME_NOSETUPFS=true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('media');
if(defined("DEBUG") && DEBUG) {error_log($_GET['autoupdate']);}
$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true');
if(defined("DEBUG") && DEBUG) {error_log((integer)$autoUpdate);}
OC_Preferences::setValue(OC_User::getUser(),'media','autoupdate',(integer)$autoUpdate);

@ -195,7 +195,6 @@ class OC_MEDIA_AMPACHE{
$filter=isset($params['filter'])?$params['filter']:'';
$exact=isset($params['exact'])?($params['exact']=='true'):false;
$artists=OC_MEDIA_COLLECTION::getArtists($filter,$exact);
if(defined("DEBUG") && DEBUG) {error_log('artists found: '.print_r($artists,true));}
echo('<root>');
foreach($artists as $artist){
self::printArtist($artist);

@ -40,7 +40,6 @@ class OC_MEDIA{
*/
public static function loginListener($params){
if(isset($_POST['user']) and $_POST['password']){
if(defined("DEBUG") && DEBUG) {error_log('postlogin');}
$name=$_POST['user'];
$query=OC_DB::prepare("SELECT user_id from *PREFIX*media_users WHERE user_id LIKE ?");
$uid=$query->execute(array($name))->fetchAll();
@ -64,7 +63,6 @@ class OC_MEDIA{
$path=substr($path,1);
}
$path='/'.$path;
error_log("$path was updated");
OC_MEDIA_SCANNER::scanFile($path);
}

@ -97,25 +97,25 @@ class OC_MEDIA_SCANNER{
$data=@self::$getID3->analyze($file);
getid3_lib::CopyTagsToComments($data);
if(!isset($data['comments'])){
if(defined("DEBUG") && DEBUG) {error_log("error reading id3 tags in '$file'");}
OC_Log::write('media',"error reading id3 tags in '$file'",OC_Log::WARN);
return;
}
if(!isset($data['comments']['artist'])){
if(defined("DEBUG") && DEBUG) {error_log("error reading artist tag in '$file'");}
OC_Log::write('media',"error reading artist tag in '$file'",OC_Log::WARN);
$artist='unknown';
}else{
$artist=stripslashes($data['comments']['artist'][0]);
$artist=utf8_encode($artist);
}
if(!isset($data['comments']['album'])){
if(defined("DEBUG") && DEBUG) {error_log("error reading album tag in '$file'");}
OC_Log::write('media',"error reading album tag in '$file'",OC_Log::WARN);
$album='unknown';
}else{
$album=stripslashes($data['comments']['album'][0]);
$album=utf8_encode($album);
}
if(!isset($data['comments']['title'])){
if(defined("DEBUG") && DEBUG) {error_log("error reading title tag in '$file'");}
OC_Log::write('media',"error reading title tag in '$file'",OC_Log::WARN);
$title='unknown';
}else{
$title=stripslashes($data['comments']['title'][0]);

@ -37,7 +37,7 @@ foreach($arguments as &$argument){
}
ob_clean();
if(isset($arguments['action'])){
if(defined("DEBUG") && DEBUG) {error_log($arguments['action']);}
OC_Log::write('media','ampache '.$arguments['action'].' request', OC_Log::DEBUG);
switch($arguments['action']){
case 'url_to_song':
OC_MEDIA_AMPACHE::url_to_song($arguments);

@ -7,7 +7,7 @@ class OC_remoteStorage {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
die( $entry );
}
$ret = array();
@ -24,7 +24,7 @@ class OC_remoteStorage {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
die( $entry );
}
$ret = array();
@ -45,7 +45,7 @@ class OC_remoteStorage {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
die( $entry );
}
}
@ -56,7 +56,7 @@ class OC_remoteStorage {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
die( $entry );
}
}

@ -26,14 +26,14 @@ OC_User::useBackend('openid');
//check for results from openid requests
if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
if(defined("DEBUG") && DEBUG) {error_log('openid retured');}
OC_Log::write('user_openid','openid retured',OC_Log::DEBUG);
$openid = new SimpleOpenID;
$openid->SetIdentity($_GET['openid_identity']);
$openid_validation_result = $openid->ValidateWithServer();
if ($openid_validation_result == true){ // OK HERE KEY IS VALID
if(defined("DEBUG") && DEBUG) {error_log('auth sucessfull');}
OC_Log::write('user_openid','auth sucessfull',OC_Log::DEBUG);
$identity=$openid->GetIdentity();
if(defined("DEBUG") && DEBUG) {error_log("auth as $identity");}
OC_Log::write('user_openid','auth as '.$identity,OC_Log::DEBUG);
$user=OC_USER_OPENID::findUserForIdentity($identity);
if($user){
$_SESSION['user_id']=$user;
@ -41,13 +41,13 @@ if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
}
}else if($openid->IsError() == true){ // ON THE WAY, WE GOT SOME ERROR
$error = $openid->GetError();
if(defined("DEBUG") && DEBUG) {error_log("ERROR CODE: " . $error['code']);}
if(defined("DEBUG") && DEBUG) {error_log("ERROR DESCRIPTION: " . $error['description']);}
OC_Log::write('user_openid','ERROR CODE: '. $error['code'],OC_Log::ERROR);
OC_Log::write('user_openid','ERROR DESCRIPTION: '. $error['description'],OC_Log::ERROR);
}else{ // Signature Verification Failed
if(defined("DEBUG") && DEBUG) {error_log("INVALID AUTHORIZATION");}
OC_Log::write('user_openid','INVALID AUTHORIZATION',OC_Log::ERROR);
}
}else if (isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'cancel'){ // User Canceled your Request
if(defined("DEBUG") && DEBUG) {error_log("USER CANCELED REQUEST");}
OC_Log::write('user_openid','USER CANCELED REQUEST',OC_Log::DEBUG);
return false;
}

@ -1053,8 +1053,6 @@ function debug ($x, $m = null) {
} else {
$x .= "\n";
}
if(defined("DEBUG") && DEBUG) {error_log($x . "\n", 3, $profile['logfile']);}
}
@ -1513,7 +1511,6 @@ function wrap_html ( $message ) {
</body>
</html>
';
if(defined("DEBUG") && DEBUG) {error_log($html);}
echo $html;
exit(0);
}
@ -1658,15 +1655,6 @@ $profile['req_url'] = sprintf("%s://%s%s",
// $port,//host already includes the path
$_SERVER["REQUEST_URI"]);
// $fullId='user.php/'.$USERNAME.'/';
// $incompleteId='user.php/';
// if(!strpos($profile['req_url'],$fullId)){
// $profile['req_url']=str_replace($incompleteId,$fullId,$profile['req_url']);
// }
// if(defined("DEBUG") && DEBUG) {error_log('inc id: '.$fullId);}
// if(defined("DEBUG") && DEBUG) {error_log('req url: '.$profile['req_url']);}
// Set the default allowance for testing
if (! array_key_exists('allow_test', $profile))

@ -40,7 +40,7 @@ require_once '../../lib/base.php';
OC_Util::checkAppEnabled('user_openid');
if(!OC_User::userExists($USERNAME)){
if(defined("DEBUG") && DEBUG) {error_log($USERNAME.' doesn\'t exist');}
OC_Log::write('user_openid',$USERNAME.' doesn\'t exist',OC_Log::WARN);
$USERNAME='';
}
$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME;

@ -13,7 +13,7 @@ if($foldername == '') {
OC_JSON::error(array("data" => array( "message" => "Empty Foldername" )));
exit();
}
if(defined("DEBUG") && DEBUG) {error_log('try to create ' . $foldername . ' in ' . $dir);}
if(OC_Files::newFile($dir, $foldername, 'dir')) {
OC_JSON::success(array("data" => array()));
exit();

@ -31,7 +31,7 @@ if($not_installed) {
// Check for autosetup:
$autosetup_file = OC::$SERVERROOT."/config/autoconfig.php";
if( file_exists( $autosetup_file )){
error_log("Autoconfig file found, setting up owncloud...");
OC_Log::write('core','Autoconfig file found, setting up owncloud...',OC_Log::INFO);
include( $autosetup_file );
$_POST['install'] = 'true';
$_POST = array_merge ($_POST, $AUTOCONFIG);
@ -68,7 +68,7 @@ else {
// remember was checked after last login
if(isset($_COOKIE["oc_remember_login"]) && isset($_COOKIE["oc_token"]) && isset($_COOKIE["oc_username"]) && $_COOKIE["oc_remember_login"]) {
if(defined("DEBUG") && DEBUG) {
error_log("Trying to login from cookie");
OC_Log::write('core','Trying to login from cookie',OC_Log::DEBUG);
}
// confirm credentials in cookie
if(isset($_COOKIE['oc_token']) && OC_User::userExists($_COOKIE['oc_username']) &&
@ -86,7 +86,7 @@ else {
if(OC_User::login($_POST["user"], $_POST["password"])) {
if(!empty($_POST["remember_login"])){
if(defined("DEBUG") && DEBUG) {
error_log("Setting remember login to cookie");
OC_Log::write('core','Setting remember login to cookie',OC_Log::DEBUG);
}
$token = md5($_POST["user"].time());
OC_Preferences::setValue($_POST['user'], 'login', 'token', $token);

@ -161,9 +161,8 @@ class OC_DB {
// Die if we could not connect
if( PEAR::isError( self::$MDB2 )){
echo( '<b>can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')</center>');
$error = self::$MDB2->getMessage();
error_log( $error);
error_log( self::$MDB2->getUserInfo());
OC_Log::write('core',self::$MDB2->getUserInfo(),OC_Log::FATAL);
OC_Log::write('core',self::$MDB2->getMessage(),OC_Log::FATAL);
die( $error );
}
@ -195,7 +194,7 @@ class OC_DB {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$query.'<br />';
error_log( $entry );
OC_Log::write('core',$entry,OC_Log::FATAL);
die( $entry );
}
}else{
@ -204,7 +203,7 @@ class OC_DB {
}catch(PDOException $e){
$entry = 'DB Error: "'.$e->getMessage().'"<br />';
$entry .= 'Offending command was: '.$query.'<br />';
error_log( $entry );
OC_Log::write('core',$entry,OC_Log::FATAL);
die( $entry );
}
$result=new PDOStatementWrapper($result);

@ -195,7 +195,6 @@ class OC_Filestorage_Local extends OC_Filestorage{
}
private function delTree($dir) {
if(defined("DEBUG") && DEBUG) {error_log('del'.$dir);}
$dirRelative=$dir;
$dir=$this->datadir.$dir;
if (!file_exists($dir)) return true;

@ -56,7 +56,7 @@ class OC_Installer{
*/
public static function installApp( $data = array()){
if(!isset($data['source'])){
if(defined("DEBUG") && DEBUG) {error_log("No source specified when installing app");}
OC_Log::write('core','No source specified when installing app',OC_Log::ERROR);
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'])){
if(defined("DEBUG") && DEBUG) {error_log("No href specified when installing app from http");}
OC_Log::write('core','No href specified when installing app from http',OC_Log::ERROR);
return false;
}
copy($data['href'],$path);
}else{
if(!isset($data['path'])){
if(defined("DEBUG") && DEBUG) {error_log("No path specified when installing app from local file");}
OC_Log::write('core','No path specified when installing app from local file',OC_Log::ERROR);
return false;
}
$path=$data['path'];
@ -85,7 +85,7 @@ class OC_Installer{
$zip->extractTo($extractDir);
$zip->close();
} else {
if(defined("DEBUG") && DEBUG) {error_log("Failed to open archive when installing app");}
OC_Log::write('core','Failed to open archive when installing app',OC_Log::ERROR);
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')){
if(defined("DEBUG") && DEBUG) {error_log("App does not provide an info.xml file");}
OC_Log::write('core','App does not provide an info.xml file',OC_Log::ERROR);
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'] )){
if(defined("DEBUG") && DEBUG) {error_log("App already installed");}
OC_Log::write('core','App already installed',OC_Log::WARN);
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)){
if(defined("DEBUG") && DEBUG) {error_log("App's directory already exists");}
OC_Log::write('core','App directory already exists',OC_Log::WARN);
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)){
if(defined("DEBUG") && DEBUG) {error_log('Can\'t create app folder ('.$basedir.')');}
OC_Log::write('core','Can\'t create app folder ('.$basedir.')',OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);

@ -140,7 +140,6 @@ 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();
if(defined("DEBUG") && DEBUG) {error_log(print_r($values,true));}
$exists=(count($values)>0);
if( !$exists ){

Loading…
Cancel
Save