Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-04-06 00:28:42 +0300
committerOlivier Paroz <github@oparoz.com>2015-04-06 00:28:42 +0300
commit4191190bf334492e8799d11dfda25142748b66bd (patch)
treed7dd9aae2daec4a340fb18a5cb20bfd4258ea2ee /environment
parent675624b423dad6c0a23bde2f4477083b2daca754 (diff)
Several fixes for the album configuration
Diffstat (limited to 'environment')
-rw-r--r--environment/environment.php64
1 files changed, 30 insertions, 34 deletions
diff --git a/environment/environment.php b/environment/environment.php
index bc2147eb..d82cdb2a 100644
--- a/environment/environment.php
+++ b/environment/environment.php
@@ -148,44 +148,12 @@ class Environment {
*/
public function getResourceFromPath($subPath) {
$path = $this->getImagePathFromFolder($subPath);
- $nodeInfo = $this->getNodeInfo($path);
+ $node = $this->getNode($path);
- return $this->getResourceFromId($nodeInfo['fileid']);
+ return $this->getResourceFromId($node->getId());
}
/**
- * Returns the Node based on the current user's files folder and a given
- * path
- *
- * @param string $path
- *
- * @return array<string,int>|false
- *
- * @throws EnvironmentException
- */
- public function getNodeInfo($path) {
- $nodeInfo = false;
- $folder = $this->userFolder;
- if ($folder === null) {
- $this->logAndThrowNotFound("Could not access the user's folder");
- } else {
- try {
- $node = $folder->get($path);
- $nodeInfo = [
- 'fileid' => $node->getId(),
- 'permissions' => $node->getPermissions()
- ];
- } catch (NotFoundException $exception) {
- $message = 'Could not find anything at: ' . $exception->getMessage();
- $this->logAndThrowNotFound($message);
- }
- }
-
- return $nodeInfo;
- }
-
-
- /**
* Returns the userId of the currently logged-in user or the sharer
*
* @return string
@@ -254,6 +222,34 @@ class Environment {
}
/**
+ * Returns the Node based on the current user's files folder and a given
+ * path
+ *
+ * @param string $path
+ *
+ * @return Node|false
+ *
+ * @throws EnvironmentException
+ */
+ public function getNode($path) {
+ $node = false;
+ $folder = $this->userFolder;
+ if ($folder === null) {
+ $this->logAndThrowNotFound("Could not access the user's folder");
+ } else {
+ try {
+ $node = $folder->get($path);
+
+ } catch (NotFoundException $exception) {
+ $message = 'Could not find anything at: ' . $exception->getMessage();
+ $this->logAndThrowNotFound($message);
+ }
+ }
+
+ return $node;
+ }
+
+ /**
* Returns the path which goes from the file, up to the root folder of the Gallery:
* current_folder/my_file
*