Ejemplo n.º 1
0
 /**
  * get all the metadata of a file or folder
  * *
  *
  * @param string $path
  * @return array with metadata of the file
  */
 public function getData($path)
 {
     if (!$this->storage->isReadable($path)) {
         //cant read, nothing we can do
         \OCP\Util::writeLog('OC\\Files\\Cache\\Scanner', "!!! Path '{$path}' is not readable !!!", \OCP\Util::DEBUG);
         return null;
     }
     $data = array();
     $data['mimetype'] = $this->storage->getMimeType($path);
     $data['mtime'] = $this->storage->filemtime($path);
     if ($data['mimetype'] == 'httpd/unix-directory') {
         $data['size'] = -1;
         //unknown
     } else {
         $data['size'] = $this->storage->filesize($path);
     }
     $data['etag'] = $this->storage->getETag($path);
     $data['storage_mtime'] = $data['mtime'];
     return $data;
 }
Ejemplo n.º 2
0
 /**
  * get all the metadata of a file or folder
  * *
  *
  * @param string $path
  * @return array an array of metadata of the file
  */
 public function getData($path)
 {
     $permissions = $this->storage->getPermissions($path);
     if (!$permissions & \OCP\PERMISSION_READ) {
         //cant read, nothing we can do
         \OCP\Util::writeLog('OC\\Files\\Cache\\Scanner', "!!! Path '{$path}' is not accessible or present !!!", \OCP\Util::DEBUG);
         return null;
     }
     $data = array();
     $data['mimetype'] = $this->storage->getMimeType($path);
     $data['mtime'] = $this->storage->filemtime($path);
     if ($data['mimetype'] == 'httpd/unix-directory') {
         $data['size'] = -1;
         //unknown
     } else {
         $data['size'] = $this->storage->filesize($path);
     }
     $data['etag'] = $this->storage->getETag($path);
     $data['storage_mtime'] = $data['mtime'];
     $data['permissions'] = $permissions;
     return $data;
 }
Ejemplo n.º 3
0
 /**
  * see http://php.net/manual/en/function.filesize.php
  * The result for filesize when called on a folder is required to be 0
  *
  * @param string $path
  * @return int
  */
 public function filesize($path)
 {
     return $this->storage->filesize($path);
 }