From 59bdba9bac531fb18b7026649e118ea4e3944e07 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 26 Jul 2013 15:43:10 +0200 Subject: [PATCH 1/3] fix scanner hooks, cant use inside closures in php 5.3 --- lib/files/utils/scanner.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/files/utils/scanner.php b/lib/files/utils/scanner.php index 800bb64993..da0cbd75f6 100644 --- a/lib/files/utils/scanner.php +++ b/lib/files/utils/scanner.php @@ -10,6 +10,7 @@ namespace OC\Files\Utils; use OC\Hooks\BasicEmitter; use OC\Files\Filesystem; +use OC\Hooks\PublicEmitter; /** * Class Scanner @@ -20,7 +21,7 @@ use OC\Files\Filesystem; * * @package OC\Files\Utils */ -class Scanner extends BasicEmitter { +class Scanner extends PublicEmitter { /** * @var string $user */ @@ -60,11 +61,12 @@ class Scanner extends BasicEmitter { */ protected function attachListener($mount) { $scanner = $mount->getStorage()->getScanner(); - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount) { - $this->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); + $emitter = $this; + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, &$emitter) { + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); }); - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount) { - $this->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, &$emitter) { + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); }); } From 64774f30baad3165800aa27ebcd660903f7fa3e7 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 29 Jul 2013 17:03:57 +0200 Subject: [PATCH 2/3] dont need to explicitly pass by reference --- lib/files/utils/scanner.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/files/utils/scanner.php b/lib/files/utils/scanner.php index da0cbd75f6..7e1bc80bbc 100644 --- a/lib/files/utils/scanner.php +++ b/lib/files/utils/scanner.php @@ -62,10 +62,10 @@ class Scanner extends PublicEmitter { protected function attachListener($mount) { $scanner = $mount->getStorage()->getScanner(); $emitter = $this; - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, &$emitter) { + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, $emitter) { $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); }); - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, &$emitter) { + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) { $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); }); } From dea3472ad77a5ba1941a8d3a636f0cf17257734a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 29 Jul 2013 17:04:28 +0200 Subject: [PATCH 3/3] remove unneeded 'use' --- lib/files/utils/scanner.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/files/utils/scanner.php b/lib/files/utils/scanner.php index 7e1bc80bbc..f0dc41ffad 100644 --- a/lib/files/utils/scanner.php +++ b/lib/files/utils/scanner.php @@ -8,7 +8,6 @@ namespace OC\Files\Utils; -use OC\Hooks\BasicEmitter; use OC\Files\Filesystem; use OC\Hooks\PublicEmitter;