drop filectime from the filesystem api's

This commit is contained in:
Robin Appelman 2012-10-20 23:54:37 +02:00
parent f7722abcb0
commit cfa036eaa9
13 changed files with 1 additions and 55 deletions

View File

@ -115,12 +115,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$stat['size'] = $this->s3->get_bucket_filesize($this->bucket); $stat['size'] = $this->s3->get_bucket_filesize($this->bucket);
$stat['atime'] = time(); $stat['atime'] = time();
$stat['mtime'] = $stat['atime']; $stat['mtime'] = $stat['atime'];
$stat['ctime'] = $stat['atime'];
} else if ($object = $this->getObject($path)) { } else if ($object = $this->getObject($path)) {
$stat['size'] = $object['Size']; $stat['size'] = $object['Size'];
$stat['atime'] = time(); $stat['atime'] = time();
$stat['mtime'] = strtotime($object['LastModified']); $stat['mtime'] = strtotime($object['LastModified']);
$stat['ctime'] = $stat['mtime'];
} }
if (isset($stat)) { if (isset($stat)) {
return $stat; return $stat;

View File

@ -119,7 +119,6 @@ class Dropbox extends \OC\Files\Storage\Common {
$stat['size'] = $metaData['bytes']; $stat['size'] = $metaData['bytes'];
$stat['atime'] = time(); $stat['atime'] = time();
$stat['mtime'] = (isset($metaData['modified'])) ? strtotime($metaData['modified']) : time(); $stat['mtime'] = (isset($metaData['modified'])) ? strtotime($metaData['modified']) : time();
$stat['ctime'] = $stat['mtime'];
return $stat; return $stat;
} }
return false; return false;

View File

@ -257,14 +257,12 @@ class Google extends \OC\Files\Storage\Common {
$stat['size'] = $this->free_space($path); $stat['size'] = $this->free_space($path);
$stat['atime'] = time(); $stat['atime'] = time();
$stat['mtime'] = time(); $stat['mtime'] = time();
$stat['ctime'] = time();
} else if ($entry = $this->getResource($path)) { } else if ($entry = $this->getResource($path)) {
// NOTE: Native resources don't have a file size // NOTE: Native resources don't have a file size
$stat['size'] = $entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'quotaBytesUsed')->item(0)->nodeValue; $stat['size'] = $entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'quotaBytesUsed')->item(0)->nodeValue;
// if (isset($atime = $entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'lastViewed')->item(0)->nodeValue)) // if (isset($atime = $entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'lastViewed')->item(0)->nodeValue))
// $stat['atime'] = strtotime($entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'lastViewed')->item(0)->nodeValue); // $stat['atime'] = strtotime($entry->getElementsByTagNameNS('http://schemas.google.com/g/2005', 'lastViewed')->item(0)->nodeValue);
$stat['mtime'] = strtotime($entry->getElementsByTagName('updated')->item(0)->nodeValue); $stat['mtime'] = strtotime($entry->getElementsByTagName('updated')->item(0)->nodeValue);
$stat['ctime'] = strtotime($entry->getElementsByTagName('published')->item(0)->nodeValue);
} }
if (isset($stat)) { if (isset($stat)) {
return $stat; return $stat;

View File

@ -500,7 +500,6 @@ class SWIFT extends \OC\Files\Storage\Common{
return array( return array(
'mtime'=>-1, 'mtime'=>-1,
'size'=>$container->bytes_used, 'size'=>$container->bytes_used,
'ctime'=>-1
); );
} }
@ -518,7 +517,6 @@ class SWIFT extends \OC\Files\Storage\Common{
return array( return array(
'mtime'=>$mtime, 'mtime'=>$mtime,
'size'=>$obj->content_length, 'size'=>$obj->content_length,
'ctime'=>-1,
); );
} }

View File

@ -256,7 +256,6 @@ class DAV extends \OC\Files\Storage\Common{
return array( return array(
'mtime'=>strtotime($response['{DAV:}getlastmodified']), 'mtime'=>strtotime($response['{DAV:}getlastmodified']),
'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, 'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
'ctime'=>-1,
); );
}catch(\Exception $e) { }catch(\Exception $e) {
return array(); return array();

View File

@ -162,7 +162,6 @@ class Shared extends \OC\Files\Storage\Common {
if ($path == '' || $path == '/') { if ($path == '' || $path == '/') {
$stat['size'] = $this->filesize($path); $stat['size'] = $this->filesize($path);
$stat['mtime'] = $this->filemtime($path); $stat['mtime'] = $this->filemtime($path);
$stat['ctime'] = $this->filectime($path);
return $stat; return $stat;
} else if ($source = $this->getSourcePath($path)) { } else if ($source = $this->getSourcePath($path)) {
list($storage, $internalPath)=\OC\Files\Filesystem::resolvePath($source); list($storage, $internalPath)=\OC\Files\Filesystem::resolvePath($source);
@ -233,27 +232,6 @@ class Shared extends \OC\Files\Storage\Common {
return false; return false;
} }
public function filectime($path) {
if ($path == '' || $path == '/') {
$ctime = 0;
if ($dh = $this->opendir($path)) {
while (($filename = readdir($dh)) !== false) {
$tempctime = $this->filectime($filename);
if ($tempctime < $ctime) {
$ctime = $tempctime;
}
}
}
return $ctime;
} else {
$source = $this->getSourcePath($path);
if ($source) {
list($storage, $internalPath)=\OC\Files\Filesystem::resolvePath($source);
return $storage->filectime($internalPath);
}
}
}
public function filemtime($path) { public function filemtime($path) {
if ($path == '' || $path == '/') { if ($path == '' || $path == '/') {
$mtime = 0; $mtime = 0;

View File

@ -30,13 +30,12 @@ class OC_Files {
/** /**
* get the filesystem info * get the filesystem info
* @param string path * @param string $path
* @return array * @return array
* *
* returns an associative array with the following keys: * returns an associative array with the following keys:
* - size * - size
* - mtime * - mtime
* - ctime
* - mimetype * - mimetype
* - encrypted * - encrypted
* - versioned * - versioned

View File

@ -478,10 +478,6 @@ class Filesystem {
return self::$defaultInstance->file_exists($path); return self::$defaultInstance->file_exists($path);
} }
static public function filectime($path) {
return self::$defaultInstance->filectime($path);
}
static public function filemtime($path) { static public function filemtime($path) {
return self::$defaultInstance->filemtime($path); return self::$defaultInstance->filemtime($path);
} }

View File

@ -74,10 +74,6 @@ abstract class Common extends \OC\Files\Storage\Storage {
return $permissions; return $permissions;
} }
// abstract public function file_exists($path); // abstract public function file_exists($path);
public function filectime($path) {
$stat = $this->stat($path);
return $stat['ctime'];
}
public function filemtime($path) { public function filemtime($path) {
$stat = $this->stat($path); $stat = $this->stat($path);
return $stat['mtime']; return $stat['mtime'];

View File

@ -66,9 +66,6 @@ class Local extends \OC\Files\Storage\Common{
public function file_exists($path) { public function file_exists($path) {
return file_exists($this->datadir.$path); return file_exists($this->datadir.$path);
} }
public function filectime($path) {
return filectime($this->datadir.$path);
}
public function filemtime($path) { public function filemtime($path) {
return filemtime($this->datadir.$path); return filemtime($this->datadir.$path);
} }

View File

@ -29,7 +29,6 @@ abstract class Storage{
abstract public function isSharable($path); abstract public function isSharable($path);
abstract public function getPermissions($path); abstract public function getPermissions($path);
abstract public function file_exists($path); abstract public function file_exists($path);
abstract public function filectime($path);
abstract public function filemtime($path); abstract public function filemtime($path);
abstract public function file_get_contents($path); abstract public function file_get_contents($path);
abstract public function file_put_contents($path,$data); abstract public function file_put_contents($path,$data);

View File

@ -236,10 +236,6 @@ class View {
return $this->basicOperation('file_exists', $path); return $this->basicOperation('file_exists', $path);
} }
public function filectime($path) {
return $this->basicOperation('filectime', $path);
}
public function filemtime($path) { public function filemtime($path) {
return $this->basicOperation('filemtime', $path); return $this->basicOperation('filemtime', $path);
} }

View File

@ -306,13 +306,6 @@ class OC_Filesystem {
return \OC\Files\Filesystem::file_exists($path); return \OC\Files\Filesystem::file_exists($path);
} }
/**
* @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
*/
static public function filectime($path) {
return \OC\Files\Filesystem::filectime($path);
}
/** /**
* @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
*/ */