From 011db924865d1588f0bddfab18136de5aad669ce Mon Sep 17 00:00:00 2001 From: root Date: Fri, 4 Jul 2014 10:51:59 -0400 Subject: [PATCH 1/2] fix TagMgr access remove unwanted error_log --- lib/controller/importcontroller.php | 7 +++---- lib/dispatcher.php | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/controller/importcontroller.php b/lib/controller/importcontroller.php index e08b51cf..a327b76a 100644 --- a/lib/controller/importcontroller.php +++ b/lib/controller/importcontroller.php @@ -25,9 +25,10 @@ use OCA\Contacts\App, */ class ImportController extends Controller { - public function __construct($appName, IRequest $request, App $app, ICache $cache) { + public function __construct($appName, IRequest $request, App $app, ICache $cache, ITags $tags) { parent::__construct($appName, $request, $app); $this->cache = $cache; + $this->tagMgr = $tags; } /** @@ -246,8 +247,7 @@ class ImportController extends Controller { $favourites = $part->select('X-FAVOURITES'); foreach ($favourites as $favourite) { if ($favourite->getValue() == 'yes') { - $tagMgr = $this->server->getTagManager()->load('contact'); - $tagMgr->addToFavorites($id); + $this->tagMgr->addToFavorites($id); } } } else { @@ -321,7 +321,6 @@ class ImportController extends Controller { return $response; } - error_log("progresskey: ".$this->cache->get($progresskey)." total: ".$this->cache->get($progresskey.'_total') ); $response->setParams(array('progress' => $this->cache->get($progresskey), 'total' => $this->cache->get($progresskey.'_total') )); return $response; } diff --git a/lib/dispatcher.php b/lib/dispatcher.php index 573b8e47..df5fd934 100644 --- a/lib/dispatcher.php +++ b/lib/dispatcher.php @@ -104,7 +104,8 @@ class Dispatcher extends MainApp { $this->container->registerService('ImportController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); $cache = $container->getServer()->getCache(); - return new ImportController($appName, $request, $app, $cache); + $tags = $container->getServer()->getTagManager()->load('contact'); + return new ImportController($appName, $request, $app, $cache, $tags); }); $this->container->registerService('ExportController', function(IAppContainer $container) use($app, $appName) { $request = $container->query('Request'); From 31726be13c40442d7407c9da11262137dc46ae2c Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Sun, 17 Aug 2014 19:04:56 +0200 Subject: [PATCH 2/2] Fix indentation --- lib/controller/importcontroller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/controller/importcontroller.php b/lib/controller/importcontroller.php index a327b76a..fa2a77a1 100644 --- a/lib/controller/importcontroller.php +++ b/lib/controller/importcontroller.php @@ -28,7 +28,7 @@ class ImportController extends Controller { public function __construct($appName, IRequest $request, App $app, ICache $cache, ITags $tags) { parent::__construct($appName, $request, $app); $this->cache = $cache; - $this->tagMgr = $tags; + $this->tagMgr = $tags; } /**