summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-07-13 17:38:13 +0200
committerLukas Reschke <lukas@owncloud.com>2015-11-22 16:05:50 +0100
commitfa2be0750c50de45a2fd101eb23fa858c0e0771b (patch)
tree977892b4eeaf9c26e7157575d5c1909e6aa5febd /apps/files/lib
parentf120846e291bf83244831770c5f25b730fa8ba90 (diff)
downloadnextcloud-server-fa2be0750c50de45a2fd101eb23fa858c0e0771b.tar.gz
nextcloud-server-fa2be0750c50de45a2fd101eb23fa858c0e0771b.zip
Make files app use Webdav for most operations
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/app.php88
-rw-r--r--apps/files/lib/helper.php3
2 files changed, 1 insertions, 90 deletions
diff --git a/apps/files/lib/app.php b/apps/files/lib/app.php
index 5bd8c127586..18813e224de 100644
--- a/apps/files/lib/app.php
+++ b/apps/files/lib/app.php
@@ -29,107 +29,21 @@ namespace OCA\Files;
class App {
/**
- * @var \OC_L10N
- */
- private $l10n;
-
- /**
* @var \OCP\INavigationManager
*/
private static $navigationManager;
/**
- * @var \OC\Files\View
- */
- private $view;
-
- public function __construct($view, $l10n) {
- $this->view = $view;
- $this->l10n = $l10n;
- }
-
- /**
* Returns the app's navigation manager
*
* @return \OCP\INavigationManager
*/
public static function getNavigationManager() {
+ // TODO: move this into a service in the Application class
if (self::$navigationManager === null) {
self::$navigationManager = new \OC\NavigationManager();
}
return self::$navigationManager;
}
- /**
- * rename a file
- *
- * @param string $dir
- * @param string $oldname
- * @param string $newname
- * @return array
- */
- public function rename($dir, $oldname, $newname) {
- $result = array(
- 'success' => false,
- 'data' => NULL
- );
-
- try {
- // check if the new name is conform to file name restrictions
- $this->view->verifyPath($dir, $newname);
- } catch (\OCP\Files\InvalidPathException $ex) {
- $result['data'] = array(
- 'message' => $this->l10n->t($ex->getMessage()),
- 'code' => 'invalidname',
- );
- return $result;
- }
-
- $normalizedOldPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $oldname);
- $normalizedNewPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname);
-
- // rename to non-existing folder is denied
- if (!$this->view->file_exists($normalizedOldPath)) {
- $result['data'] = array(
- 'message' => $this->l10n->t('%s could not be renamed as it has been deleted', array($oldname)),
- 'code' => 'sourcenotfound',
- 'oldname' => $oldname,
- 'newname' => $newname,
- );
- }else if (!$this->view->file_exists($dir)) {
- $result['data'] = array('message' => (string)$this->l10n->t(
- 'The target folder has been moved or deleted.',
- array($dir)),
- 'code' => 'targetnotfound'
- );
- // rename to existing file is denied
- } else if ($this->view->file_exists($normalizedNewPath)) {
-
- $result['data'] = array(
- 'message' => $this->l10n->t(
- "The name %s is already used in the folder %s. Please choose a different name.",
- array($newname, $dir))
- );
- } else if (
- // rename to "." is denied
- $newname !== '.' and
- // THEN try to rename
- $this->view->rename($normalizedOldPath, $normalizedNewPath)
- ) {
- // successful rename
- $meta = $this->view->getFileInfo($normalizedNewPath);
- $meta = \OCA\Files\Helper::populateTags(array($meta));
- $fileInfo = \OCA\Files\Helper::formatFileInfo(current($meta));
- $fileInfo['path'] = dirname($normalizedNewPath);
- $result['success'] = true;
- $result['data'] = $fileInfo;
- } else {
- // rename failed
- $result['data'] = array(
- 'message' => $this->l10n->t('%s could not be renamed', array($oldname))
- );
- }
- return $result;
- }
-
}
diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php
index fb14cea731f..9a4e8d59786 100644
--- a/apps/files/lib/helper.php
+++ b/apps/files/lib/helper.php
@@ -139,9 +139,6 @@ class Helper {
$entry['parentId'] = $i['parent'];
$entry['mtime'] = $i['mtime'] * 1000;
// only pick out the needed attributes
- if (\OC::$server->getPreviewManager()->isAvailable($i)) {
- $entry['isPreviewAvailable'] = true;
- }
$entry['name'] = $i->getName();
$entry['permissions'] = $i['permissions'];
$entry['mimetype'] = $i['mimetype'];