当前位置: 首页>>代码示例>>PHP>>正文


PHP App\IAppManager类代码示例

本文整理汇总了PHP中OCP\App\IAppManager的典型用法代码示例。如果您正苦于以下问题:PHP IAppManager类的具体用法?PHP IAppManager怎么用?PHP IAppManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IAppManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __destruct

 public function __destruct()
 {
     $this->config->setSystemValue('singleuser', $this->wasSingleUserModeEnabled);
     if ($this->wasTrashbinEnabled) {
         $this->appManager->enableApp('files_trashbin');
     }
 }
开发者ID:unrealbato,项目名称:core,代码行数:7,代码来源:encryptall.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') {
         $shippedFilter = $input->getOption('shipped') === 'true';
     } else {
         $shippedFilter = null;
     }
     $apps = \OC_App::getAllApps();
     $enabledApps = $disabledApps = [];
     $versions = \OC_App::getAppVersions();
     //sort enabled apps above disabled apps
     foreach ($apps as $app) {
         if ($shippedFilter !== null && \OC_App::isShipped($app) !== $shippedFilter) {
             continue;
         }
         if ($this->manager->isInstalled($app)) {
             $enabledApps[] = $app;
         } else {
             $disabledApps[] = $app;
         }
     }
     $apps = ['enabled' => [], 'disabled' => []];
     sort($enabledApps);
     foreach ($enabledApps as $app) {
         $apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
     }
     sort($disabledApps);
     foreach ($disabledApps as $app) {
         $apps['disabled'][$app] = null;
     }
     $this->writeAppList($input, $output, $apps);
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:32,代码来源:listapps.php

示例3: resetSingleUserAndTrashbin

 /**
  * Reset the single user mode and re-enable the trashbin app
  */
 protected function resetSingleUserAndTrashbin()
 {
     $this->config->setSystemValue('singleuser', $this->wasSingleUserModeEnabled);
     if ($this->wasTrashbinEnabled) {
         $this->appManager->enableApp('files_trashbin');
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:10,代码来源:EncryptAll.php

示例4: isCertificateImportAllowed

 /**
  * check if certificate import is allowed
  *
  * @return bool
  */
 protected function isCertificateImportAllowed()
 {
     $externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
     if ($externalStorageEnabled) {
         $backends = \OC_Mount_Config::getPersonalBackends();
         if (!empty($backends)) {
             return true;
         }
     }
     return false;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:16,代码来源:certificatecontroller.php

示例5: isSharingEnabled

 /**
  * Check whether sharing is enabled
  * @return bool
  */
 private function isSharingEnabled()
 {
     // FIXME: This check is done here since the route is globally defined and not inside the files_sharing app
     // Check whether the sharing application is enabled
     if (!$this->appManager->isEnabledForUser($this->appName)) {
         return false;
     }
     // Check whether public sharing is enabled
     if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
         return false;
     }
     return true;
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:17,代码来源:sharingcheckmiddleware.php

示例6: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $appId = $input->getArgument('app-id');
     if ($this->manager->isInstalled($appId)) {
         try {
             $this->manager->disableApp($appId);
             $output->writeln($appId . ' disabled');
         } catch (\Exception $e) {
             $output->writeln($e->getMessage());
             return 2;
         }
     } else {
         $output->writeln('No such app enabled: ' . $appId);
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:15,代码来源:disable.php

示例7: buildProviderList

 /**
  * @return \OCP\AppFramework\Http\JSONResponse
  */
 public function buildProviderList()
 {
     $services = ['version' => 2, 'PRIVATE_DATA' => ['version' => 1, 'endpoints' => ['store' => '/ocs/v2.php/privatedata/setattribute', 'read' => '/ocs/v2.php/privatedata/getattribute', 'delete' => '/ocs/v2.php/privatedata/deleteattribute']]];
     if ($this->appManager->isEnabledForUser('files_sharing')) {
         $services['SHARING'] = ['version' => 1, 'endpoints' => ['share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares']];
         $services['FEDERATED_SHARING'] = ['version' => 1, 'endpoints' => ['share' => '/ocs/v2.php/cloud/shares', 'webdav' => '/public.php/webdav/']];
     }
     if ($this->appManager->isEnabledForUser('activity')) {
         $services['ACTIVITY'] = ['version' => 1, 'endpoints' => ['list' => '/ocs/v2.php/cloud/activity']];
     }
     if ($this->appManager->isEnabledForUser('provisioning_api')) {
         $services['PROVISIONING'] = ['version' => 1, 'endpoints' => ['user' => '/ocs/v2.php/cloud/users', 'groups' => '/ocs/v2.php/cloud/groups', 'apps' => '/ocs/v2.php/cloud/apps']];
     }
     return new \OCP\AppFramework\Http\JSONResponse($services);
 }
开发者ID:evanjt,项目名称:core,代码行数:18,代码来源:provider.php

示例8: index

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  *
  * Shows the albums and pictures at the root folder or a message if
  * there are no pictures.
  *
  * This is the entry page for logged-in users accessing the app from
  * within ownCloud.
  * A TemplateResponse response uses a template from the templates folder
  * and parameters provided here to build the page users will see
  *
  * @return TemplateResponse
  */
 public function index()
 {
     $appName = $this->appName;
     if ($this->appManager->isInstalled('gallery')) {
         $message = 'You need to disable the Pictures app before being able to use the Gallery+ app';
         return $this->htmlError($this->urlGenerator, $appName, new \Exception($message));
     } else {
         // Parameters sent to the template
         $params = ['appName' => $appName];
         // Will render the page using the template found in templates/index.php
         $response = new TemplateResponse($appName, 'index', $params);
         $this->addContentSecurityToResponse($response);
         return $response;
     }
 }
开发者ID:patman15,项目名称:galleryplus,代码行数:29,代码来源:pagecontroller.php

示例9: showFile

 /**
  * Redirects to the file list and highlight the given file id
  *
  * @param string $fileId file id to show
  * @return RedirectResponse redirect response or not found response
  * @throws \OCP\Files\NotFoundException
  *
  * @NoCSRFRequired
  * @NoAdminRequired
  */
 public function showFile($fileId)
 {
     $uid = $this->userSession->getUser()->getUID();
     $baseFolder = $this->rootFolder->get($uid . '/files/');
     $files = $baseFolder->getById($fileId);
     $params = [];
     if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
         $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
         $files = $baseFolder->getById($fileId);
         $params['view'] = 'trashbin';
     }
     if (!empty($files)) {
         $file = current($files);
         if ($file instanceof Folder) {
             // set the full path to enter the folder
             $params['dir'] = $baseFolder->getRelativePath($file->getPath());
         } else {
             // set parent path as dir
             $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
             // and scroll to the entry
             $params['scrollto'] = $file->getName();
         }
         return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
     }
     throw new \OCP\Files\NotFoundException();
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:36,代码来源:ViewController.php

示例10: mapperEvent

 /**
  * @param MapperEvent $event
  */
 public function mapperEvent(MapperEvent $event)
 {
     $tagIds = $event->getTags();
     if ($event->getObjectType() !== 'files' || empty($tagIds) || !in_array($event->getEvent(), [MapperEvent::EVENT_ASSIGN, MapperEvent::EVENT_UNASSIGN]) || !$this->appManager->isInstalled('activity')) {
         // System tags not for files, no tags, not (un-)assigning or no activity-app enabled (save the energy)
         return;
     }
     try {
         $tags = $this->tagManager->getTagsByIds($tagIds);
     } catch (TagNotFoundException $e) {
         // User assigned/unassigned a non-existing tag, ignore...
         return;
     }
     if (empty($tags)) {
         return;
     }
     // Get all mount point owners
     $cache = $this->mountCollection->getMountCache();
     $mounts = $cache->getMountsForFileId($event->getObjectId());
     if (empty($mounts)) {
         return;
     }
     $users = [];
     foreach ($mounts as $mount) {
         $owner = $mount->getUser()->getUID();
         $ownerFolder = $this->rootFolder->getUserFolder($owner);
         $nodes = $ownerFolder->getById($event->getObjectId());
         if (!empty($nodes)) {
             /** @var Node $node */
             $node = array_shift($nodes);
             $path = $node->getPath();
             if (strpos($path, '/' . $owner . '/files/') === 0) {
                 $path = substr($path, strlen('/' . $owner . '/files'));
             }
             // Get all users that have access to the mount point
             $users = array_merge($users, Share::getUsersSharingFile($path, $owner, true, true));
         }
     }
     $actor = $this->session->getUser();
     if ($actor instanceof IUser) {
         $actor = $actor->getUID();
     } else {
         $actor = '';
     }
     $activity = $this->activityManager->generateEvent();
     $activity->setApp(Extension::APP_NAME)->setType(Extension::APP_NAME)->setAuthor($actor)->setObject($event->getObjectType(), $event->getObjectId());
     foreach ($users as $user => $path) {
         $activity->setAffectedUser($user);
         foreach ($tags as $tag) {
             if ($event->getEvent() === MapperEvent::EVENT_ASSIGN) {
                 $activity->setSubject(Extension::ASSIGN_TAG, [$actor, $path, $this->prepareTagAsParameter($tag)]);
             } else {
                 if ($event->getEvent() === MapperEvent::EVENT_UNASSIGN) {
                     $activity->setSubject(Extension::UNASSIGN_TAG, [$actor, $path, $this->prepareTagAsParameter($tag)]);
                 }
             }
             $this->activityManager->publish($activity);
         }
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:63,代码来源:listener.php

示例11: isSharingEnabled

 /**
  * Check whether sharing is enabled
  * @return bool
  */
 private function isSharingEnabled()
 {
     // FIXME: This check is done here since the route is globally defined and not inside the files_sharing app
     // Check whether the sharing application is enabled
     if (!$this->appManager->isEnabledForUser($this->appName)) {
         return false;
     }
     return true;
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:13,代码来源:sharingcheckmiddleware.php

示例12: testChangeExperimentalConfigStateFalse

	public function testChangeExperimentalConfigStateFalse() {
		$this->config
			->expects($this->once())
			->method('setSystemValue')
			->with('appstore.experimental.enabled', false);
		$this->appManager
			->expects($this->once())
			->method('clearAppsCache');
		$this->assertEquals(new DataResponse(), $this->appSettingsController->changeExperimentalConfigState(false));
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:10,代码来源:AppSettingsControllerTest.php

示例13: testCheckAppUpdates

 /**
  * @dataProvider dataCheckAppUpdates
  *
  * @param string[] $apps
  * @param array $isUpdateAvailable
  * @param array $notifications
  */
 public function testCheckAppUpdates(array $apps, array $isUpdateAvailable, array $notifications)
 {
     $job = $this->getJob(['isUpdateAvailable', 'createNotifications']);
     $this->appManager->expects($this->once())->method('getInstalledApps')->willReturn($apps);
     $job->expects($this->exactly(sizeof($apps)))->method('isUpdateAvailable')->willReturnMap($isUpdateAvailable);
     $this->urlGenerator->expects($this->exactly(sizeof($notifications)))->method('linkToRouteAbsolute')->with('settings.AppSettings.viewApps')->willReturn('apps-url');
     $mockedMethod = $job->expects($this->exactly(sizeof($notifications)))->method('createNotifications');
     call_user_func_array([$mockedMethod, 'withConsecutive'], $notifications);
     $this->invokePrivate($job, 'checkAppUpdates');
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:17,代码来源:BackgroundJobTest.php

示例14: commentEvent

 /**
  * @param CommentsEvent $event
  */
 public function commentEvent(CommentsEvent $event)
 {
     if ($event->getComment()->getObjectType() !== 'files' || !in_array($event->getEvent(), [CommentsEvent::EVENT_ADD]) || !$this->appManager->isInstalled('activity')) {
         // Comment not for file, not adding a comment or no activity-app enabled (save the energy)
         return;
     }
     // Get all mount point owners
     $cache = $this->mountCollection->getMountCache();
     $mounts = $cache->getMountsForFileId($event->getComment()->getObjectId());
     if (empty($mounts)) {
         return;
     }
     $users = [];
     foreach ($mounts as $mount) {
         $owner = $mount->getUser()->getUID();
         $ownerFolder = $this->rootFolder->getUserFolder($owner);
         $nodes = $ownerFolder->getById($event->getComment()->getObjectId());
         if (!empty($nodes)) {
             /** @var Node $node */
             $node = array_shift($nodes);
             $path = $node->getPath();
             if (strpos($path, '/' . $owner . '/files/') === 0) {
                 $path = substr($path, strlen('/' . $owner . '/files'));
             }
             // Get all users that have access to the mount point
             $users = array_merge($users, Share::getUsersSharingFile($path, $owner, true, true));
         }
     }
     $actor = $this->session->getUser();
     if ($actor instanceof IUser) {
         $actor = $actor->getUID();
     } else {
         $actor = '';
     }
     $activity = $this->activityManager->generateEvent();
     $activity->setApp(Extension::APP_NAME)->setType(Extension::APP_NAME)->setAuthor($actor)->setObject($event->getComment()->getObjectType(), $event->getComment()->getObjectId())->setMessage(Extension::ADD_COMMENT_MESSAGE, [$event->getComment()->getId()]);
     foreach ($users as $user => $path) {
         $activity->setAffectedUser($user);
         $activity->setSubject(Extension::ADD_COMMENT_SUBJECT, [$actor, $path]);
         $this->activityManager->publish($activity);
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:45,代码来源:Listener.php

示例15: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $appId = $input->getArgument('app-id');
     if (!\OC_App::getAppPath($appId)) {
         $output->writeln($appId . ' not found');
         return 1;
     }
     $groups = $input->getOption('groups');
     if ($this->manager->isInstalled($appId) && empty($groups)) {
         $output->writeln($appId . ' is already enabled');
     }
     if (empty($groups)) {
         \OC_App::enable($appId);
         $output->writeln($appId . ' enabled');
     } else {
         \OC_App::enable($appId, $groups);
         $output->writeln($appId . ' enabled for groups: ' . implode(', ', $groups));
     }
     return 0;
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:20,代码来源:enable.php


注:本文中的OCP\App\IAppManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。