/**
  * Get all available categories
  * @return array
  */
 public function listCategories()
 {
     if (!is_null($this->cache->get('listCategories'))) {
         return $this->cache->get('listCategories');
     }
     $categories = [['id' => 0, 'displayName' => (string) $this->l10n->t('Enabled')], ['id' => 1, 'displayName' => (string) $this->l10n->t('Not enabled')]];
     if ($this->ocsClient->isAppStoreEnabled()) {
         // apps from external repo via OCS
         $ocs = $this->ocsClient->getCategories();
         if ($ocs) {
             foreach ($ocs as $k => $v) {
                 $categories[] = ['id' => $k, 'displayName' => str_replace('ownCloud ', '', $v)];
             }
         }
     }
     $this->cache->set('listCategories', $categories, 3600);
     return $categories;
 }
 /**
  * Get all available categories
  * @return array
  */
 public function listCategories()
 {
     if (!is_null($this->cache->get('listCategories'))) {
         return $this->cache->get('listCategories');
     }
     $categories = [['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string) $this->l10n->t('Enabled')], ['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string) $this->l10n->t('Not enabled')]];
     if ($this->ocsClient->isAppStoreEnabled()) {
         // apps from external repo via OCS
         $ocs = $this->ocsClient->getCategories(\OCP\Util::getVersion());
         if ($ocs) {
             foreach ($ocs as $k => $v) {
                 $name = str_replace('ownCloud ', '', $v);
                 $ident = str_replace(' ', '-', urlencode(strtolower($name)));
                 $categories[] = ['id' => $k, 'ident' => $ident, 'displayName' => $name];
             }
         }
     }
     $this->cache->set('listCategories', $categories, 3600);
     return $categories;
 }
Exemple #3
0
 public function testIsAppStoreEnabledFail()
 {
     $this->config->expects($this->once())->method('getSystemValue')->with('appstoreenabled', true)->will($this->returnValue(false));
     $this->assertFalse($this->ocsClient->isAppStoreEnabled());
 }