[Pkg-owncloud-commits] [owncloud] 90/145: fix DI

David Prévot taffit at moszumanska.debian.org
Wed Feb 26 16:27:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 0213928735844737f611a90d5b416f9fe5123f1a
Author: Arthur Schiwon <blizzz at owncloud.com>
Date:   Wed Feb 5 17:05:56 2014 +0100

    fix DI
---
 core/ajax/share.php                      |  3 ++-
 lib/private/share/searchresultsorter.php | 10 ++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/core/ajax/share.php b/core/ajax/share.php
index 21e320a..c251f8e 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -355,7 +355,8 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
 					}
 				}
 				$sorter = new \OC\Share\SearchResultSorter($_GET['search'],
-														   'label');
+														   'label',
+														   new \OC\Log());
 				usort($shareWith, array($sorter, 'sort'));
 				OC_JSON::success(array('data' => $shareWith));
 			}
diff --git a/lib/private/share/searchresultsorter.php b/lib/private/share/searchresultsorter.php
index f81a94c..fbf7717 100644
--- a/lib/private/share/searchresultsorter.php
+++ b/lib/private/share/searchresultsorter.php
@@ -21,10 +21,10 @@ class SearchResultSorter {
 	 * @param $encoding optional, encoding to use, defaults to UTF-8
 	 * @param $log optional, an \OC\Log instance
 	 */
-	public function __construct($search, $key, $encoding = 'UTF-8', \OC\Log $log = null) {
+	public function __construct($search, $key, \OC\Log $log = null, $encoding = 'UTF-8') {
 		$this->encoding = $encoding;
 		$this->key = $key;
-		$this->log = is_null($log) ? new \OC\Log() : $log;
+		$this->log = $log;
 		$this->search = mb_strtolower($search, $this->encoding);
 	}
 
@@ -35,8 +35,10 @@ class SearchResultSorter {
 	 */
 	public function sort($a, $b) {
 		if(!isset($a[$this->key]) || !isset($b[$this->key])) {
-			$this->log->error('Sharing dialogue: cannot sort due to missing array key',
-							  array('app' => 'core'));
+			if(!is_null($this->log)) {
+				$this->log->error('Sharing dialogue: cannot sort due to ' .
+								  'missing array key', array('app' => 'core'));
+			}
 			return 0;
 		}
 		$nameA = mb_strtolower($a[$this->key], $this->encoding);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list