文件缓存

@return File
339814
private function createFileCache():File
    {
        /** @var IConfig $config */
        $config = $this->di->getShared('config');
        /** @var IApp $app */
        $app = $this->di->getShared('app');
        $lifetime = (int)$config->get($this->getName() . '.lifetime', 3600);
        $cacheDir = $app->getCacheDir();
        $frontCache = new FrontData([
            "lifetime" => $lifetime
        ]);
        return new File($frontCache, ['cacheDir' => $cacheDir]);

    }
649942
public function getFileStream() {
		$stream = new \FAL\FileStream();
		$pt = $stream->getProtocolName();
		file_put_contents($path = $pt.'://'.$this->file,$this->getContent());
		return $path;
	}
140972
public static function getWebPath()
    {
        static $path;
        if (empty($path)) {
            
            // 当前文件路径
            $file = Request::instance()->server('SCRIPT_NAME');
            
            // 去除文件名
            $arr = explode('/', $file);
            array_pop($arr);
            
            // 当前文件夹路径
            if (count($arr) == 0) {
                $path = '/';
            } else {
                $path = implode('/', $arr) . '/';
            }
        }
        return $path;
    }
407797
public function getFilePath() {
		if ($this->path === null) {
			throw new NoPath('Path to a file was not been specified');
		}
		
		// Absolute path
		if ($this->path[0] === DIRECTORY_SEPARATOR) {
			return $this->path;
		}
		// Relative path
		return $this->getIntrospectiveData()->dirname . DIRECTORY_SEPARATOR . $this->path;
	}
290732
protected function make()
  {
    if ( !$this->file && strpos($this->path,'http://') === 0 ){
      $d = getcwd();
      chdir(__DIR__);
      chdir('../tmp');
      $f = tempnam('.','image');
      try{
        $c = file_get_contents($this->path.$this->name);
        if ( file_put_contents($f, $c) ){
          if ( substr($this->name,-1) == '/' ){
            $this->name = substr($this->name,0,-1);
          }
          chmod($f, 0644);
          $this->file = $f;
          $this->path = getcwd();
        }
        else{
          $this->error = 'Impossible to get the file '.$this->path.$this->name;
        }
      }
      catch ( Error $e )
        { $this->error = 'Impossible to get the file '.$this->path.$this->name; }
      chdir($d);
    }
    return $this;
  }
664862
public function getFileSystem()
    {
        if (null == $this->fileSystem) {
            $this->setFileSystem(Helper::getFileSystem());
        }

        return $this->fileSystem;
    }
1343287
function file()
    {
        $data    = implode('', $this -> datasec);
        $ctrldir = implode('', $this -> ctrl_dir);

        return
            $data .
            $ctrldir .
            $this -> eof_ctrl_dir .
            pack('v', sizeof($this -> ctrl_dir)) .  // total # of entries "on this disk"
            pack('v', sizeof($this -> ctrl_dir)) .  // total # of entries overall
            pack('V', strlen($ctrldir)) .           // size of central dir
            pack('V', strlen($data)) .              // offset to start of central dir
            "\x00\x00";                             // .zip file comment length
    }
745255
public function getFile()
    {
        $key = $this->getKey();

        $tags = $this->getTags();

        if (!$this->cache->has($key, $tags)) {
            $this->loadFile();
        }

        return simplexml_load_string($this->cache->get($key, $tags));
    }
529078
protected function actionList()
    {
        /* 判断类型 */
        switch ($_GET['action']) {
            /* 列出文件 */
            case 'listfile':
                $this->driver->uploadDir .= DIRECTORY_SEPARATOR . 'file';
                $this->driver->accept = $this->reAccept($this->config['fileManagerAllowFiles']);
                break;
            /* 列出图片 */
            default:
                $this->driver->uploadDir .= DIRECTORY_SEPARATOR . 'image';
                $this->driver->accept = $this->reAccept($this->config['imageManagerAllowFiles']);
        }

        /* 获取参数 */
        $size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : 10;
        $start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
        $response = $this->driver->listFiles($start, $size);

        $result = [];
        $result['state'] = 'SUCCESS';
        $result['list'] = array_map(function ($val) {
            return [
                'url' => $this->formatListItemUrl($val)
            ];
        },$response->list);
        return json_encode($result);
    }
1356916
public function files()
    {
        if (is_null($this->fileRequests)) {
            $this->fileRequests = new FileRequests($this->client);
        }

        return $this->fileRequests;
    }
717524
public function getFiles() {
        $dir = $this->getDirOutput();
        $finder = new \Symfony\Component\Finder\Finder();
        $finder->files()->in($dir);
        return $finder;
    }
1102660
private static function file()
    {
        $files = ['File', 'Filesystem'];
        $folder = static::$root.'Filesystem'.'/';

        self::call($files, $folder);

        $files = ['FileNotFoundException', 'DirectoryNotFoundException'];
        $folder = static::$root.'Filesystem/Exceptions'.'/';

        self::call($files, $folder);
    }
413783
public function getFile(): ?Filesystem
    {
        if (!$this->hasFile()) {
            $this->setFile($this->getDefaultFile());
        }
        return $this->file;
    }
1257388
public function generateFile()
    {
        $this->file_content = file_get_contents($this->stub_path . '/' . $this->stub_file);
        $this->file_content = str_replace('{{ content }}', $this->content, $this->file_content);

        return $this->file_content;
    }
644719
public function file( $file = null )
	{
		if ( !is_null( $file ) )
		{
			return $this->_file = $file;
		}
		
		return $this->_file;
	}
1363190
public function getFile()
    {
        if ($this->_file === null) {
            $this->_file = Yii::$app->storage->getFile($this->getFileId());
        }
        
        return $this->_file;
    }
353807
public function getFileObject()
    {
        return new SplFileObject(
            self::WNAME . '://' . spl_object_hash($this),
            'rb',
            false,
            stream_context_create(array(
                self::WNAME => array(
                    'string' => $this
                )
            ))
        );
    }