当前位置: 首页>>代码示例>>PHP>>正文


PHP Filesystem::listFiles方法代码示例

本文整理汇总了PHP中League\Flysystem\Filesystem::listFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::listFiles方法的具体用法?PHP Filesystem::listFiles怎么用?PHP Filesystem::listFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Flysystem\Filesystem的用法示例。


在下文中一共展示了Filesystem::listFiles方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getArchives

 /**
  * {@inheritdoc}
  */
 public function getArchives(JobExecution $jobExecution)
 {
     $directory = dirname($this->getRelativeArchivePath($jobExecution));
     $archives = [];
     foreach ($this->filesystem->listFiles($directory) as $key) {
         $archives[basename($key['path'])] = $key['path'];
     }
     return $archives;
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:12,代码来源:AbstractFilesystemArchiver.php

示例2: getFiles

 /**
  * @return array
  */
 public function getFiles()
 {
     if (!$this->files) {
         $this->files = $this->fs->listFiles($this->getDirectory(), true);
         foreach ($this->files as &$file) {
             $this->addData($file);
         }
     }
     return $this->files;
 }
开发者ID:rieschl,项目名称:techtalks_data,代码行数:13,代码来源:AbstractLoader.php

示例3: getFilesList

 /**
  * {@inheritdoc}
  */
 public function getFilesList($exclude = false)
 {
     $fileslist = array();
     $files = $this->filesystem->listFiles('', true);
     foreach ($files as $file) {
         $filename = basename($file['path']);
         $dirname = dirname($file['path']);
         $fileslist[$dirname][$filename] = $file['path'];
     }
     return $fileslist;
 }
开发者ID:flamecore,项目名称:synchronizer-files,代码行数:14,代码来源:FlysystemFilesLocation.php

示例4: pruneStorage

 /**
  * @return int
  */
 public function pruneStorage()
 {
     if (!$this->options->getPruneMaxCount() && !$this->options->getPruneMaxTtl()) {
         return 0;
     }
     // save to just add
     $this->filesystem->addPlugin(new ListFiles());
     $filesInBackup = $this->filesystem->listFiles($this->options->getPath());
     // filter latest.txt
     if ($this->options->getWriteLatest()) {
         $filesInBackup = array_filter($filesInBackup, function ($item) {
             return $item['basename'] != $this->options->getWriteLatest();
         });
     }
     // sort on timestamp
     usort($filesInBackup, function ($item1, $item2) {
         return strcmp($item1['timestamp'], $item2['timestamp']);
     });
     $pruneCount = 0;
     // remove while count >= pruneMaxCount or timestamp < now - pruneMaxTtl
     while ($last = array_shift($filesInBackup)) {
         if ($this->options->getPruneMaxCount()) {
             if (count($filesInBackup) >= $this->options->getPruneMaxCount()) {
                 $this->filesystem->delete($last['path']);
                 $pruneCount++;
                 continue;
             }
         }
         if ($this->options->getPruneMaxTtl()) {
             if ($last['timestamp'] < time() - $this->options->getPruneMaxTtl()) {
                 $this->filesystem->delete($last['path']);
                 $pruneCount++;
                 continue;
             }
         }
     }
     return $pruneCount;
 }
开发者ID:bushbaby,项目名称:BsbFlysystemMysqlBackup,代码行数:41,代码来源:MysqlBackupService.php

示例5: restore

 /**
  * {@inheritdoc}
  *
  * @throws FileExistsException
  * @throws \InvalidArgumentException
  * @throws FileNotFoundException
  * @throws LogicException
  */
 public function restore(Filesystem $source, Filesystem $destination, ReadonlyDatabase $database, array $parameter)
 {
     // TODO make it smoother
     $files = $source->listFiles('', true);
     $progressBar = new ProgressBar($this->output, count($files));
     $progressBar->setOverwrite(true);
     $progressBar->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%');
     $progressBar->start();
     foreach ($files as $file) {
         $path = $file['path'];
         $fullPath = $parameter['directory'] . '/' . $file['path'];
         if ($destination->has($fullPath)) {
             if ($destination->hash($fullPath) === $source->hash($path)) {
                 $progressBar->advance();
                 continue;
             }
             $destination->delete($fullPath);
         }
         $destination->writeStream($fullPath, $source->readStream($path));
         $progressBar->advance();
     }
     $progressBar->finish();
 }
开发者ID:nanbando,项目名称:core,代码行数:31,代码来源:DirectoryPlugin.php

示例6: testRemoteListing

 public function testRemoteListing()
 {
     $this->remoteFilesystem->listFiles($this->name)->willReturn([['filename' => 'test-1'], ['filename' => 'test-2']]);
     $this->assertEquals(['test-1', 'test-2'], $this->storage->remoteListing());
 }
开发者ID:nanbando,项目名称:core,代码行数:5,代码来源:LocalStorageTest.php

示例7: getChunks

 public function getChunks($uuid)
 {
     $results = $this->filesystem->listFiles($this->prefix . '/' . $uuid);
     return preg_grep('/^.+\\/(\\d+)_/', $results['keys']);
 }
开发者ID:BboyKeen,项目名称:OneupUploaderBundle,代码行数:5,代码来源:FlysystemStorage.php

示例8: listing

 /**
  * @param Filesystem $filesystem
  *
  * @return string[]
  */
 protected function listing(Filesystem $filesystem)
 {
     return array_filter(array_map(function ($item) {
         return $item['filename'];
     }, $filesystem->listFiles($this->name)));
 }
开发者ID:nanbando,项目名称:core,代码行数:11,代码来源:LocalStorage.php

示例9: listFiles

 /**
  * List all the files from a directory
  * 
  * @param  string $directory
  * @param  bool $recursive
  * @return array
  */
 public function listFiles($directory = null, $recursive = false)
 {
     return $this->flysystem->listFiles($directory, $recursive);
 }
开发者ID:gibboncms,项目名称:gibbon,代码行数:11,代码来源:FlyFilesystem.php

示例10: getListing

 /**
  * @return array
  */
 public function getListing()
 {
     return $this->filesystem->listFiles();
 }
开发者ID:TomAdam,项目名称:db-backup,代码行数:7,代码来源:S3StorageAdapter.php


注:本文中的League\Flysystem\Filesystem::listFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。