aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-10-24 17:28:48 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-10-28 08:44:05 +0200
commite7ec4601a36c28ad2940c66b4baeadac5cc7863e (patch)
tree35764a0009a52fb239931c0157e8850695325fab /lib
parentf8352fcb8dfb5284520396bdc624b6bf62d18219 (diff)
downloadnextcloud-server-e7ec4601a36c28ad2940c66b4baeadac5cc7863e.tar.gz
nextcloud-server-e7ec4601a36c28ad2940c66b4baeadac5cc7863e.zip
Use callForSeenUsers for avatar migration
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Repair/NC11/MoveAvatarBackgroundJob.php46
1 files changed, 22 insertions, 24 deletions
diff --git a/lib/private/Repair/NC11/MoveAvatarBackgroundJob.php b/lib/private/Repair/NC11/MoveAvatarBackgroundJob.php
index 993235146c9..f8c0d9b3abf 100644
--- a/lib/private/Repair/NC11/MoveAvatarBackgroundJob.php
+++ b/lib/private/Repair/NC11/MoveAvatarBackgroundJob.php
@@ -64,35 +64,33 @@ class MoveAvatarsBackgroundJob extends QueuedJob {
private function moveAvatars() {
$counter = 0;
- $this->userManager->callForAllUsers(function (IUser $user) use ($counter) {
- if ($user->getLastLogin() !== 0) {
- $uid = $user->getUID();
+ $this->userManager->callForSeenUsers(function (IUser $user) use ($counter) {
+ $uid = $user->getUID();
- \OC\Files\Filesystem::initMountPoints($uid);
- /** @var Folder $userFolder */
- $userFolder = $this->rootFolder->get($uid);
+ \OC\Files\Filesystem::initMountPoints($uid);
+ /** @var Folder $userFolder */
+ $userFolder = $this->rootFolder->get($uid);
- try {
- $userData = $this->appData->getFolder($uid);
- } catch (NotFoundException $e) {
- $userData = $this->appData->newFolder($uid);
- }
+ try {
+ $userData = $this->appData->getFolder($uid);
+ } catch (NotFoundException $e) {
+ $userData = $this->appData->newFolder($uid);
+ }
- $regex = '/^avatar\.([0-9]+\.)?(jpg|png)$/';
- $avatars = $userFolder->getDirectoryListing();
+ $regex = '/^avatar\.([0-9]+\.)?(jpg|png)$/';
+ $avatars = $userFolder->getDirectoryListing();
- foreach ($avatars as $avatar) {
- /** @var File $avatar */
- if (preg_match($regex, $avatar->getName())) {
- /*
- * This is not the most effective but it is the most abstract way
- * to handle this. Avatars should be small anyways.
- */
- $newAvatar = $userData->newFile($avatar->getName());
- $newAvatar->putContent($avatar->getContent());
- $avatar->delete();
- }
+ foreach ($avatars as $avatar) {
+ /** @var File $avatar */
+ if (preg_match($regex, $avatar->getName())) {
+ /*
+ * This is not the most effective but it is the most abstract way
+ * to handle this. Avatars should be small anyways.
+ */
+ $newAvatar = $userData->newFile($avatar->getName());
+ $newAvatar->putContent($avatar->getContent());
+ $avatar->delete();
}
}
$counter++;