]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/api/controllers/Info.php
Merge pull request #2 from shaarli/master
[github/shaarli/Shaarli.git] / application / api / controllers / Info.php
index 25433f720cf972b7ac370e05a2c67835443d7194..ae7db93e5c07bbbcf1d691884fc67d8f1c6710b0 100644 (file)
@@ -2,12 +2,13 @@
 
 namespace Shaarli\Api\Controllers;
 
+use Shaarli\Bookmark\BookmarkFilter;
 use Slim\Http\Request;
 use Slim\Http\Response;
 
 /**
  * Class Info
- * 
+ *
  * REST API Controller: /info
  *
  * @package Api\Controllers
@@ -17,7 +18,7 @@ class Info extends ApiController
 {
     /**
      * Service providing various information about Shaarli instance.
-     * 
+     *
      * @param Request  $request  Slim request.
      * @param Response $response Slim response.
      *
@@ -26,15 +27,15 @@ class Info extends ApiController
     public function getInfo($request, $response)
     {
         $info = [
-            'global_counter' => count($this->linkDb),
-            'private_counter' => count_private($this->linkDb),
-            'settings' => array(
+            'global_counter' => $this->bookmarkService->count(),
+            'private_counter' => $this->bookmarkService->count(BookmarkFilter::$PRIVATE),
+            'settings' => [
                 'title' => $this->conf->get('general.title', 'Shaarli'),
                 'header_link' => $this->conf->get('general.header_link', '?'),
                 'timezone' => $this->conf->get('general.timezone', 'UTC'),
                 'enabled_plugins' => $this->conf->get('general.enabled_plugins', []),
                 'default_private_links' => $this->conf->get('privacy.default_private_links', false),
-            ),
+            ],
         ];
 
         return $response->withJson($info, 200, $this->jsonStyle);