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-03-30 23:49:07 +0300
committerOlivier Paroz <github@oparoz.com>2015-03-30 23:49:07 +0300
commitd93a7af741a27b2d52921c2656765ee6209f68b3 (patch)
tree5ccb98abc467d9e003097ed7213c880aab920418 /environment
parent306e0cea86f6689bd864b3d50708810773c02694 (diff)
Controller and Service refactoring
Files and Preview controllers and services App now starts by asking for a list of supported media types Everything related to reading config files has been moved to a separate class Some cleaning up
Diffstat (limited to 'environment')
-rw-r--r--environment/environment.php29
1 files changed, 22 insertions, 7 deletions
diff --git a/environment/environment.php b/environment/environment.php
index 776114da..bc2147eb 100644
--- a/environment/environment.php
+++ b/environment/environment.php
@@ -129,7 +129,7 @@ class Environment {
* Creates the environment for a logged-in user
*
* userId and userFolder are already known, we define fromRootToFolder
- * so that the services can use one method to have access resources
+ * so that the services can use one method to have access to resources
* without having to know whether they're private or public
*/
public function setStandardEnv() {
@@ -139,8 +139,8 @@ class Environment {
/**
* Returns the resource located at the given path
*
- * The path starts from the user's files folder
- * The resource is either a File or a Folder
+ * The path starts from the user's files folder because we'll query that folder to get the
+ * information we need. The resource is either a File or a Folder
*
* @param string $subPath
*
@@ -254,14 +254,27 @@ class Environment {
}
/**
- * Returns fromRootToFolder
+ * Returns the path which goes from the file, up to the root folder of the Gallery:
+ * current_folder/my_file
*
- * @see buildFromRootToFolder
+ * That root folder changes when folders are shared publicly
+ *
+ * @param Node $file
*
* @return string
*/
- public function getFromRootToFolder() {
- return $this->fromRootToFolder;
+ public function getPathFromVirtualRoot($file) {
+ $path = $file->getPath();
+
+ if ($file->getType() === 'dir') {
+ // Needed because fromRootToFolder always ends with a slash
+ $path .= '/';
+ }
+
+ $path = str_replace($this->fromRootToFolder, '', $path);
+ $path = rtrim($path, '/');
+
+ return $path;
}
/**
@@ -291,6 +304,8 @@ class Environment {
* Returns the path from the shared folder to the root folder in the original
* owner's filesystem: /userId/files/parent_folder/shared_folder
*
+ * This cannot be calculated with paths and IDs, the linkitem's file source is required
+ *
* @param string $fileSource
*
* @return string