Merge branch 'master' into oc_avatars

Conflicts:
	3rdparty
This commit is contained in:
kondou 2013-08-28 23:21:26 +02:00
commit 0ba498119c
7 changed files with 133 additions and 4 deletions

3
.gitignore vendored
View File

@ -82,6 +82,9 @@ nbproject
# Tests
/tests/phpunit.xml
# Node Modules
/build/node_modules/
# Tests - auto-generated files
/data-autotest
/tests/coverage*

@ -1 +1 @@
Subproject commit ea5e07f120177092cdb11ee16d7b54fb1ff16cb3
Subproject commit 9d8b5602ecb35697919e2a548e2a704058a6d21a

View File

@ -141,10 +141,22 @@ $CONFIG = array(
/* Loglevel to start logging at. 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default is WARN) */
"loglevel" => "",
/* date format to be used while writing to the owncloud logfile */
'logdateformat' => 'F d, Y H:i:s',
/* Append all database queries and parameters to the log file.
(watch out, this option can increase the size of your log file)*/
"log_query" => false,
/*
* Configure the size in bytes log rotation should happen, 0 or false disables the rotation.
* This rotates the current owncloud logfile to a new name, this way the total log usage
* will stay limited and older entries are available for a while longer. The
* total disk usage is twice the configured size.
* WARNING: When you use this, the log entries will eventually be lost.
*/
'log_rotate_size' => false, // 104857600, // 100 MiB
/* Lifetime of the remember login cookie, default is 15 days */
"remember_login_cookie_lifetime" => 60*60*24*15,
@ -189,7 +201,4 @@ $CONFIG = array(
'customclient_desktop' => '', //http://owncloud.org/sync-clients/
'customclient_android' => '', //https://play.google.com/store/apps/details?id=com.owncloud.android
'customclient_ios' => '', //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8
// date format to be used while writing to the owncloud logfile
'logdateformat' => 'F d, Y H:i:s'
);

View File

@ -761,6 +761,7 @@ $(document).ready(function(){
$('.password .action').tipsy({gravity:'se', fade:true, live:true});
$('#upload').tipsy({gravity:'w', fade:true});
$('.selectedActions a').tipsy({gravity:'s', fade:true, live:true});
$('a.action.delete').tipsy({gravity:'e', fade:true, live:true});
$('a.action').tipsy({gravity:'s', fade:true, live:true});
$('td .modified').tipsy({gravity:'s', fade:true, live:true});

65
core/js/placeholder.js Normal file
View File

@ -0,0 +1,65 @@
/**
* ownCloud
*
* @author Morris Jobke
* @copyright 2013 Morris Jobke <morris.jobke@gmail.com>
*
* 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/>.
*
*/
/*
* Adds a background color to the element called on and adds the first character
* of the passed in string. This string is also the seed for the generation of
* the background color.
*
* You have following HTML:
*
* <div id="albumart"></div>
*
* And call this from Javascript:
*
* $('#albumart').placeholder('The Album Title');
*
* Which will result in:
*
* <div id="albumart" style="background-color: rgb(123, 123, 123); ... ">T</div>
*
*/
(function ($) {
$.fn.placeholder = function(seed) {
var hash = md5(seed),
maxRange = parseInt('ffffffffff', 16),
red = parseInt(hash.substr(0,10), 16) / maxRange * 256,
green = parseInt(hash.substr(10,10), 16) / maxRange * 256,
blue = parseInt(hash.substr(20,10), 16) / maxRange * 256,
rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)],
height = this.height();
this.css('background-color', 'rgb(' + rgb.join(',') + ')');
// CSS rules
this.css('color', 'rgb(255, 255, 255)');
this.css('font-weight', 'bold');
this.css('text-align', 'center');
// calculate the height
this.css('line-height', height + 'px');
this.css('font-size', (height * 0.55) + 'px');
if(seed !== null && seed.length) {
this.html(seed[0].toUpperCase());
}
};
}(jQuery));

View File

@ -491,6 +491,7 @@ class OC {
self::registerCacheHooks();
self::registerFilesystemHooks();
self::registerShareHooks();
self::registerLogRotate();
//make sure temporary files are cleaned up
register_shutdown_function(array('OC_Helper', 'cleanTmp'));
@ -552,6 +553,21 @@ class OC {
}
}
/**
* register hooks for the cache
*/
public static function registerLogRotate() {
if (OC_Config::getValue('installed', false) && OC_Config::getValue('log_rotate_size', false)) {
//don't try to do this before we are properly setup
// register cache cleanup jobs
try { //if this is executed before the upgrade to the new backgroundjob system is completed it will throw an exception
\OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log');
} catch (Exception $e) {
}
}
}
/**
* register hooks for the filesystem
*/

35
lib/log/rotate.php Normal file
View File

@ -0,0 +1,35 @@
<?php
/**
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OC\Log;
/**
* This rotates the current logfile to a new name, this way the total log usage
* will stay limited and older entries are available for a while longer.
* For more professional log management set the 'logfile' config to a different
* location and manage that with your own tools.
*/
class Rotate extends \OC\BackgroundJob\Job {
private $max_log_size;
public function run($logFile) {
$this->max_log_size = \OC_Config::getValue('log_rotate_size', false);
if ($this->max_log_size) {
$filesize = @filesize($logFile);
if ($filesize >= $this->max_log_size) {
$this->rotate($logFile);
}
}
}
protected function rotate($logfile) {
$rotatedLogfile = $logfile.'.1';
rename($logfile, $rotatedLogfile);
$msg = 'Log file "'.$logfile.'" was over '.$this->max_log_size.' bytes, moved to "'.$rotatedLogfile.'"';
\OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN);
}
}