本文整理匯總了PHP中OCP\App\IAppManager::isInstalled方法的典型用法代碼示例。如果您正苦於以下問題:PHP IAppManager::isInstalled方法的具體用法?PHP IAppManager::isInstalled怎麽用?PHP IAppManager::isInstalled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OCP\App\IAppManager
的用法示例。
在下文中一共展示了IAppManager::isInstalled方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
示例2: 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);
}
}
示例3: 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;
}
}
示例4: 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);
}
}
}
示例5: 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);
}
}
示例6: 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;
}
示例7: testIsInstalledEnabledForGroups
public function testIsInstalledEnabledForGroups()
{
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertTrue($this->manager->isInstalled('test'));
}