Пример #1
0
 public function getDocBookStack()
 {
     if (!isset($this->cache['docbook_stack'])) {
         $truefile = $this;
         $filepath = $truefile->getRealPath();
         if ($this->isLink() || $this->isRootLink()) {
             if ($this->isLink()) {
                 try {
                     $rp_tmp = realpath($this->getLinkTarget());
                 } catch (\Exception $e) {
                 }
                 if (empty($rp_tmp)) {
                     $rp_tmp = $this->getRealPath();
                 }
                 $truefile = new WebFileInfo($rp_tmp);
             } elseif ($this->isRootLink()) {
                 try {
                     $rp_tmp = @readlink($this->getPathname());
                 } catch (\Exception $e) {
                 }
                 if (empty($rp_tmp)) {
                     $rp_tmp = $this->getRealPath();
                 }
                 $truefile = new WebFileInfo($rp_tmp);
             }
         }
         $_size = $truefile->isDir() ? Helper::getDirectorySize($truefile->getPathname()) : $truefile->getSize();
         $this->cache['docbook_stack'] = array('path' => $this->getDocBookPath(), 'type' => $this->getType(), 'route' => Helper::getRoute($this->getRealPath()), 'name' => $this->getHumanReadableFilename(), 'size' => WebFilesystem::getTransformedFilesize($_size), 'plainsize' => $_size, 'mtime' => WebFilesystem::getDateTimeFromTimestamp($truefile->getMTime()), 'description' => $this->getDescription(), 'trans' => $this->isDir() ? array() : $this->findTranslations(), 'dirpath' => dirname($this->getPathname()), 'lines_nb' => $this->isDir() ? null : Helper::getFileLinesCount($this->getRealPath()), 'extension' => $this->getExtension());
     }
     return $this->cache['docbook_stack'];
 }