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


PHP IUserManager::callForAllUsers方法代码示例

本文整理汇总了PHP中OCP\IUserManager::callForAllUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP IUserManager::callForAllUsers方法的具体用法?PHP IUserManager::callForAllUsers怎么用?PHP IUserManager::callForAllUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\IUserManager的用法示例。


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

示例1: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $principalBackend = new Principal($this->config, $this->userManager);
     $this->backend = new CardDavBackend($this->dbConnection, $principalBackend);
     // ensure system addressbook exists
     $systemAddressBook = $this->ensureSystemAddressBookExists();
     $converter = new Converter();
     $output->writeln('Syncing users ...');
     $progress = new ProgressBar($output);
     $progress->start();
     $this->userManager->callForAllUsers(function ($user) use($systemAddressBook, $converter, $progress) {
         /** @var IUser $user */
         $name = $user->getBackendClassName();
         $userId = $user->getUID();
         $cardId = "{$name}:{$userId}.vcf";
         $card = $this->backend->getCard($systemAddressBook['id'], $cardId);
         if ($card === false) {
             $vCard = $converter->createCardFromUser($user);
             $this->backend->createCard($systemAddressBook['id'], $cardId, $vCard->serialize());
         } else {
             $vCard = Reader::read($card['carddata']);
             if ($converter->updateCard($vCard, $user)) {
                 $this->backend->updateCard($systemAddressBook['id'], $cardId, $vCard->serialize());
             }
         }
         $progress->advance();
     });
     $progress->finish();
     $output->writeln('');
 }
开发者ID:evanjt,项目名称:core,代码行数:34,代码来源:syncsystemaddressbook.php

示例2: run

 /**
  * @inheritdoc
  */
 public function run(IOutput $output)
 {
     $output->startProgress();
     $this->userManager->callForAllUsers(function ($user) use($output) {
         /** @var IUser $user */
         $output->advance(1, $user->getDisplayName());
         $this->birthdayService->syncUser($user->getUID());
     });
     $output->finishProgress();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:13,代码来源:GenerateBirthdays.php

示例3: run

 protected function run($argument)
 {
     $maxAge = $this->expiration->getMaxAgeAsTimestamp();
     if (!$maxAge) {
         return;
     }
     $this->userManager->callForAllUsers(function (IUser $user) {
         $uid = $user->getUID();
         if (!$this->setupFS($uid)) {
             return;
         }
         Storage::expireOlderThanMaxForUser($uid);
     });
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:14,代码来源:expireversions.php

示例4: run

 /**
  * @param $argument
  * @throws \Exception
  */
 protected function run($argument)
 {
     $maxAge = $this->expiration->getMaxAgeAsTimestamp();
     if (!$maxAge) {
         return;
     }
     $this->userManager->callForAllUsers(function (IUser $user) {
         $uid = $user->getUID();
         if (!$this->setupFS($uid)) {
             return;
         }
         $dirContent = Helper::getTrashFiles('/', $uid, 'mtime');
         Trashbin::deleteExpiredFiles($dirContent, $uid);
     });
     \OC_Util::tearDownFS();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:20,代码来源:ExpireTrash.php

示例5: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $user = $input->getArgument('user');
     if (!is_null($user)) {
         if (!$this->userManager->userExists($user)) {
             throw new \InvalidArgumentException("User <{$user}> in unknown.");
         }
         $output->writeln("Start birthday calendar sync for {$user}");
         $this->birthdayService->syncUser($user);
         return;
     }
     $output->writeln("Start birthday calendar sync for all users ...");
     $p = new ProgressBar($output);
     $p->start();
     $this->userManager->callForAllUsers(function ($user) use($p) {
         $p->advance();
         /** @var IUser $user */
         $this->birthdayService->syncUser($user->getUID());
     });
     $p->finish();
     $output->writeln('');
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:26,代码来源:SyncBirthdayCalendar.php

示例6: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->service->setup();
     if ($input->hasArgument('user')) {
         $user = $input->getArgument('user');
         if (!$this->userManager->userExists($user)) {
             throw new \InvalidArgumentException("User <{$user}> in unknown.");
         }
         $output->writeln("Start migration for {$user}");
         $this->service->migrateForUser($user);
         return;
     }
     $output->writeln("Start migration of all known users ...");
     $p = new ProgressBar($output);
     $p->start();
     $this->userManager->callForAllUsers(function ($user) use($p) {
         $p->advance();
         /** @var IUser $user */
         $this->service->migrateForUser($user->getUID());
     });
     $p->finish();
     $output->writeln('');
 }
开发者ID:gvde,项目名称:core,代码行数:23,代码来源:migratecalendars.php

示例7: removeRootShares

 /**
  * @param IOutput $output
  */
 private function removeRootShares(IOutput $output)
 {
     $function = function (IUser $user) use($output) {
         $userFolder = $this->rootFolder->getUserFolder($user->getUID());
         $fileId = $userFolder->getId();
         $qb = $this->connection->getQueryBuilder();
         $qb->delete('share')->where($qb->expr()->eq('file_source', $qb->createNamedParameter($fileId)))->andWhere($qb->expr()->orX($qb->expr()->eq('item_type', $qb->expr()->literal('file')), $qb->expr()->eq('item_type', $qb->expr()->literal('folder'))));
         $qb->execute();
         $output->advance();
     };
     $userCount = $this->countUsers();
     $output->startProgress($userCount);
     $this->userManager->callForAllUsers($function);
     $output->finishProgress();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:18,代码来源:RemoveRootShares.php

示例8: run

 public function run(IOutput $output)
 {
     $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
     if (version_compare($ocVersionFromBeforeUpdate, '9.2.0.1', '<')) {
         // this situation was only possible between 9.0.0 and 9.0.3 included
         $function = function (IUser $user) use($output) {
             $this->fixUnmergedShares($output, $user);
             $output->advance();
         };
         $this->buildPreparedQueries();
         $userCount = $this->countUsers();
         $output->startProgress($userCount);
         $this->userManager->callForAllUsers($function);
         $output->finishProgress();
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:16,代码来源:RepairUnmergedShares.php

示例9: syncInstance

 public function syncInstance(\Closure $progressCallback)
 {
     $systemAddressBook = $this->getLocalSystemAddressBook();
     $this->userManager->callForAllUsers(function ($user) use($systemAddressBook, $progressCallback) {
         $this->updateUser($user);
         $progressCallback();
     });
     // remove no longer existing
     $allCards = $this->backend->getCards($systemAddressBook['id']);
     foreach ($allCards as $card) {
         $vCard = Reader::read($card['carddata']);
         $uid = $vCard->UID->getValue();
         // load backend and see if user exists
         if (!$this->userManager->userExists($uid)) {
             $this->deleteUser($card['uri']);
         }
     }
 }
开发者ID:itdonline,项目名称:core,代码行数:18,代码来源:syncservice.php


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