From 6b278c89b3c939d602d1b0d38752cf35f4e2aa10 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Wed, 28 Aug 2013 19:30:49 +0530 Subject: [PATCH 01/14] Adds Node Modules to build in gitignore for easy testing. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 43f3cab9121..724f2460b04 100644 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,9 @@ nbproject # Tests /tests/phpunit.xml +# Node Modules +/build/node_modules/ + # Tests - auto-generated files /data-autotest /tests/coverage* From 4a00b26029647b5f86d42654f1da99032b1fdf47 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 28 Aug 2013 16:25:14 +0200 Subject: [PATCH 02/14] add visualize --- 3rdparty | 2 +- core/js/visualize.js | 52 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 core/js/visualize.js diff --git a/3rdparty b/3rdparty index 03c3817ff13..c48a48cd2cf 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 03c3817ff132653c794fd04410977952f69fd614 +Subproject commit c48a48cd2cfbdbba8487d6aedcc14c123db47ba3 diff --git a/core/js/visualize.js b/core/js/visualize.js new file mode 100644 index 00000000000..d6891085ce2 --- /dev/null +++ b/core/js/visualize.js @@ -0,0 +1,52 @@ +/** + * ownCloud + * + * @author Morris Jobke + * @copyright 2013 Morris Jobke + * + * 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 . + * + */ + +/* + * Adds a background color to the element called on and adds the first charater + * of the passed in string. This string is also the seed for the generation of + * the background color. + * + * You have following HTML: + * + *
+ * + * And call this from Javascript: + * + * $('#albumart').visualize('The Album Title'); + * + * Which will result in: + * + *
T
+ * + */ + +(function ($) { + $.fn.visualize = 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)]; + this.css('background-color', 'rgb(' + rgb.join(',') + ')'); + this.html(seed[0].toUpperCase()); + }; +}(jQuery)); \ No newline at end of file From ed2fa06a26ad1f43dcf750133cd658638a0e9481 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 28 Aug 2013 16:52:12 +0200 Subject: [PATCH 03/14] reviewers comments --- core/js/{visualize.js => placeholder.js} | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) rename core/js/{visualize.js => placeholder.js} (76%) diff --git a/core/js/visualize.js b/core/js/placeholder.js similarity index 76% rename from core/js/visualize.js rename to core/js/placeholder.js index d6891085ce2..6a1c653b587 100644 --- a/core/js/visualize.js +++ b/core/js/placeholder.js @@ -30,7 +30,7 @@ * * And call this from Javascript: * - * $('#albumart').visualize('The Album Title'); + * $('#albumart').placeholder('The Album Title'); * * Which will result in: * @@ -39,14 +39,22 @@ */ (function ($) { - $.fn.visualize = function(seed) { + $.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)]; + blue = parseInt(hash.substr(20,10), 16) / maxRange * 256, + rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)]; this.css('background-color', 'rgb(' + rgb.join(',') + ')'); - this.html(seed[0].toUpperCase()); + + // CSS rules + this.css('color', 'rgb(255, 255, 255)'); + this.css('font-weight', 'bold'); + this.css('text-align', 'center'); + + if(seed !== null && seed.length) { + this.html(seed[0].toUpperCase()); + } }; -}(jQuery)); \ No newline at end of file +}(jQuery)); From 16abc536c5866c9e0379ebd6f4e4f8faa895b259 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 28 Aug 2013 16:59:12 +0200 Subject: [PATCH 04/14] fix 3rdparty commit --- 3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty b/3rdparty index c48a48cd2cf..6c116295968 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit c48a48cd2cfbdbba8487d6aedcc14c123db47ba3 +Subproject commit 6c1162959688f6b4a91d15c9b208ef408694343a From b5e2842e0049f64b0f7c7ba9ce8b831bd84a0d78 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 5 Jul 2013 22:24:36 +0200 Subject: [PATCH 05/14] Very simple log rotation --- lib/base.php | 1 + lib/log/rotate.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 lib/log/rotate.php diff --git a/lib/base.php b/lib/base.php index 0c9fe329b8f..22aed1c5664 100644 --- a/lib/base.php +++ b/lib/base.php @@ -491,6 +491,7 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); self::registerShareHooks(); + \OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); diff --git a/lib/log/rotate.php b/lib/log/rotate.php new file mode 100644 index 00000000000..d5b970c1a9e --- /dev/null +++ b/lib/log/rotate.php @@ -0,0 +1,26 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OC\Log; + +class Rotate extends \OC\BackgroundJob\Job { + const LOG_SIZE_LIMIT = 104857600; // 100 MB + public function run($logFile) { + $filesize = filesize($logFile); + if ($filesize >= self::LOG_SIZE_LIMIT) { + $this->rotate($logFile); + } + } + + protected function rotate($logfile) { + $rotated_logfile = $logfile.'.1'; + rename($logfile, $rotated_logfile); + $msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotated_logfile.'"'; + \OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN); + } +} From 594a2af75af8d350965d11c1e77f12f1ebae456f Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 5 Jul 2013 22:42:17 +0200 Subject: [PATCH 06/14] Review fixes --- lib/log/rotate.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/log/rotate.php b/lib/log/rotate.php index d5b970c1a9e..d79fd40342c 100644 --- a/lib/log/rotate.php +++ b/lib/log/rotate.php @@ -11,16 +11,16 @@ namespace OC\Log; class Rotate extends \OC\BackgroundJob\Job { const LOG_SIZE_LIMIT = 104857600; // 100 MB public function run($logFile) { - $filesize = filesize($logFile); + $filesize = @filesize($logFile); if ($filesize >= self::LOG_SIZE_LIMIT) { $this->rotate($logFile); } } protected function rotate($logfile) { - $rotated_logfile = $logfile.'.1'; - rename($logfile, $rotated_logfile); - $msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotated_logfile.'"'; + $rotatedLogfile = $logfile.'.1'; + rename($logfile, $rotatedLogfile); + $msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotatedLogfile.'"'; \OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN); } } From 62560ef859a459542af50dd1905bdf8828a1d142 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 5 Jul 2013 22:59:42 +0200 Subject: [PATCH 07/14] Add description to log rotate class --- lib/log/rotate.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/log/rotate.php b/lib/log/rotate.php index d79fd40342c..3b976d50dce 100644 --- a/lib/log/rotate.php +++ b/lib/log/rotate.php @@ -8,6 +8,13 @@ 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. The + * total disk usage is twice LOG_SIZE_LIMIT. + * 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 { const LOG_SIZE_LIMIT = 104857600; // 100 MB public function run($logFile) { From 42f3ecb60fb14ef9739b436f115d302b5d4432a1 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 10 Jul 2013 18:07:43 +0200 Subject: [PATCH 08/14] Check for installed state before registering the logrotate background job --- lib/base.php | 16 +++++++++++++++- lib/log/rotate.php | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/base.php b/lib/base.php index 22aed1c5664..f45012bb83c 100644 --- a/lib/base.php +++ b/lib/base.php @@ -491,7 +491,7 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); self::registerShareHooks(); - \OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'); + self::registerLogRotate(); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); @@ -553,6 +553,20 @@ class OC { } } + /** + * register hooks for the cache + */ + public static function registerLogRotate() { + if (OC_Config::getValue('installed', 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 */ diff --git a/lib/log/rotate.php b/lib/log/rotate.php index 3b976d50dce..41ef2ea299c 100644 --- a/lib/log/rotate.php +++ b/lib/log/rotate.php @@ -16,7 +16,7 @@ namespace OC\Log; * location and manage that with your own tools. */ class Rotate extends \OC\BackgroundJob\Job { - const LOG_SIZE_LIMIT = 104857600; // 100 MB + const LOG_SIZE_LIMIT = 104857600; // 100 MiB public function run($logFile) { $filesize = @filesize($logFile); if ($filesize >= self::LOG_SIZE_LIMIT) { From 3fd2df4088d17547a3a31023a75cf538c95ade18 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 28 Aug 2013 17:41:27 +0200 Subject: [PATCH 09/14] Only enable logrotate when configured. Also rotate size is settable. --- config/config.sample.php | 15 ++++++++++++--- lib/base.php | 3 ++- lib/log/rotate.php | 16 +++++++++------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/config/config.sample.php b/config/config.sample.php index 24ba541ac5c..f5cb33732f8 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -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' ); diff --git a/lib/base.php b/lib/base.php index f45012bb83c..2e6a37c9f4e 100644 --- a/lib/base.php +++ b/lib/base.php @@ -557,7 +557,8 @@ class OC { * register hooks for the cache */ public static function registerLogRotate() { - if (OC_Config::getValue('installed', false)) { //don't try to do this before we are properly setup + 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'); diff --git a/lib/log/rotate.php b/lib/log/rotate.php index 41ef2ea299c..b620f0be15c 100644 --- a/lib/log/rotate.php +++ b/lib/log/rotate.php @@ -10,24 +10,26 @@ 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. The - * total disk usage is twice LOG_SIZE_LIMIT. + * 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 { - const LOG_SIZE_LIMIT = 104857600; // 100 MiB + private $max_log_size; public function run($logFile) { - $filesize = @filesize($logFile); - if ($filesize >= self::LOG_SIZE_LIMIT) { - $this->rotate($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 100MB, moved to "'.$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); } } From e7b40983e4841de1b36c270e7331e345aac6a90c Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 28 Aug 2013 17:58:23 +0200 Subject: [PATCH 10/14] change orientation for delete tooltip to left, fix #4589 --- core/js/js.js | 1 + 1 file changed, 1 insertion(+) diff --git a/core/js/js.js b/core/js/js.js index d580b6113e6..c2f79dff68b 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -762,6 +762,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}); From d4952bd9df679306ff3e2a8efba1f37ed9d97044 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 28 Aug 2013 18:36:32 +0200 Subject: [PATCH 11/14] fix typo --- lib/log/rotate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/log/rotate.php b/lib/log/rotate.php index b620f0be15c..bf23ad588b3 100644 --- a/lib/log/rotate.php +++ b/lib/log/rotate.php @@ -17,7 +17,7 @@ namespace OC\Log; 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); + $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) { From 54d07bd9b0448c8343b1f9424f75b859d0b3d01d Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 28 Aug 2013 21:22:56 +0200 Subject: [PATCH 12/14] update 3rdparty - md5 --- 3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty b/3rdparty index 6c116295968..21b466b72cd 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 6c1162959688f6b4a91d15c9b208ef408694343a +Subproject commit 21b466b72cdd4c823c011669593ecef1defb1f3c From 067815099f909a20fd6cf79af451dedc53bf4c54 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 28 Aug 2013 21:54:20 +0200 Subject: [PATCH 13/14] calculate fontsize and line-height --- core/js/placeholder.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/js/placeholder.js b/core/js/placeholder.js index 6a1c653b587..318fe48ffa4 100644 --- a/core/js/placeholder.js +++ b/core/js/placeholder.js @@ -34,7 +34,7 @@ * * Which will result in: * - *
T
+ *
T
* */ @@ -45,7 +45,8 @@ 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)]; + rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)], + height = this.height(); this.css('background-color', 'rgb(' + rgb.join(',') + ')'); // CSS rules @@ -53,6 +54,10 @@ 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()); } From 6502a148ec6a23abaf4af6426db83129ca0d9b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 28 Aug 2013 23:04:55 +0200 Subject: [PATCH 14/14] fixing typo --- core/js/placeholder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/js/placeholder.js b/core/js/placeholder.js index 318fe48ffa4..16543541cb4 100644 --- a/core/js/placeholder.js +++ b/core/js/placeholder.js @@ -20,7 +20,7 @@ */ /* - * Adds a background color to the element called on and adds the first charater + * 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. *