From 1f1498ceca51c5b30130b80a59c00c1b37dc7009 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 10 Aug 2011 12:36:32 +0200 Subject: [PATCH] remove Log completely --- lib/app.php | 2 +- lib/files.php | 2 - lib/log.php | 151 ---------------------------------------- lib/ocs.php | 28 +------- lib/user.php | 2 - log/appinfo/app.php | 6 -- log/img/logs.png | Bin 213 -> 0 bytes log/index.php | 107 ---------------------------- log/js/log.js | 25 ------- log/l10n/bg_BG.php | 14 ---- log/l10n/da.php | 14 ---- log/l10n/de.php | 14 ---- log/l10n/es.php | 14 ---- log/l10n/fr.php | 14 ---- log/l10n/nl.php | 14 ---- log/l10n/pl.php | 14 ---- log/templates/index.php | 53 -------------- 17 files changed, 2 insertions(+), 472 deletions(-) delete mode 100644 lib/log.php delete mode 100644 log/appinfo/app.php delete mode 100644 log/img/logs.png delete mode 100644 log/index.php delete mode 100644 log/js/log.js delete mode 100644 log/l10n/bg_BG.php delete mode 100644 log/l10n/da.php delete mode 100644 log/l10n/de.php delete mode 100644 log/l10n/es.php delete mode 100644 log/l10n/fr.php delete mode 100644 log/l10n/nl.php delete mode 100644 log/l10n/pl.php delete mode 100644 log/templates/index.php diff --git a/lib/app.php b/lib/app.php index 9c7b7e75dc..6a2e307859 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 d189a96fd8..eec1007de1 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 1ed8e0e33c..0000000000 --- a/lib/log.php +++ /dev/null @@ -1,151 +0,0 @@ -. - * - */ -/* - * - * 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().'"
'; - $entry .= 'Offending command was: '.$query.'
'; - 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 momentexecute($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 momentexecute(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 bcacfe704c..536ee754e8 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 9b8f5fb13e..a2ede8234b 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; } diff --git a/log/appinfo/app.php b/log/appinfo/app.php deleted file mode 100644 index a3aa19d528..0000000000 --- a/log/appinfo/app.php +++ /dev/null @@ -1,6 +0,0 @@ - 1, "id" => "log", "name" => "Log" )); -OC_App::addSettingsPage( array( "id" => "log", "order" => 999, "href" => OC_Helper::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_Helper::imagePath( "log", "logs.png" ))); - -*/ ?> diff --git a/log/img/logs.png b/log/img/logs.png deleted file mode 100644 index c3fad71133a3de35266b1c28328212cde86f09cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zKpodXn9)gNb_Gz7y~NYkmHjr0prDM{GXIaZK%pd07sn8b)5!@EpBeOIwlR3R`njxgN@xNA Dd5uxd diff --git a/log/index.php b/log/index.php deleted file mode 100644 index a4fbc36470..0000000000 --- a/log/index.php +++ /dev/null @@ -1,107 +0,0 @@ -. -* -*/ - -//require_once('../../config/config.php'); -/* -require_once('../lib/base.php'); - -if( !OC_User::isLoggedIn()){ - header( 'Location: '.OC_Helper::linkTo( 'index.php' )); - exit(); -} - -//load the script -OC_Util::addScript( "log", "log" ); - -$allActions=array('login','logout','read','write','create','delete'); - -//check for a submitted config -if(isset($_POST['save'])){ - $selectedActions=array(); - foreach($allActions as $action){ - if(isset($_POST[$action]) and $_POST[$action]=='on'){ - $selectedActions[]=$action; - } - } - OC_Preferences::setValue(OC_User::getUser(),'log','actions',implode(',',$selectedActions)); - OC_Preferences::setValue(OC_User::getUser(),'log','pagesize',$_POST['size']); -} -//clear log entries -elseif(isset($_POST['clear'])){ - $removeBeforeDate=(isset($_POST['removeBeforeDate']))?$_POST['removeBeforeDate']:0; - if($removeBeforeDate!==0){ - $removeBeforeDate=strtotime($removeBeforeDate); - OC_Log::deleteBefore($removeBeforeDate); - } -} -elseif(isset($_POST['clearall'])){ - OC_Log::deleteAll(); -} - -OC_App::setActiveNavigationEntry( 'log' ); -$logs=OC_Log::get(); - - -$selectedActions=explode(',',OC_Preferences::getValue(OC_User::getUser(),'log','actions',implode(',',$allActions))); -$logs=OC_Log::filterAction($logs,$selectedActions); - -$pageSize=OC_Preferences::getValue(OC_User::getUser(),'log','pagesize',20); -$pageCount=ceil(count($logs)/$pageSize); -$page=isset($_GET['page'])?$_GET['page']:0; -if($page>=$pageCount){ - $page=$pageCount-1; -} - -$logs=array_slice($logs,$page*$pageSize,$pageSize); - -foreach( $logs as &$i ){ - $i['date'] =$i['moment']; -} - -$url=OC_Helper::linkTo( 'log', 'index.php' ).'?page='; -$pager=OC_Util::getPageNavi($pageCount,$page,$url); -if($pager){ - $pagerHTML=$pager->fetchPage(); -} -else{ - $pagerHTML=''; -} - -$showActions=array(); -foreach($allActions as $action){ - if(array_search($action,$selectedActions)!==false){ - $showActions[$action]='checked="checked"'; - } - else{ - $showActions[$action]=''; - } -} - -$tmpl = new OC_Template( 'log', 'index', 'admin' ); -$tmpl->assign( 'logs', $logs ); -$tmpl->assign( 'pager', $pagerHTML ); -$tmpl->assign( 'size', $pageSize ); -$tmpl->assign( 'showActions', $showActions ); -$tmpl->printPage(); - -*/ ?> diff --git a/log/js/log.js b/log/js/log.js deleted file mode 100644 index 42ae1b4c85..0000000000 --- a/log/js/log.js +++ /dev/null @@ -1,25 +0,0 @@ -$(document).ready(function() { - // Sets the select_all checkbox behaviour : - $('#all').click(function() { - if($(this).attr('checked')){ - // Check all - $('input.action:checkbox').attr('checked', true); - }else{ - // Uncheck all - $('input.action:checkbox').attr('checked', false); - } - }); - $('input.action:checkbox').click(function() { - if(!$(this).attr('checked')){ - $('#all').attr('checked',false); - }else{ - if($('input.action:checkbox:checked').length==$('input.action:checkbox').length){ - $('#all').attr('checked',true); - } - } - }); - $('#removeBeforeDate').datepicker({ - dateFormat:'MM d, yy', - }); -}); - diff --git a/log/l10n/bg_BG.php b/log/l10n/bg_BG.php deleted file mode 100644 index 407b447905..0000000000 --- a/log/l10n/bg_BG.php +++ /dev/null @@ -1,14 +0,0 @@ - "Филтър:", -"Logins" => "Влизания:", -"Logouts" => "Изходи:", -"Downloads" => "Тегления", -"Uploads" => "Качвания", -"Creations" => "Създавания:", -"Deletions" => "Изтривания:", -"Show:" => "Показва:", -"entries per page." => "записа на страница.", -"What" => "Какво", -"When" => "Кога", -"Clear log entries before" => "Изчисти записите от журналите" -); diff --git a/log/l10n/da.php b/log/l10n/da.php deleted file mode 100644 index 8fbfae67a6..0000000000 --- a/log/l10n/da.php +++ /dev/null @@ -1,14 +0,0 @@ - "Filter:", -"Logins" => "Logins", -"Logouts" => "Logouts", -"Downloads" => "Downloads", -"Uploads" => "Uploads", -"Creations" => "Oprettelser", -"Deletions" => "Sletninger", -"Show:" => "Vis:", -"entries per page." => "poster pr side.", -"What" => "Hvilket", -"When" => "Hvornår", -"Clear log entries before" => "Slet log poster før" -); diff --git a/log/l10n/de.php b/log/l10n/de.php deleted file mode 100644 index 9cf804d6cf..0000000000 --- a/log/l10n/de.php +++ /dev/null @@ -1,14 +0,0 @@ - "Filter:", -"Logins" => "Anmeldungen", -"Logouts" => "Abmeldungen", -"Downloads" => "Downloads", -"Uploads" => "Uploads", -"Creations" => "Erstellungen", -"Deletions" => "Löschungen", -"Show:" => "Zeige", -"entries per page." => "Einträge pro Seite", -"What" => "Was", -"When" => "Wann", -"Clear log entries before" => "Lösche Einträge vor dem" -); diff --git a/log/l10n/es.php b/log/l10n/es.php deleted file mode 100644 index 4a640871b8..0000000000 --- a/log/l10n/es.php +++ /dev/null @@ -1,14 +0,0 @@ - "Filtro:", -"Logins" => "Inicios de sesión", -"Logouts" => "Cierres de sesión", -"Downloads" => "Descargas", -"Uploads" => "Subidas", -"Creations" => "Creaciones", -"Deletions" => "Eliminaciones", -"Show:" => "Mostrar", -"entries per page." => "Entradas por página.", -"What" => "Qué", -"When" => "Cuándo", -"Clear log entries before" => "Eliminar los registros anteriores a" -); diff --git a/log/l10n/fr.php b/log/l10n/fr.php deleted file mode 100644 index d411a0e159..0000000000 --- a/log/l10n/fr.php +++ /dev/null @@ -1,14 +0,0 @@ - "Filtre :", -"Logins" => "Connexions", -"Logouts" => "Déconnexions", -"Downloads" => "Téléchargements", -"Uploads" => "Téléversements", -"Creations" => "Créations", -"Deletions" => "Suppressions", -"Show:" => "Afficher :", -"entries per page." => "entrées par page.", -"What" => "Quoi", -"When" => "Quand", -"Clear log entries before" => "Effacer les entrées du journal au préalable" -); diff --git a/log/l10n/nl.php b/log/l10n/nl.php deleted file mode 100644 index f381619b5f..0000000000 --- a/log/l10n/nl.php +++ /dev/null @@ -1,14 +0,0 @@ - "Filter:", -"Logins" => "Aanmeldingen", -"Logouts" => "Afmeldingen", -"Downloads" => "Downloads", -"Uploads" => "Uploads", -"Creations" => "Creaties", -"Deletions" => "Verwijderingen", -"Show:" => "Laat", -"entries per page." => "resulaten per pagina zien", -"What" => "Wat", -"When" => "Wanneer", -"Clear log entries before" => "Verwijder logboekitem ouder dan" -); diff --git a/log/l10n/pl.php b/log/l10n/pl.php deleted file mode 100644 index 322e5df1ad..0000000000 --- a/log/l10n/pl.php +++ /dev/null @@ -1,14 +0,0 @@ - "Filtr:", -"Logins" => "Zalogowania", -"Logouts" => "Wylogowani", -"Downloads" => "Pobrania", -"Uploads" => "Wgrania", -"Creations" => "Utworzenia", -"Deletions" => "Usunięcia", -"Show:" => "Pokaż:", -"entries per page." => "wpisów na stronę.", -"What" => "Co", -"When" => "Kiedy", -"Clear log entries before" => "Wyczyść spisy dziennika sprzed" -); diff --git a/log/templates/index.php b/log/templates/index.php deleted file mode 100644 index 863ac73fdb..0000000000 --- a/log/templates/index.php +++ /dev/null @@ -1,53 +0,0 @@ - -
-

- t( 'Filter:' ); ?> - - - name="login" id="logins" /> - name="logout" id="logouts" /> - name="read" id="downloads" /> - name="write" id="uploads" /> - name="create" id="creations" /> - name="delete" id="deletions" /> -

-

- t( 'Show:' ); ?> -  t( 'entries per page.' ); ?> - - -

-
- - - - - - - - - - - - - - - - - -
t( 'What' ); ?>t( 'When' ); ?>
"> l('datetime', $entry["date"] ); ?>
- - - -
-
-

- t( 'Clear log entries before' ); ?> - - - - -

-
-
-*/ ?>