Passed
Push — master ( 5ad730...5c1154 )
by John
13:07 queued 13s
created
apps/files_trashbin/lib/Trash/LegacyTrashBackend.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array {
53 53
 		$parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : '';
54 54
 		$isRoot = $parent === null;
55
-		return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
56
-			$originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName();
55
+		return array_map(function(FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
56
+			$originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation().'/'.$file->getName();
57 57
 			if (!$originalLocation) {
58 58
 				$originalLocation = $file->getName();
59 59
 			}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 				$this,
62 62
 				$originalLocation,
63 63
 				$file->getMTime(),
64
-				$parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''),
64
+				$parentTrashPath.'/'.$file->getName().($isRoot ? '.d'.$file->getMtime() : ''),
65 65
 				$file,
66 66
 				$user
67 67
 			);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	public function listTrashFolder(ITrashItem $folder): array {
77 77
 		$user = $folder->getUser();
78 78
 		$entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID());
79
-		return $this->mapTrashItems($entries, $user ,$folder);
79
+		return $this->mapTrashItems($entries, $user, $folder);
80 80
 	}
81 81
 
82 82
 	public function restoreItem(ITrashItem $item) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	public function removeItem(ITrashItem $item) {
87 87
 		$user = $item->getUser();
88 88
 		if ($item->isRootItem()) {
89
-			$path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime()));
89
+			$path = substr($item->getTrashPath(), 0, -strlen('.d'.$item->getDeletedTime()));
90 90
 			Trashbin::delete($path, $user->getUID(), $item->getDeletedTime());
91 91
 		} else {
92 92
 			Trashbin::delete($item->getTrashPath(), $user->getUID(), null);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		if (!$storage instanceof Storage) {
99 99
 			return false;
100 100
 		}
101
-		$normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true);
101
+		$normalized = Filesystem::normalizePath($storage->getMountPoint().'/'.$internalPath, true, false, true);
102 102
 		$view = Filesystem::getView();
103 103
 		if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) {
104 104
 			$this->deletedFiles[$normalized] = $normalized;
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -35,99 +35,99 @@
 block discarded – undo
35 35
 use OCP\IUser;
36 36
 
37 37
 class LegacyTrashBackend implements ITrashBackend {
38
-	/** @var array */
39
-	private $deletedFiles = [];
38
+    /** @var array */
39
+    private $deletedFiles = [];
40 40
 
41
-	/** @var IRootFolder */
42
-	private $rootFolder;
41
+    /** @var IRootFolder */
42
+    private $rootFolder;
43 43
 
44
-	public function __construct(IRootFolder $rootFolder) {
45
-		$this->rootFolder = $rootFolder;
46
-	}
44
+    public function __construct(IRootFolder $rootFolder) {
45
+        $this->rootFolder = $rootFolder;
46
+    }
47 47
 
48
-	/**
49
-	 * @param array $items
50
-	 * @param IUser $user
51
-	 * @param ITrashItem $parent
52
-	 * @return ITrashItem[]
53
-	 */
54
-	private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array {
55
-		$parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : '';
56
-		$isRoot = $parent === null;
57
-		return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
58
-			$originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName();
59
-			if (!$originalLocation) {
60
-				$originalLocation = $file->getName();
61
-			}
62
-			return new TrashItem(
63
-				$this,
64
-				$originalLocation,
65
-				$file->getMTime(),
66
-				$parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''),
67
-				$file,
68
-				$user
69
-			);
70
-		}, $items);
71
-	}
48
+    /**
49
+     * @param array $items
50
+     * @param IUser $user
51
+     * @param ITrashItem $parent
52
+     * @return ITrashItem[]
53
+     */
54
+    private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array {
55
+        $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : '';
56
+        $isRoot = $parent === null;
57
+        return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
58
+            $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName();
59
+            if (!$originalLocation) {
60
+                $originalLocation = $file->getName();
61
+            }
62
+            return new TrashItem(
63
+                $this,
64
+                $originalLocation,
65
+                $file->getMTime(),
66
+                $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''),
67
+                $file,
68
+                $user
69
+            );
70
+        }, $items);
71
+    }
72 72
 
73
-	public function listTrashRoot(IUser $user): array {
74
-		$entries = Helper::getTrashFiles('/', $user->getUID());
75
-		return $this->mapTrashItems($entries, $user);
76
-	}
73
+    public function listTrashRoot(IUser $user): array {
74
+        $entries = Helper::getTrashFiles('/', $user->getUID());
75
+        return $this->mapTrashItems($entries, $user);
76
+    }
77 77
 
78
-	public function listTrashFolder(ITrashItem $folder): array {
79
-		$user = $folder->getUser();
80
-		$entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID());
81
-		return $this->mapTrashItems($entries, $user ,$folder);
82
-	}
78
+    public function listTrashFolder(ITrashItem $folder): array {
79
+        $user = $folder->getUser();
80
+        $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID());
81
+        return $this->mapTrashItems($entries, $user ,$folder);
82
+    }
83 83
 
84
-	public function restoreItem(ITrashItem $item) {
85
-		Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null);
86
-	}
84
+    public function restoreItem(ITrashItem $item) {
85
+        Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null);
86
+    }
87 87
 
88
-	public function removeItem(ITrashItem $item) {
89
-		$user = $item->getUser();
90
-		if ($item->isRootItem()) {
91
-			$path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime()));
92
-			Trashbin::delete($path, $user->getUID(), $item->getDeletedTime());
93
-		} else {
94
-			Trashbin::delete($item->getTrashPath(), $user->getUID(), null);
95
-		}
96
-	}
88
+    public function removeItem(ITrashItem $item) {
89
+        $user = $item->getUser();
90
+        if ($item->isRootItem()) {
91
+            $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime()));
92
+            Trashbin::delete($path, $user->getUID(), $item->getDeletedTime());
93
+        } else {
94
+            Trashbin::delete($item->getTrashPath(), $user->getUID(), null);
95
+        }
96
+    }
97 97
 
98
-	public function moveToTrash(IStorage $storage, string $internalPath): bool {
99
-		if (!$storage instanceof Storage) {
100
-			return false;
101
-		}
102
-		$normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true);
103
-		$view = Filesystem::getView();
104
-		if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) {
105
-			$this->deletedFiles[$normalized] = $normalized;
106
-			if ($filesPath = $view->getRelativePath($normalized)) {
107
-				$filesPath = trim($filesPath, '/');
108
-				$result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath);
109
-			} else {
110
-				$result = false;
111
-			}
112
-			unset($this->deletedFiles[$normalized]);
113
-		} else {
114
-			$result = false;
115
-		}
98
+    public function moveToTrash(IStorage $storage, string $internalPath): bool {
99
+        if (!$storage instanceof Storage) {
100
+            return false;
101
+        }
102
+        $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true);
103
+        $view = Filesystem::getView();
104
+        if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) {
105
+            $this->deletedFiles[$normalized] = $normalized;
106
+            if ($filesPath = $view->getRelativePath($normalized)) {
107
+                $filesPath = trim($filesPath, '/');
108
+                $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath);
109
+            } else {
110
+                $result = false;
111
+            }
112
+            unset($this->deletedFiles[$normalized]);
113
+        } else {
114
+            $result = false;
115
+        }
116 116
 
117
-		return $result;
118
-	}
117
+        return $result;
118
+    }
119 119
 
120
-	public function getTrashNodeById(IUser $user, int $fileId) {
121
-		try {
122
-			$userFolder = $this->rootFolder->getUserFolder($user->getUID());
123
-			$trash = $userFolder->getParent()->get('files_trashbin/files');
124
-			$trashFiles = $trash->getById($fileId);
125
-			if (!$trashFiles) {
126
-				return null;
127
-			}
128
-			return $trashFiles ? array_pop($trashFiles) : null;
129
-		} catch (NotFoundException $e) {
130
-			return null;
131
-		}
132
-	}
120
+    public function getTrashNodeById(IUser $user, int $fileId) {
121
+        try {
122
+            $userFolder = $this->rootFolder->getUserFolder($user->getUID());
123
+            $trash = $userFolder->getParent()->get('files_trashbin/files');
124
+            $trashFiles = $trash->getById($fileId);
125
+            if (!$trashFiles) {
126
+                return null;
127
+            }
128
+            return $trashFiles ? array_pop($trashFiles) : null;
129
+        } catch (NotFoundException $e) {
130
+            return null;
131
+        }
132
+    }
133 133
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Versions/LegacyVersionsBackend.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 		$file2 = array_pop($nodes);
56 56
 		$versions = Storage::getVersions($user->getUID(), $userFolder->getRelativePath($file2->getPath()));
57 57
 
58
-		return array_map(function (array $data) use ($file, $user) {
58
+		return array_map(function(array $data) use ($file, $user) {
59 59
 			return new Version(
60
-				(int)$data['version'],
61
-				(int)$data['version'],
60
+				(int) $data['version'],
61
+				(int) $data['version'],
62 62
 				$data['name'],
63
-				(int)$data['size'],
63
+				(int) $data['size'],
64 64
 				$data['mimetype'],
65 65
 				$data['path'],
66 66
 				$file,
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 	public function createVersion(IUser $user, FileInfo $file) {
74 74
 		$userFolder = $this->rootFolder->getUserFolder($user->getUID());
75 75
 		$relativePath = $userFolder->getRelativePath($file->getPath());
76
-		$userView = new View('/' . $user->getUID());
76
+		$userView = new View('/'.$user->getUID());
77 77
 		// create all parent folders
78 78
 		Storage::createMissingDirectories($relativePath, $userView);
79 79
 
80 80
 		Storage::scheduleExpire($user->getUID(), $relativePath);
81 81
 
82 82
 		// store a new version of a file
83
-		$userView->copy('files/' . $relativePath, 'files_versions/' . $relativePath . '.v' . $file->getMtime());
83
+		$userView->copy('files/'.$relativePath, 'files_versions/'.$relativePath.'.v'.$file->getMtime());
84 84
 		// ensure the file is scanned
85
-		$userView->getFileInfo('files_versions/' . $relativePath . '.v' . $file->getMtime());
85
+		$userView->getFileInfo('files_versions/'.$relativePath.'.v'.$file->getMtime());
86 86
 	}
87 87
 
88 88
 	public function rollback(IVersion $version) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	public function read(IVersion $version) {
105 105
 		$versions = $this->getVersionFolder($version->getUser());
106 106
 		/** @var File $file */
107
-		$file = $versions->get($version->getVersionPath() . '.v' . $version->getRevisionId());
107
+		$file = $versions->get($version->getVersionPath().'.v'.$version->getRevisionId());
108 108
 		return $file->fopen('r');
109 109
 	}
110 110
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		$userFolder = $this->rootFolder->getUserFolder($user->getUID());
113 113
 		$versionFolder = $this->getVersionFolder($user);
114 114
 		/** @var File $file */
115
-		$file = $versionFolder->get($userFolder->getRelativePath($sourceFile->getPath()) . '.v' . $revision);
115
+		$file = $versionFolder->get($userFolder->getRelativePath($sourceFile->getPath()).'.v'.$revision);
116 116
 		return $file;
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -40,90 +40,90 @@
 block discarded – undo
40 40
 use OCP\IUserManager;
41 41
 
42 42
 class LegacyVersionsBackend implements IVersionBackend {
43
-	/** @var IRootFolder */
44
-	private $rootFolder;
45
-	/** @var IUserManager */
46
-	private $userManager;
47
-
48
-	public function __construct(IRootFolder $rootFolder, IUserManager $userManager) {
49
-		$this->rootFolder = $rootFolder;
50
-		$this->userManager = $userManager;
51
-	}
52
-
53
-	public function useBackendForStorage(IStorage $storage): bool {
54
-		return true;
55
-	}
56
-
57
-	public function getVersionsForFile(IUser $user, FileInfo $file): array {
58
-		$storage = $file->getStorage();
59
-		if ($storage->instanceOfStorage(SharedStorage::class)) {
60
-			$owner = $storage->getOwner('');
61
-			$user = $this->userManager->get($owner);
62
-		}
63
-
64
-		$userFolder = $this->rootFolder->getUserFolder($user->getUID());
65
-		$nodes = $userFolder->getById($file->getId());
66
-		$file2 = array_pop($nodes);
67
-		$versions = Storage::getVersions($user->getUID(), $userFolder->getRelativePath($file2->getPath()));
68
-
69
-		return array_map(function (array $data) use ($file, $user) {
70
-			return new Version(
71
-				(int)$data['version'],
72
-				(int)$data['version'],
73
-				$data['name'],
74
-				(int)$data['size'],
75
-				$data['mimetype'],
76
-				$data['path'],
77
-				$file,
78
-				$this,
79
-				$user
80
-			);
81
-		}, $versions);
82
-	}
83
-
84
-	public function createVersion(IUser $user, FileInfo $file) {
85
-		$userFolder = $this->rootFolder->getUserFolder($user->getUID());
86
-		$relativePath = $userFolder->getRelativePath($file->getPath());
87
-		$userView = new View('/' . $user->getUID());
88
-		// create all parent folders
89
-		Storage::createMissingDirectories($relativePath, $userView);
90
-
91
-		Storage::scheduleExpire($user->getUID(), $relativePath);
92
-
93
-		// store a new version of a file
94
-		$userView->copy('files/' . $relativePath, 'files_versions/' . $relativePath . '.v' . $file->getMtime());
95
-		// ensure the file is scanned
96
-		$userView->getFileInfo('files_versions/' . $relativePath . '.v' . $file->getMtime());
97
-	}
98
-
99
-	public function rollback(IVersion $version) {
100
-		return Storage::rollback($version->getVersionPath(), $version->getRevisionId(), $version->getUser());
101
-	}
102
-
103
-	private function getVersionFolder(IUser $user): Folder {
104
-		$userRoot = $this->rootFolder->getUserFolder($user->getUID())
105
-			->getParent();
106
-		try {
107
-			/** @var Folder $folder */
108
-			$folder = $userRoot->get('files_versions');
109
-			return $folder;
110
-		} catch (NotFoundException $e) {
111
-			return $userRoot->newFolder('files_versions');
112
-		}
113
-	}
114
-
115
-	public function read(IVersion $version) {
116
-		$versions = $this->getVersionFolder($version->getUser());
117
-		/** @var File $file */
118
-		$file = $versions->get($version->getVersionPath() . '.v' . $version->getRevisionId());
119
-		return $file->fopen('r');
120
-	}
121
-
122
-	public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File {
123
-		$userFolder = $this->rootFolder->getUserFolder($user->getUID());
124
-		$versionFolder = $this->getVersionFolder($user);
125
-		/** @var File $file */
126
-		$file = $versionFolder->get($userFolder->getRelativePath($sourceFile->getPath()) . '.v' . $revision);
127
-		return $file;
128
-	}
43
+    /** @var IRootFolder */
44
+    private $rootFolder;
45
+    /** @var IUserManager */
46
+    private $userManager;
47
+
48
+    public function __construct(IRootFolder $rootFolder, IUserManager $userManager) {
49
+        $this->rootFolder = $rootFolder;
50
+        $this->userManager = $userManager;
51
+    }
52
+
53
+    public function useBackendForStorage(IStorage $storage): bool {
54
+        return true;
55
+    }
56
+
57
+    public function getVersionsForFile(IUser $user, FileInfo $file): array {
58
+        $storage = $file->getStorage();
59
+        if ($storage->instanceOfStorage(SharedStorage::class)) {
60
+            $owner = $storage->getOwner('');
61
+            $user = $this->userManager->get($owner);
62
+        }
63
+
64
+        $userFolder = $this->rootFolder->getUserFolder($user->getUID());
65
+        $nodes = $userFolder->getById($file->getId());
66
+        $file2 = array_pop($nodes);
67
+        $versions = Storage::getVersions($user->getUID(), $userFolder->getRelativePath($file2->getPath()));
68
+
69
+        return array_map(function (array $data) use ($file, $user) {
70
+            return new Version(
71
+                (int)$data['version'],
72
+                (int)$data['version'],
73
+                $data['name'],
74
+                (int)$data['size'],
75
+                $data['mimetype'],
76
+                $data['path'],
77
+                $file,
78
+                $this,
79
+                $user
80
+            );
81
+        }, $versions);
82
+    }
83
+
84
+    public function createVersion(IUser $user, FileInfo $file) {
85
+        $userFolder = $this->rootFolder->getUserFolder($user->getUID());
86
+        $relativePath = $userFolder->getRelativePath($file->getPath());
87
+        $userView = new View('/' . $user->getUID());
88
+        // create all parent folders
89
+        Storage::createMissingDirectories($relativePath, $userView);
90
+
91
+        Storage::scheduleExpire($user->getUID(), $relativePath);
92
+
93
+        // store a new version of a file
94
+        $userView->copy('files/' . $relativePath, 'files_versions/' . $relativePath . '.v' . $file->getMtime());
95
+        // ensure the file is scanned
96
+        $userView->getFileInfo('files_versions/' . $relativePath . '.v' . $file->getMtime());
97
+    }
98
+
99
+    public function rollback(IVersion $version) {
100
+        return Storage::rollback($version->getVersionPath(), $version->getRevisionId(), $version->getUser());
101
+    }
102
+
103
+    private function getVersionFolder(IUser $user): Folder {
104
+        $userRoot = $this->rootFolder->getUserFolder($user->getUID())
105
+            ->getParent();
106
+        try {
107
+            /** @var Folder $folder */
108
+            $folder = $userRoot->get('files_versions');
109
+            return $folder;
110
+        } catch (NotFoundException $e) {
111
+            return $userRoot->newFolder('files_versions');
112
+        }
113
+    }
114
+
115
+    public function read(IVersion $version) {
116
+        $versions = $this->getVersionFolder($version->getUser());
117
+        /** @var File $file */
118
+        $file = $versions->get($version->getVersionPath() . '.v' . $version->getRevisionId());
119
+        return $file->fopen('r');
120
+    }
121
+
122
+    public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File {
123
+        $userFolder = $this->rootFolder->getUserFolder($user->getUID());
124
+        $versionFolder = $this->getVersionFolder($user);
125
+        /** @var File $file */
126
+        $file = $versionFolder->get($userFolder->getRelativePath($sourceFile->getPath()) . '.v' . $revision);
127
+        return $file;
128
+    }
129 129
 }
Please login to merge, or discard this patch.
apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 
53 53
 	public function setName($name) {
54
-		throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden');
54
+		throw new Forbidden('Renaming '.self::FILENAME.' is forbidden');
55 55
 	}
56 56
 
57 57
 	/**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @throws Forbidden
66 66
 	 */
67 67
 	public function delete() {
68
-		throw new Forbidden(self::FILENAME . ' may not be deleted.');
68
+		throw new Forbidden(self::FILENAME.' may not be deleted.');
69 69
 	}
70 70
 
71 71
 	/**
@@ -86,6 +86,6 @@  discard block
 block discarded – undo
86 86
 	 * @throws Forbidden
87 87
 	 */
88 88
 	public function propPatch(PropPatch $propPatch) {
89
-		throw new Forbidden(self::FILENAME . '\'s properties may not be altered.');
89
+		throw new Forbidden(self::FILENAME.'\'s properties may not be altered.');
90 90
 	}
91 91
 }
Please login to merge, or discard this patch.
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -30,61 +30,61 @@
 block discarded – undo
30 30
 use Sabre\DAV\PropPatch;
31 31
 
32 32
 class AppleProvisioningNode implements INode, IProperties {
33
-	public const FILENAME = 'apple-provisioning.mobileconfig';
33
+    public const FILENAME = 'apple-provisioning.mobileconfig';
34 34
 
35
-	protected $timeFactory;
35
+    protected $timeFactory;
36 36
 
37
-	/**
38
-	 * @param ITimeFactory $timeFactory
39
-	 */
40
-	public function __construct(ITimeFactory $timeFactory) {
41
-		$this->timeFactory = $timeFactory;
42
-	}
37
+    /**
38
+     * @param ITimeFactory $timeFactory
39
+     */
40
+    public function __construct(ITimeFactory $timeFactory) {
41
+        $this->timeFactory = $timeFactory;
42
+    }
43 43
 
44
-	/**
45
-	 * @return string
46
-	 */
47
-	public function getName() {
48
-		return self::FILENAME;
49
-	}
44
+    /**
45
+     * @return string
46
+     */
47
+    public function getName() {
48
+        return self::FILENAME;
49
+    }
50 50
 
51 51
 
52
-	public function setName($name) {
53
-		throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden');
54
-	}
52
+    public function setName($name) {
53
+        throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden');
54
+    }
55 55
 
56
-	/**
57
-	 * @return null
58
-	 */
59
-	public function getLastModified() {
60
-		return null;
61
-	}
56
+    /**
57
+     * @return null
58
+     */
59
+    public function getLastModified() {
60
+        return null;
61
+    }
62 62
 
63
-	/**
64
-	 * @throws Forbidden
65
-	 */
66
-	public function delete() {
67
-		throw new Forbidden(self::FILENAME . ' may not be deleted.');
68
-	}
63
+    /**
64
+     * @throws Forbidden
65
+     */
66
+    public function delete() {
67
+        throw new Forbidden(self::FILENAME . ' may not be deleted.');
68
+    }
69 69
 
70
-	/**
71
-	 * @param array $properties
72
-	 * @return array
73
-	 */
74
-	public function getProperties($properties) {
75
-		$datetime = $this->timeFactory->getDateTime();
70
+    /**
71
+     * @param array $properties
72
+     * @return array
73
+     */
74
+    public function getProperties($properties) {
75
+        $datetime = $this->timeFactory->getDateTime();
76 76
 
77
-		return [
78
-			'{DAV:}getcontentlength' => 42,
79
-			'{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC2822),
80
-		];
81
-	}
77
+        return [
78
+            '{DAV:}getcontentlength' => 42,
79
+            '{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC2822),
80
+        ];
81
+    }
82 82
 
83
-	/**
84
-	 * @param PropPatch $propPatch
85
-	 * @throws Forbidden
86
-	 */
87
-	public function propPatch(PropPatch $propPatch) {
88
-		throw new Forbidden(self::FILENAME . '\'s properties may not be altered.');
89
-	}
83
+    /**
84
+     * @param PropPatch $propPatch
85
+     * @throws Forbidden
86
+     */
87
+    public function propPatch(PropPatch $propPatch) {
88
+        throw new Forbidden(self::FILENAME . '\'s properties may not be altered.');
89
+    }
90 90
 }
Please login to merge, or discard this patch.
themes/example/defaults.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 * @return string short footer
91 91
 	 */
92 92
 	public function getShortFooter() {
93
-		$footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' .
94
-			'<br/>' . $this->getSlogan();
93
+		$footer = '© '.date('Y').' <a href="'.$this->getBaseUrl().'" target="_blank">'.$this->getEntity().'</a>'.
94
+			'<br/>'.$this->getSlogan();
95 95
 
96 96
 		return $footer;
97 97
 	}
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 * @return string long footer
102 102
 	 */
103 103
 	public function getLongFooter() {
104
-		$footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' .
105
-			'<br/>' . $this->getSlogan();
104
+		$footer = '© '.date('Y').' <a href="'.$this->getBaseUrl().'" target="_blank">'.$this->getEntity().'</a>'.
105
+			'<br/>'.$this->getSlogan();
106 106
 
107 107
 		return $footer;
108 108
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @return string documentation link
113 113
 	 */
114 114
 	public function buildDocLinkToKey($key) {
115
-		return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key;
115
+		return $this->getDocBaseUrl().'/server/15/go.php?to='.$key;
116 116
 	}
117 117
 
118 118
 
Please login to merge, or discard this patch.
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -20,108 +20,108 @@
 block discarded – undo
20 20
 
21 21
 class OC_Theme {
22 22
 
23
-	/**
24
-	 * Returns the base URL
25
-	 * @return string URL
26
-	 */
27
-	public function getBaseUrl() {
28
-		return 'https://nextcloud.com';
29
-	}
30
-
31
-	/**
32
-	 * Returns the documentation URL
33
-	 * @return string URL
34
-	 */
35
-	public function getDocBaseUrl() {
36
-		return 'https://docs.nextcloud.com';
37
-	}
38
-
39
-	/**
40
-	 * Returns the title
41
-	 * @return string title
42
-	 */
43
-	public function getTitle() {
44
-		return 'Custom Cloud';
45
-	}
46
-
47
-	/**
48
-	 * Returns the short name of the software
49
-	 * @return string title
50
-	 */
51
-	public function getName() {
52
-		return 'Custom Cloud';
53
-	}
54
-
55
-	/**
56
-	 * Returns the short name of the software containing HTML strings
57
-	 * @return string title
58
-	 */
59
-	public function getHTMLName() {
60
-		return 'Custom Cloud';
61
-	}
62
-
63
-	/**
64
-	 * Returns entity (e.g. company name) - used for footer, copyright
65
-	 * @return string entity name
66
-	 */
67
-	public function getEntity() {
68
-		return 'Custom Cloud Co.';
69
-	}
70
-
71
-	/**
72
-	 * Returns slogan
73
-	 * @return string slogan
74
-	 */
75
-	public function getSlogan() {
76
-		return 'Your custom cloud, personalized for you!';
77
-	}
78
-
79
-	/**
80
-	 * Returns short version of the footer
81
-	 * @return string short footer
82
-	 */
83
-	public function getShortFooter() {
84
-		$footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' .
85
-			'<br/>' . $this->getSlogan();
86
-
87
-		return $footer;
88
-	}
89
-
90
-	/**
91
-	 * Returns long version of the footer
92
-	 * @return string long footer
93
-	 */
94
-	public function getLongFooter() {
95
-		$footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' .
96
-			'<br/>' . $this->getSlogan();
97
-
98
-		return $footer;
99
-	}
100
-
101
-	/**
102
-	 * Generate a documentation link for a given key
103
-	 * @return string documentation link
104
-	 */
105
-	public function buildDocLinkToKey($key) {
106
-		return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key;
107
-	}
108
-
109
-
110
-	/**
111
-	 * Returns mail header color
112
-	 * @return string
113
-	 */
114
-	public function getColorPrimary() {
115
-		return '#745bca';
116
-	}
117
-
118
-	/**
119
-	 * Returns variables to overload defaults from core/css/variables.scss
120
-	 * @return array
121
-	 */
122
-	public function getScssVariables() {
123
-		return [
124
-			'color-primary' => '#745bca'
125
-		];
126
-	}
23
+    /**
24
+     * Returns the base URL
25
+     * @return string URL
26
+     */
27
+    public function getBaseUrl() {
28
+        return 'https://nextcloud.com';
29
+    }
30
+
31
+    /**
32
+     * Returns the documentation URL
33
+     * @return string URL
34
+     */
35
+    public function getDocBaseUrl() {
36
+        return 'https://docs.nextcloud.com';
37
+    }
38
+
39
+    /**
40
+     * Returns the title
41
+     * @return string title
42
+     */
43
+    public function getTitle() {
44
+        return 'Custom Cloud';
45
+    }
46
+
47
+    /**
48
+     * Returns the short name of the software
49
+     * @return string title
50
+     */
51
+    public function getName() {
52
+        return 'Custom Cloud';
53
+    }
54
+
55
+    /**
56
+     * Returns the short name of the software containing HTML strings
57
+     * @return string title
58
+     */
59
+    public function getHTMLName() {
60
+        return 'Custom Cloud';
61
+    }
62
+
63
+    /**
64
+     * Returns entity (e.g. company name) - used for footer, copyright
65
+     * @return string entity name
66
+     */
67
+    public function getEntity() {
68
+        return 'Custom Cloud Co.';
69
+    }
70
+
71
+    /**
72
+     * Returns slogan
73
+     * @return string slogan
74
+     */
75
+    public function getSlogan() {
76
+        return 'Your custom cloud, personalized for you!';
77
+    }
78
+
79
+    /**
80
+     * Returns short version of the footer
81
+     * @return string short footer
82
+     */
83
+    public function getShortFooter() {
84
+        $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' .
85
+            '<br/>' . $this->getSlogan();
86
+
87
+        return $footer;
88
+    }
89
+
90
+    /**
91
+     * Returns long version of the footer
92
+     * @return string long footer
93
+     */
94
+    public function getLongFooter() {
95
+        $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' .
96
+            '<br/>' . $this->getSlogan();
97
+
98
+        return $footer;
99
+    }
100
+
101
+    /**
102
+     * Generate a documentation link for a given key
103
+     * @return string documentation link
104
+     */
105
+    public function buildDocLinkToKey($key) {
106
+        return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key;
107
+    }
108
+
109
+
110
+    /**
111
+     * Returns mail header color
112
+     * @return string
113
+     */
114
+    public function getColorPrimary() {
115
+        return '#745bca';
116
+    }
117
+
118
+    /**
119
+     * Returns variables to overload defaults from core/css/variables.scss
120
+     * @return array
121
+     */
122
+    public function getScssVariables() {
123
+        return [
124
+            'color-primary' => '#745bca'
125
+        ];
126
+    }
127 127
 }
Please login to merge, or discard this patch.
lib/private/AppFramework/Middleware/Security/ReloadExecutionMiddleware.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -35,34 +35,34 @@
 block discarded – undo
35 35
  * a reload but if the session variable is set we properly redirect to the login page.
36 36
  */
37 37
 class ReloadExecutionMiddleware extends Middleware {
38
-	/** @var ISession */
39
-	private $session;
40
-	/** @var IURLGenerator */
41
-	private $urlGenerator;
38
+    /** @var ISession */
39
+    private $session;
40
+    /** @var IURLGenerator */
41
+    private $urlGenerator;
42 42
 
43
-	public function __construct(ISession $session, IURLGenerator $urlGenerator) {
44
-		$this->session = $session;
45
-		$this->urlGenerator = $urlGenerator;
46
-	}
43
+    public function __construct(ISession $session, IURLGenerator $urlGenerator) {
44
+        $this->session = $session;
45
+        $this->urlGenerator = $urlGenerator;
46
+    }
47 47
 
48
-	public function beforeController($controller, $methodName) {
49
-		if ($this->session->exists('clearingExecutionContexts')) {
50
-			throw new ReloadExecutionException();
51
-		}
52
-	}
48
+    public function beforeController($controller, $methodName) {
49
+        if ($this->session->exists('clearingExecutionContexts')) {
50
+            throw new ReloadExecutionException();
51
+        }
52
+    }
53 53
 
54
-	public function afterException($controller, $methodName, \Exception $exception) {
55
-		if ($exception instanceof ReloadExecutionException) {
56
-			$this->session->remove('clearingExecutionContexts');
54
+    public function afterException($controller, $methodName, \Exception $exception) {
55
+        if ($exception instanceof ReloadExecutionException) {
56
+            $this->session->remove('clearingExecutionContexts');
57 57
 
58
-			return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute(
59
-				'core.login.showLoginForm',
60
-				['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers
61
-			));
62
-		}
58
+            return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute(
59
+                'core.login.showLoginForm',
60
+                ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers
61
+            ));
62
+        }
63 63
 
64
-		return parent::afterException($controller, $methodName, $exception);
65
-	}
64
+        return parent::afterException($controller, $methodName, $exception);
65
+    }
66 66
 
67 67
 
68 68
 }
Please login to merge, or discard this patch.
lib/public/Files/SimpleFS/InMemoryFile.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -32,119 +32,119 @@
 block discarded – undo
32 32
  * @since 16.0.0
33 33
  */
34 34
 class InMemoryFile implements ISimpleFile {
35
-	/**
36
-	 * Holds the file name.
37
-	 *
38
-	 * @var string
39
-	 */
40
-	private $name;
41
-
42
-	/**
43
-	 * Holds the file contents.
44
-	 *
45
-	 * @var string
46
-	 */
47
-	private $contents;
48
-
49
-	/**
50
-	 * InMemoryFile constructor.
51
-	 *
52
-	 * @param string $name The file name
53
-	 * @param string $contents The file contents
54
-	 * @since 16.0.0
55
-	 */
56
-	public function __construct(string $name, string $contents) {
57
-		$this->name = $name;
58
-		$this->contents = $contents;
59
-	}
60
-
61
-	/**
62
-	 * @inheritdoc
63
-	 * @since 16.0.0
64
-	 */
65
-	public function getName() {
66
-		return $this->name;
67
-	}
68
-
69
-	/**
70
-	 * @inheritdoc
71
-	 * @since 16.0.0
72
-	 */
73
-	public function getSize() {
74
-		return strlen($this->contents);
75
-	}
76
-
77
-	/**
78
-	 * @inheritdoc
79
-	 * @since 16.0.0
80
-	 */
81
-	public function getETag() {
82
-		return '';
83
-	}
84
-
85
-	/**
86
-	 * @inheritdoc
87
-	 * @since 16.0.0
88
-	 */
89
-	public function getMTime() {
90
-		return time();
91
-	}
92
-
93
-	/**
94
-	 * @inheritdoc
95
-	 * @since 16.0.0
96
-	 */
97
-	public function getContent() {
98
-		return $this->contents;
99
-	}
100
-
101
-	/**
102
-	 * @inheritdoc
103
-	 * @since 16.0.0
104
-	 */
105
-	public function putContent($data) {
106
-		$this->contents = $data;
107
-	}
108
-
109
-	/**
110
-	 * In memory files can't be deleted.
111
-	 *
112
-	 * @since 16.0.0
113
-	 */
114
-	public function delete() {
115
-		// unimplemented for in memory files
116
-	}
117
-
118
-	/**
119
-	 * @inheritdoc
120
-	 * @since 16.0.0
121
-	 */
122
-	public function getMimeType() {
123
-		$fileInfo = new \finfo(FILEINFO_MIME_TYPE);
124
-		return $fileInfo->buffer($this->contents);
125
-	}
126
-
127
-	/**
128
-	 * Stream reading is unsupported for in memory files.
129
-	 *
130
-	 * @throws NotPermittedException
131
-	 * @since 16.0.0
132
-	 */
133
-	public function read() {
134
-		throw new NotPermittedException(
135
-			'Stream reading is unsupported for in memory files'
136
-		);
137
-	}
138
-
139
-	/**
140
-	 * Stream writing isn't available for in memory files.
141
-	 *
142
-	 * @throws NotPermittedException
143
-	 * @since 16.0.0
144
-	 */
145
-	public function write() {
146
-		throw new NotPermittedException(
147
-			'Stream writing is unsupported for in memory files'
148
-		);
149
-	}
35
+    /**
36
+     * Holds the file name.
37
+     *
38
+     * @var string
39
+     */
40
+    private $name;
41
+
42
+    /**
43
+     * Holds the file contents.
44
+     *
45
+     * @var string
46
+     */
47
+    private $contents;
48
+
49
+    /**
50
+     * InMemoryFile constructor.
51
+     *
52
+     * @param string $name The file name
53
+     * @param string $contents The file contents
54
+     * @since 16.0.0
55
+     */
56
+    public function __construct(string $name, string $contents) {
57
+        $this->name = $name;
58
+        $this->contents = $contents;
59
+    }
60
+
61
+    /**
62
+     * @inheritdoc
63
+     * @since 16.0.0
64
+     */
65
+    public function getName() {
66
+        return $this->name;
67
+    }
68
+
69
+    /**
70
+     * @inheritdoc
71
+     * @since 16.0.0
72
+     */
73
+    public function getSize() {
74
+        return strlen($this->contents);
75
+    }
76
+
77
+    /**
78
+     * @inheritdoc
79
+     * @since 16.0.0
80
+     */
81
+    public function getETag() {
82
+        return '';
83
+    }
84
+
85
+    /**
86
+     * @inheritdoc
87
+     * @since 16.0.0
88
+     */
89
+    public function getMTime() {
90
+        return time();
91
+    }
92
+
93
+    /**
94
+     * @inheritdoc
95
+     * @since 16.0.0
96
+     */
97
+    public function getContent() {
98
+        return $this->contents;
99
+    }
100
+
101
+    /**
102
+     * @inheritdoc
103
+     * @since 16.0.0
104
+     */
105
+    public function putContent($data) {
106
+        $this->contents = $data;
107
+    }
108
+
109
+    /**
110
+     * In memory files can't be deleted.
111
+     *
112
+     * @since 16.0.0
113
+     */
114
+    public function delete() {
115
+        // unimplemented for in memory files
116
+    }
117
+
118
+    /**
119
+     * @inheritdoc
120
+     * @since 16.0.0
121
+     */
122
+    public function getMimeType() {
123
+        $fileInfo = new \finfo(FILEINFO_MIME_TYPE);
124
+        return $fileInfo->buffer($this->contents);
125
+    }
126
+
127
+    /**
128
+     * Stream reading is unsupported for in memory files.
129
+     *
130
+     * @throws NotPermittedException
131
+     * @since 16.0.0
132
+     */
133
+    public function read() {
134
+        throw new NotPermittedException(
135
+            'Stream reading is unsupported for in memory files'
136
+        );
137
+    }
138
+
139
+    /**
140
+     * Stream writing isn't available for in memory files.
141
+     *
142
+     * @throws NotPermittedException
143
+     * @since 16.0.0
144
+     */
145
+    public function write() {
146
+        throw new NotPermittedException(
147
+            'Stream writing is unsupported for in memory files'
148
+        );
149
+    }
150 150
 }
Please login to merge, or discard this patch.
lib/public/IAvatarManager.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,24 +34,24 @@
 block discarded – undo
34 34
 
35 35
 interface IAvatarManager {
36 36
 
37
-	/**
38
-	 * return a user specific instance of \OCP\IAvatar
39
-	 * @see IAvatar
40
-	 * @param string $user the ownCloud user id
41
-	 * @return IAvatar
42
-	 * @throws \Exception In case the username is potentially dangerous
43
-	 * @throws \OCP\Files\NotFoundException In case there is no user folder yet
44
-	 * @since 6.0.0
45
-	 */
46
-	public function getAvatar(string $user) : IAvatar;
37
+    /**
38
+     * return a user specific instance of \OCP\IAvatar
39
+     * @see IAvatar
40
+     * @param string $user the ownCloud user id
41
+     * @return IAvatar
42
+     * @throws \Exception In case the username is potentially dangerous
43
+     * @throws \OCP\Files\NotFoundException In case there is no user folder yet
44
+     * @since 6.0.0
45
+     */
46
+    public function getAvatar(string $user) : IAvatar;
47 47
 
48
-	/**
49
-	 * Returns a guest user avatar instance.
50
-	 *
51
-	 * @param string $name The guest name, e.g. "Albert".
52
-	 * @return IAvatar
53
-	 * @since 16.0.0
54
-	 */
55
-	public function getGuestAvatar(string $name): IAvatar;
48
+    /**
49
+     * Returns a guest user avatar instance.
50
+     *
51
+     * @param string $name The guest name, e.g. "Albert".
52
+     * @return IAvatar
53
+     * @since 16.0.0
54
+     */
55
+    public function getGuestAvatar(string $name): IAvatar;
56 56
 
57 57
 }
Please login to merge, or discard this patch.
core/Controller/GuestAvatarController.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -33,75 +33,75 @@
 block discarded – undo
33 33
  */
34 34
 class GuestAvatarController extends Controller {
35 35
 
36
-	/**
37
-	 * @var ILogger
38
-	 */
39
-	private $logger;
36
+    /**
37
+     * @var ILogger
38
+     */
39
+    private $logger;
40 40
 
41
-	/**
42
-	 * @var IAvatarManager
43
-	 */
44
-	private $avatarManager;
41
+    /**
42
+     * @var IAvatarManager
43
+     */
44
+    private $avatarManager;
45 45
 
46
-	/**
47
-	 * GuestAvatarController constructor.
48
-	 *
49
-	 * @param $appName
50
-	 * @param IRequest $request
51
-	 * @param IAvatarManager $avatarManager
52
-	 * @param ILogger $logger
53
-	 */
54
-	public function __construct(
55
-		$appName,
56
-		IRequest $request,
57
-		IAvatarManager $avatarManager,
58
-		ILogger $logger
59
-	) {
60
-		parent::__construct($appName, $request);
61
-		$this->avatarManager = $avatarManager;
62
-		$this->logger = $logger;
63
-	}
46
+    /**
47
+     * GuestAvatarController constructor.
48
+     *
49
+     * @param $appName
50
+     * @param IRequest $request
51
+     * @param IAvatarManager $avatarManager
52
+     * @param ILogger $logger
53
+     */
54
+    public function __construct(
55
+        $appName,
56
+        IRequest $request,
57
+        IAvatarManager $avatarManager,
58
+        ILogger $logger
59
+    ) {
60
+        parent::__construct($appName, $request);
61
+        $this->avatarManager = $avatarManager;
62
+        $this->logger = $logger;
63
+    }
64 64
 
65
-	/**
66
-	 * Returns a guest avatar image response.
67
-	 *
68
-	 * @PublicPage
69
-	 * @NoCSRFRequired
70
-	 *
71
-	 * @param string $guestName The guest name, e.g. "Albert"
72
-	 * @param string $size The desired avatar size, e.g. 64 for 64x64px
73
-	 * @return FileDisplayResponse|Http\Response
74
-	 */
75
-	public function getAvatar($guestName, $size) {
76
-		$size = (int) $size;
65
+    /**
66
+     * Returns a guest avatar image response.
67
+     *
68
+     * @PublicPage
69
+     * @NoCSRFRequired
70
+     *
71
+     * @param string $guestName The guest name, e.g. "Albert"
72
+     * @param string $size The desired avatar size, e.g. 64 for 64x64px
73
+     * @return FileDisplayResponse|Http\Response
74
+     */
75
+    public function getAvatar($guestName, $size) {
76
+        $size = (int) $size;
77 77
 
78
-		// min/max size
79
-		if ($size > 2048) {
80
-			$size = 2048;
81
-		} elseif ($size <= 0) {
82
-			$size = 64;
83
-		}
78
+        // min/max size
79
+        if ($size > 2048) {
80
+            $size = 2048;
81
+        } elseif ($size <= 0) {
82
+            $size = 64;
83
+        }
84 84
 
85
-		try {
86
-			$avatar = $this->avatarManager->getGuestAvatar($guestName);
87
-			$avatarFile = $avatar->getFile($size);
85
+        try {
86
+            $avatar = $this->avatarManager->getGuestAvatar($guestName);
87
+            $avatarFile = $avatar->getFile($size);
88 88
 
89
-			$resp = new FileDisplayResponse(
90
-				$avatarFile,
91
-				$avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED,
92
-				['Content-Type' => $avatarFile->getMimeType()]
93
-			);
94
-		} catch (\Exception $e) {
95
-			$this->logger->error('error while creating guest avatar', [
96
-				'err' => $e,
97
-			]);
98
-			$resp = new Http\Response();
99
-			$resp->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR);
100
-			return $resp;
101
-		}
89
+            $resp = new FileDisplayResponse(
90
+                $avatarFile,
91
+                $avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED,
92
+                ['Content-Type' => $avatarFile->getMimeType()]
93
+            );
94
+        } catch (\Exception $e) {
95
+            $this->logger->error('error while creating guest avatar', [
96
+                'err' => $e,
97
+            ]);
98
+            $resp = new Http\Response();
99
+            $resp->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR);
100
+            return $resp;
101
+        }
102 102
 
103
-		// Cache for 30 minutes
104
-		$resp->cacheFor(1800);
105
-		return $resp;
106
-	}
103
+        // Cache for 30 minutes
104
+        $resp->cacheFor(1800);
105
+        return $resp;
106
+    }
107 107
 }
Please login to merge, or discard this patch.
lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			return;
68 68
 		}
69 69
 
70
-		$folders = array_filter($folders, function (ISimpleFolder $folder) {
70
+		$folders = array_filter($folders, function(ISimpleFolder $folder) {
71 71
 			return $folder->fileExists('photo.');
72 72
 		});
73 73
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			return;
76 76
 		}
77 77
 
78
-		$output->info('Delete ' . count($folders) . ' "photo." files');
78
+		$output->info('Delete '.count($folders).' "photo." files');
79 79
 
80 80
 		foreach ($folders as $folder) {
81 81
 			try {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 				$folder->getFile('photo.')->delete();
84 84
 			} catch (\Exception $e) {
85 85
 				$this->logger->logException($e);
86
-				$output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."');
86
+				$output->warning('Could not delete file "dav-photocache/'.$folder->getName().'/photo."');
87 87
 			}
88 88
 		}
89 89
 	}
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -47,67 +47,67 @@
 block discarded – undo
47 47
  */
48 48
 class CleanupCardDAVPhotoCache implements IRepairStep {
49 49
 
50
-	/** @var IConfig */
51
-	private $config;
52
-
53
-	/** @var IAppData */
54
-	private $appData;
55
-
56
-	/** @var ILogger */
57
-	private $logger;
58
-
59
-	public function __construct(IConfig $config, IAppData $appData, ILogger $logger) {
60
-		$this->config = $config;
61
-		$this->appData = $appData;
62
-		$this->logger = $logger;
63
-	}
64
-
65
-	public function getName(): string {
66
-		return 'Cleanup invalid photocache files for carddav';
67
-	}
68
-
69
-	private function repair(IOutput $output): void {
70
-		try {
71
-			$folders = $this->appData->getDirectoryListing();
72
-		} catch (NotFoundException $e) {
73
-			return;
74
-		} catch (RuntimeException $e) {
75
-			$this->logger->logException($e, ['message' => 'Failed to fetch directory listing in CleanupCardDAVPhotoCache']);
76
-			return;
77
-		}
78
-
79
-		$folders = array_filter($folders, function (ISimpleFolder $folder) {
80
-			return $folder->fileExists('photo.');
81
-		});
82
-
83
-		if (empty($folders)) {
84
-			return;
85
-		}
86
-
87
-		$output->info('Delete ' . count($folders) . ' "photo." files');
88
-
89
-		foreach ($folders as $folder) {
90
-			try {
91
-				/** @var ISimpleFolder $folder */
92
-				$folder->getFile('photo.')->delete();
93
-			} catch (\Exception $e) {
94
-				$this->logger->logException($e);
95
-				$output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."');
96
-			}
97
-		}
98
-	}
99
-
100
-	private function shouldRun(): bool {
101
-		return version_compare(
102
-			$this->config->getSystemValue('version', '0.0.0.0'),
103
-			'16.0.0.0',
104
-			'<='
105
-		);
106
-	}
107
-
108
-	public function run(IOutput $output): void {
109
-		if ($this->shouldRun()) {
110
-			$this->repair($output);
111
-		}
112
-	}
50
+    /** @var IConfig */
51
+    private $config;
52
+
53
+    /** @var IAppData */
54
+    private $appData;
55
+
56
+    /** @var ILogger */
57
+    private $logger;
58
+
59
+    public function __construct(IConfig $config, IAppData $appData, ILogger $logger) {
60
+        $this->config = $config;
61
+        $this->appData = $appData;
62
+        $this->logger = $logger;
63
+    }
64
+
65
+    public function getName(): string {
66
+        return 'Cleanup invalid photocache files for carddav';
67
+    }
68
+
69
+    private function repair(IOutput $output): void {
70
+        try {
71
+            $folders = $this->appData->getDirectoryListing();
72
+        } catch (NotFoundException $e) {
73
+            return;
74
+        } catch (RuntimeException $e) {
75
+            $this->logger->logException($e, ['message' => 'Failed to fetch directory listing in CleanupCardDAVPhotoCache']);
76
+            return;
77
+        }
78
+
79
+        $folders = array_filter($folders, function (ISimpleFolder $folder) {
80
+            return $folder->fileExists('photo.');
81
+        });
82
+
83
+        if (empty($folders)) {
84
+            return;
85
+        }
86
+
87
+        $output->info('Delete ' . count($folders) . ' "photo." files');
88
+
89
+        foreach ($folders as $folder) {
90
+            try {
91
+                /** @var ISimpleFolder $folder */
92
+                $folder->getFile('photo.')->delete();
93
+            } catch (\Exception $e) {
94
+                $this->logger->logException($e);
95
+                $output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."');
96
+            }
97
+        }
98
+    }
99
+
100
+    private function shouldRun(): bool {
101
+        return version_compare(
102
+            $this->config->getSystemValue('version', '0.0.0.0'),
103
+            '16.0.0.0',
104
+            '<='
105
+        );
106
+    }
107
+
108
+    public function run(IOutput $output): void {
109
+        if ($this->shouldRun()) {
110
+            $this->repair($output);
111
+        }
112
+    }
113 113
 }
Please login to merge, or discard this patch.