diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-08-10 12:36:32 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-08-10 14:03:54 +0200 |
commit | 1f1498ceca51c5b30130b80a59c00c1b37dc7009 (patch) | |
tree | 49a82acb3e48197ff43b915293b6c89acf82bd3e /lib | |
parent | cdf91b6b3e0f6d9fc435497b9dcc051ff24d6c7e (diff) | |
download | nextcloud-server-1f1498ceca51c5b30130b80a59c00c1b37dc7009.tar.gz nextcloud-server-1f1498ceca51c5b30130b80a59c00c1b37dc7009.zip |
remove Log completely
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.php | 2 | ||||
-rw-r--r-- | lib/files.php | 2 | ||||
-rw-r--r-- | lib/log.php | 151 | ||||
-rw-r--r-- | lib/ocs.php | 28 | ||||
-rw-r--r-- | lib/user.php | 2 |
5 files changed, 2 insertions, 183 deletions
diff --git a/lib/app.php b/lib/app.php index 9c7b7e75dcd..6a2e3078596 100644 --- a/lib/app.php +++ b/lib/app.php @@ -52,7 +52,7 @@ class OC_App{ } // Our very own core apps are hardcoded - foreach( array( 'admin', 'files', 'log', 'help', 'settings' ) as $app ){ + foreach( array( 'admin', 'files', 'help', 'settings' ) as $app ){ require( $app.'/appinfo/app.php' ); } diff --git a/lib/files.php b/lib/files.php index d189a96fd89..eec1007de1f 100644 --- a/lib/files.php +++ b/lib/files.php @@ -144,7 +144,6 @@ class OC_Files { die('403 Forbidden'); } ob_end_clean(); -// OC_Log::event($_SESSION['username'],3,"$dir/$files"); if($zip){ readfile($filename); unlink($filename); @@ -206,7 +205,6 @@ class OC_Files { $fileHandle=OC_Filesystem::fopen($file, 'w'); if($fileHandle){ fclose($fileHandle); -// OC_Log::event($_SESSION['username'],4,"$dir/$name"); return true; }else{ return false; diff --git a/lib/log.php b/lib/log.php deleted file mode 100644 index 1ed8e0e33c2..00000000000 --- a/lib/log.php +++ /dev/null @@ -1,151 +0,0 @@ -<?php -/** - * ownCloud - * - * @author Frank Karlitschek - * @author Jakob Sack - * @copyright 2010 Frank Karlitschek karlitschek@kde.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either - * version 3 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU Affero General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - * - */ -/* - * - * The following SQL statement is just a help for developers and will not be - * executed! - * - * CREATE TABLE `log` ( - * `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , - * `moment` DATETIME NOT NULL , - * `appid` VARCHAR( 255 ) NOT NULL , - * `user` VARCHAR( 255 ) NOT NULL , - * `action` VARCHAR( 255 ) NOT NULL , - * `info` TEXT NOT NULL - * ) ENGINE = MYISAM ; - * - */ - -/** - * This class is for logging - */ -class OC_Log { - /** - * @brief adds an entry to the log - * @param $appid id of the app - * @param $subject username - * @param $predicate action - * @param $object = null; additional information - * @returns true/false - * - * This function adds another entry to the log database - */ - public static function add( $appid, $subject, $predicate, $object = ' ' ){ - $query=OC_DB::prepare("INSERT INTO `*PREFIX*log`(moment,appid,`user`,action,info) VALUES(NOW(),?,?,?,?)"); - $result=$query->execute(array($appid,$subject,$predicate,$object)); - // Die if we have an error - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"<br />'; - $entry .= 'Offending command was: '.$query.'<br />'; - error_log( $entry ); - die( $entry ); - } - return true; - } - - /** - * @brief Fetches log entries - * @param $filter = array(); array with filter options - * @returns array with entries - * - * This function fetches the log entries according to the filter options - * passed. - * - * $filter is an associative array. - * The following keys are optional: - * - from: all entries after this date - * - until: all entries until this date - * - user: username (default: current user) - * - app: only entries for this app - */ - public static function get( $filter = array()){ - $queryString='SELECT * FROM `*PREFIX*log` WHERE 1=1 ORDER BY moment DESC'; - $params=array(); - if(isset($filter['from'])){ - $queryString.='AND moment>? '; - array_push($params,$filter('from')); - } - if(isset($filter['until'])){ - $queryString.='AND moment<? '; - array_push($params,$filter('until')); - } - if(isset($filter['user'])){ - $queryString.='AND `user`=? '; - array_push($params,$filter('user')); - } - if(isset($filter['app'])){ - $queryString.='AND appid=? '; - array_push($params,$filter('app')); - } - $query=OC_DB::prepare($queryString); - $result=$query->execute($params)->fetchAll(); - if(count($result)>0 and is_numeric($result[0]['moment'])){ - foreach($result as &$row){ - $row['moment']=OC_Util::formatDate($row['moment']); - } - } - return $result; - - } - - /** - * @brief removes log entries - * @param $date delete entries older than this date - * @returns true/false - * - * This function deletes all entries that are older than $date. - */ - public static function deleteBefore( $date ){ - $query=OC_DB::prepare("DELETE FROM `*PREFIX*log` WHERE moment<?"); - $query->execute(array($date)); - return true; - } - - /** - * @brief removes all log entries - * @returns true/false - * - * This function deletes all log entries. - */ - public static function deleteAll(){ - $query=OC_DB::prepare("DELETE FROM `*PREFIX*log`"); - $query->execute(); - return true; - } - - /** - * @brief filter an array of log entries on action - * @param array $logs the log entries to filter - * @param array $actions an array of actions to filter for - * @returns array - */ - public static function filterAction($logs,$actions){ - $filteredLogs=array(); - foreach($logs as $log){ - if(array_search($log['action'],$actions)!==false){ - $filteredLogs[]=$log; - } - } - return $filteredLogs; - } -} diff --git a/lib/ocs.php b/lib/ocs.php index bcacfe704c0..536ee754e84 100644 --- a/lib/ocs.php +++ b/lib/ocs.php @@ -402,33 +402,7 @@ class OC_OCS { private static function activityGet($format,$page,$pagesize) { $user=OC_OCS::checkpassword(); - $query = OC_DB::prepare('select count(*) as co from *PREFIX*log'); - $result = $query->execute(); - $entry=$result->fetchRow(); - $totalcount=$entry['co']; - - $query=OC_DB::prepare('select id,timestamp,`user`,type,message from *PREFIX*log order by timestamp desc limit ?,?'); - $result = $query->execute(array(($page*$pagesize),$pagesize))->fetchAll(); - - $itemscount=count($result); - - $url='http://'.substr($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'],0,-11).''; - $xml=array(); - foreach($result as $i=>$log) { - $xml[$i]['id']=$log['id']; - $xml[$i]['personid']=$log['user']; - $xml[$i]['firstname']=$log['user']; - $xml[$i]['lastname']=''; - $xml[$i]['profilepage']=$url; - - $pic=$url.'/img/owncloud-icon.png'; - $xml[$i]['avatarpic']=$pic; - - $xml[$i]['timestamp']=date('c',$log['timestamp']); - $xml[$i]['type']=1; - $xml[$i]['message']=OC_Log::$TYPE[$log['type']].' '.strip_tags($log['message']); - $xml[$i]['link']=$url; - } + //TODO $txt=OC_OCS::generatexml($format,'ok',100,'',$xml,'activity','full',2,$totalcount,$pagesize); echo($txt); diff --git a/lib/user.php b/lib/user.php index 9b8f5fb13e7..a2ede8234be 100644 --- a/lib/user.php +++ b/lib/user.php @@ -193,7 +193,6 @@ class OC_User { if( $run && self::checkPassword( $uid, $password )){ $_SESSION['user_id'] = $uid; - OC_Log::add( "core", $_SESSION['user_id'], "login" ); OC_Hook::emit( "OC_User", "post_login", array( "uid" => $uid )); return true; } @@ -210,7 +209,6 @@ class OC_User { */ public static function logout(){ OC_Hook::emit( "OC_User", "logout", array()); - OC_Log::add( "core", $_SESSION['user_id'], "logout" ); $_SESSION['user_id'] = false; return true; } |