You are here

public function DisplayFile::fileSetData in Filebrowser 3.x

Same name and namespace in other branches
  1. 8.2 src/File/DisplayFile.php \Drupal\filebrowser\File\DisplayFile::fileSetData()

Parameters

$file_relative_path:

\stdClass $fs_file:

$stats:

$db_content:

$root:

Return value

array

File

src/File/DisplayFile.php, line 114

Class

DisplayFile

Namespace

Drupal\filebrowser\File

Code

public function fileSetData($file_relative_path, $fs_file, &$stats, $db_content, $root) {
  $this->fid = isset($db_content['fid']) ? $db_content['fid'] : null;
  $this->description = isset($db_content['description']) ? $db_content['description'] : null;
  $this->displayName = $db_content['display_name'];
  $this->name = $db_content['display_name'];
  $this->fsRoot = $root;
  $this->relativePath = $file_relative_path;
  $this->fullPath = rtrim($this->fsRoot, '/') . "/" . $fs_file->filename;
  $this->status = MARK_READ;
  $this->fileData = $fs_file;
  if ($this
    ->currentUser()
    ->id() && isset($this->fileData->timestamp)) {

    // if ($this->user->getLastAccessedTime() <
    if ($this
      ->currentUser()
      ->getLastAccessedTime() < $this->fileData->timestamp) {
      $this->status = MARK_NEW;
    }
  }
  return $this;
}