diff --git a/lib/controller/importcontroller.php b/lib/controller/importcontroller.php index e08b51cf..fa2a77a1 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');