setModifiedTime() public method

public setModifiedTime ( integer $modifiedTime )
$modifiedTime integer
Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function getFile($path)
 {
     $file = new \Jarves\File\FileInfo();
     $file->setPath($path ?: '/');
     $path = $this->getFullPath($path ?: '/');
     if (!file_exists($path)) {
         throw new FileNotFoundException(sprintf('File `%s` does not exists.', $path));
     }
     if (!is_readable($path)) {
         throw new FileNotFoundException(sprintf('File `%s` is not readable.', $path));
     }
     $file->setType(is_dir($path) ? 'dir' : 'file');
     $file->setCreatedTime(filectime($path));
     $file->setModifiedTime(filectime($path));
     $file->setSize(filesize($path));
     return $file;
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function getFiles($path)
 {
     $path = $this->getFullPath($path);
     $path = str_replace('..', '', $path);
     if (!file_exists($path)) {
         throw new FileNotFoundException(sprintf('File `%s` does not exists.', $path));
     }
     if (!is_dir($path)) {
         throw new NotADirectoryException(sprintf('File `%s` is not a directory.', $path));
     }
     if (substr($path, -1) != '/') {
         $path .= '/';
     }
     $h = @opendir($path);
     if (!$h) {
         throw new \Exception(sprintf('Can not open `%s`. Probably no permissions.', $path));
     }
     $items = array();
     while ($file = readdir($h)) {
         $fileInfo = new FileInfo();
         if ($file == '.' || $file == '..') {
             continue;
         }
         $file = $path . $file;
         $fileInfo->setPath(substr($file, strlen($this->getRoot()) - 1));
         $fileInfo->setType(is_dir($file) ? FileInfo::DIR : FileInfo::FILE);
         if (!is_link($file)) {
             $fileInfo->setCreatedTime(filectime($file));
             $fileInfo->setModifiedTime(filemtime($file));
             if (is_file($file)) {
                 $fileInfo->setSize(filesize($file));
             }
         }
         $items[] = $fileInfo;
     }
     return $items;
 }