本文整理汇总了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('');
}
示例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();
}
示例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);
});
}
示例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();
}
示例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('');
}
示例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('');
}
示例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();
}
示例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();
}
}
示例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']);
}
}
}