You are here

protected function DrupalRemoteStreamWrapper::getStat in Remote Stream Wrapper 7

Helper function to return a full array for stat functions.

1 call to DrupalRemoteStreamWrapper::getStat()
DrupalRemoteStreamWrapper::stream_stat in ./remote_stream_wrapper.inc
Support for fstat().

File

./remote_stream_wrapper.inc, line 500

Class

DrupalRemoteStreamWrapper
Stream wrapper to support local files.

Code

protected function getStat(array $stat = array()) {
  $defaults = array(
    'dev' => 0,
    // device number
    'ino' => 0,
    // inode number
    'mode' => 0100000 | 0444,
    // inode protectio
    'nlink' => 0,
    // number of links
    'uid' => 0,
    // userid of owner
    'gid' => 0,
    // groupid of owner
    'rdev' => -1,
    // device type, if inode device *
    'size' => 0,
    // size in bytes
    'atime' => 0,
    // time of last access (Unix timestamp)
    'mtime' => 0,
    // time of last modification (Unix timestamp)
    'ctime' => 0,
    // time of last inode change (Unix timestamp)
    'blksize' => -1,
    // blocksize of filesystem IO
    'blocks' => -1,
  );
  $return = array();
  foreach (array_keys($defaults) as $index => $key) {
    if (!isset($stat[$key])) {
      $return[$index] = $defaults[$key];
      $return[$key] = $defaults[$key];
    }
    else {
      $return[$index] = $stat[$key];
      $return[$key] = $stat[$key];
    }
  }
  return $return;
}