fix DI
This commit is contained in:
parent
32afdcbefe
commit
af781bdea7
|
@ -355,7 +355,8 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sorter = new \OC\Share\SearchResultSorter($_GET['search'],
|
$sorter = new \OC\Share\SearchResultSorter($_GET['search'],
|
||||||
'label');
|
'label',
|
||||||
|
new \OC\Log());
|
||||||
usort($shareWith, array($sorter, 'sort'));
|
usort($shareWith, array($sorter, 'sort'));
|
||||||
OC_JSON::success(array('data' => $shareWith));
|
OC_JSON::success(array('data' => $shareWith));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ class SearchResultSorter {
|
||||||
* @param $encoding optional, encoding to use, defaults to UTF-8
|
* @param $encoding optional, encoding to use, defaults to UTF-8
|
||||||
* @param $log optional, an \OC\Log instance
|
* @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->encoding = $encoding;
|
||||||
$this->key = $key;
|
$this->key = $key;
|
||||||
$this->log = is_null($log) ? new \OC\Log() : $log;
|
$this->log = $log;
|
||||||
$this->search = mb_strtolower($search, $this->encoding);
|
$this->search = mb_strtolower($search, $this->encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,10 @@ class SearchResultSorter {
|
||||||
*/
|
*/
|
||||||
public function sort($a, $b) {
|
public function sort($a, $b) {
|
||||||
if(!isset($a[$this->key]) || !isset($b[$this->key])) {
|
if(!isset($a[$this->key]) || !isset($b[$this->key])) {
|
||||||
$this->log->error('Sharing dialogue: cannot sort due to missing array key',
|
if(!is_null($this->log)) {
|
||||||
array('app' => 'core'));
|
$this->log->error('Sharing dialogue: cannot sort due to ' .
|
||||||
|
'missing array key', array('app' => 'core'));
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$nameA = mb_strtolower($a[$this->key], $this->encoding);
|
$nameA = mb_strtolower($a[$this->key], $this->encoding);
|
||||||
|
|
Loading…
Reference in New Issue