summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/node/file.php10
-rw-r--r--lib/private/files/node/folder.php7
-rw-r--r--lib/private/files/node/node.php71
-rw-r--r--lib/private/util.php13
4 files changed, 62 insertions, 39 deletions
diff --git a/lib/private/files/node/file.php b/lib/private/files/node/file.php
index 81e251c20b8..1c47294cdae 100644
--- a/lib/private/files/node/file.php
+++ b/lib/private/files/node/file.php
@@ -34,6 +34,7 @@ class File extends Node implements \OCP\Files\File {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
$this->sendHooks(array('preWrite'));
$this->view->file_put_contents($this->path, $data);
+ $this->fileInfo = null;
$this->sendHooks(array('postWrite'));
} else {
throw new NotPermittedException();
@@ -41,13 +42,6 @@ class File extends Node implements \OCP\Files\File {
}
/**
- * @return string
- */
- public function getMimeType() {
- return $this->view->getMimeType($this->path);
- }
-
- /**
* @param string $mode
* @return resource
* @throws \OCP\Files\NotPermittedException
@@ -94,6 +88,7 @@ class File extends Node implements \OCP\Files\File {
$nonExisting = new NonExistingFile($this->root, $this->view, $this->path);
$this->root->emit('\OC\Files', 'postDelete', array($nonExisting));
$this->exists = false;
+ $this->fileInfo = null;
} else {
throw new NotPermittedException();
}
@@ -138,6 +133,7 @@ class File extends Node implements \OCP\Files\File {
$this->root->emit('\OC\Files', 'postRename', array($this, $targetNode));
$this->root->emit('\OC\Files', 'postWrite', array($targetNode));
$this->path = $targetPath;
+ $this->fileInfo = null;
return $targetNode;
} else {
throw new NotPermittedException();
diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php
index 83e20871528..54a699be532 100644
--- a/lib/private/files/node/folder.php
+++ b/lib/private/files/node/folder.php
@@ -321,13 +321,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return $this->view->free_space($this->path);
}
- /**
- * @return bool
- */
- public function isCreatable() {
- return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
- }
-
public function delete() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
$this->sendHooks(array('preDelete'));
diff --git a/lib/private/files/node/node.php b/lib/private/files/node/node.php
index c52f5bbd54f..b80db28e8ec 100644
--- a/lib/private/files/node/node.php
+++ b/lib/private/files/node/node.php
@@ -8,10 +8,10 @@
namespace OC\Files\Node;
-use OCP\Files\NotFoundException;
+use OCP\Files\FileInfo;
use OCP\Files\NotPermittedException;
-class Node implements \OCP\Files\Node {
+class Node implements \OCP\Files\Node, FileInfo {
/**
* @var \OC\Files\View $view
*/
@@ -28,6 +28,11 @@ class Node implements \OCP\Files\Node {
protected $path;
/**
+ * @var \OCP\Files\FileInfo
+ */
+ protected $fileInfo;
+
+ /**
* @param \OC\Files\View $view
* @param \OC\Files\Node\Root $root
* @param string $path
@@ -38,6 +43,13 @@ class Node implements \OCP\Files\Node {
$this->path = $path;
}
+ private function getFileInfo() {
+ if (!$this->fileInfo) {
+ $this->fileInfo = $this->view->getFileInfo($this->path);
+ }
+ return $this->fileInfo;
+ }
+
/**
* @param string[] $hooks
*/
@@ -85,6 +97,12 @@ class Node implements \OCP\Files\Node {
$this->sendHooks(array('preTouch'));
$this->view->touch($this->path, $mtime);
$this->sendHooks(array('postTouch'));
+ if ($this->fileInfo) {
+ if (is_null($mtime)) {
+ $mtime = time();
+ }
+ $this->fileInfo['mtime'] = $mtime;
+ }
} else {
throw new NotPermittedException();
}
@@ -118,8 +136,7 @@ class Node implements \OCP\Files\Node {
* @return int
*/
public function getId() {
- $info = $this->view->getFileInfo($this->path);
- return $info['fileid'];
+ return $this->getFileInfo()->getId();
}
/**
@@ -133,58 +150,60 @@ class Node implements \OCP\Files\Node {
* @return int
*/
public function getMTime() {
- return $this->view->filemtime($this->path);
+ return $this->getFileInfo()->getMTime();
}
/**
* @return int
*/
public function getSize() {
- return $this->view->filesize($this->path);
+ return $this->getFileInfo()->getSize();
}
/**
* @return string
*/
public function getEtag() {
- $info = $this->view->getFileInfo($this->path);
- return $info['etag'];
+ return $this->getFileInfo()->getEtag();
}
/**
* @return int
*/
public function getPermissions() {
- $info = $this->view->getFileInfo($this->path);
- return $info['permissions'];
+ return $this->getFileInfo()->getPermissions();
}
/**
* @return bool
*/
public function isReadable() {
- return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
+ return $this->getFileInfo()->isReadable();
}
/**
* @return bool
*/
public function isUpdateable() {
- return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
+ return $this->getFileInfo()->isUpdateable();
}
/**
* @return bool
*/
public function isDeletable() {
- return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
+ return $this->getFileInfo()->isDeletable();
}
/**
* @return bool
*/
public function isShareable() {
- return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
+ return $this->getFileInfo()->isShareable();
+ }
+
+ public function isCreatable() {
+ return $this->getFileInfo()->isCreatable();
}
/**
@@ -240,4 +259,28 @@ class Node implements \OCP\Files\Node {
}
return true;
}
+
+ public function isMounted() {
+ return $this->getFileInfo()->isMounted();
+ }
+
+ public function isShared() {
+ return $this->getFileInfo()->isShared();
+ }
+
+ public function getMimeType() {
+ return $this->getFileInfo()->getMimetype();
+ }
+
+ public function getMimePart() {
+ return $this->getFileInfo()->getMimePart();
+ }
+
+ public function getType() {
+ return $this->getFileInfo()->getType();
+ }
+
+ public function isEncrypted() {
+ return $this->getFileInfo()->isEncrypted();
+ }
}
diff --git a/lib/private/util.php b/lib/private/util.php
index a18a4e44232..38db431e895 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -605,9 +605,9 @@ class OC_Util {
$webServerRestart = true;
}
- if (version_compare(phpversion(), '5.3.3', '<')) {
+ if (version_compare(phpversion(), '5.4.0', '<')) {
$errors[] = array(
- 'error' => $l->t('PHP %s or higher is required.', '5.3.3'),
+ 'error' => $l->t('PHP %s or higher is required.', '5.4.0'),
'hint' => $l->t('Please ask your server administrator to update PHP to the latest version.'
. ' Your PHP version is no longer supported by ownCloud and the PHP community.')
);
@@ -1114,15 +1114,6 @@ class OC_Util {
}
/**
- * Check if a PHP version older then 5.3.8 is installed.
- *
- * @return bool
- */
- public static function isPHPoutdated() {
- return version_compare(phpversion(), '5.3.8', '<');
- }
-
- /**
* Check if the ownCloud server can connect to the internet
*
* @return bool