/** * @return bool */ public function run() : bool { // grab upload directory. $files = $this->uploadDisk->files(); foreach ($files as $entry) { $this->processUpload($entry); } return true; }
/** * @param Filesystem $filesystem * @param Repository $config * @return CommandResult */ public function handle(Filesystem $filesystem, Repository $config) { $path = is_null($this->path) ? DIRECTORY_SEPARATOR : $this->path; $response = []; $response['files'] = $filesystem->files($path); $response['directories'] = $filesystem->directories($path); $response['base_path'] = $config->get('filesystems.disks.local.root'); $response['paths'] = $this->breakDownPath($path); $response['current_path'] = $this->path; $response['is_empty'] = $this->isResultIsEmpty($response['files'], $response['directories']); // all good return new CommandResult(true, "List command successful.", $response, 200); }
/** * Scan files of the given directory. * * @param $current_directory * @return \Illuminate\Support\Collection */ protected function scanFiles($current_directory) { $files = collect($this->storage->files($current_directory)); $files = $files->filter(function ($file) { $ext = File::extension($file); if ($this->filter === 'images') { return in_array($ext, $this->config->get('media.images_ext')); } elseif ($this->filter === 'files') { return in_array($ext, $this->config->get('media.files_ext')); } return true; }); return $files; }
/** * @param \Illuminate\Http\Request $request * * @return void */ private function combineChunks(Request $request) { # Prelim $fineUploaderUuid = $request->get('qquuid'); $chunksFolder = $this->temporaryChunksFolder . DIRECTORY_SEPARATOR . $fineUploaderUuid; $totalNumberOfChunks = $request->has('qqtotalparts') ? intval($request->get('qqtotalparts')) : 1; # Do we have all chunks? $numberOfExistingChunks = count($this->filesystem->files($chunksFolder)); if ($numberOfExistingChunks != $totalNumberOfChunks) { throw new FileStreamExceptions\UploadIncompleteException(); } # We have all chunks, proceed with combine. $targetStream = fopen($this->getAbsolutePath($fineUploaderUuid), 'wb'); for ($i = 0; $i < $totalNumberOfChunks; $i++) { $chunkStream = fopen($this->getAbsolutePath($chunksFolder . DIRECTORY_SEPARATOR . $i), 'rb'); stream_copy_to_stream($chunkStream, $targetStream); fclose($chunkStream); } fclose($targetStream); $this->filesystem->deleteDirectory($chunksFolder); }
/** * Get an array of all files in a directory. * * @param string|null $directory * @param bool $recursive * * @return array */ public function files($directory = null, $recursive = false) { $directory = $this->getPathPrefix($directory); return $this->drive->files($directory, $recursive); }
/** * Query the build logs. * * @return \Illuminate\Support\Collection */ public function query() { return $this->getModels($this->storage->files('build')); }
/** * Get all files from the posts directory. * * @return array */ private function getFiles() { return $this->filesystem->files(); }
public function allFiles($from) { return $this->filesystem->files($from); }