本文整理汇总了PHP中Illuminate\Filesystem\FilesystemManager类的典型用法代码示例。如果您正苦于以下问题:PHP FilesystemManager类的具体用法?PHP FilesystemManager怎么用?PHP FilesystemManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FilesystemManager类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extend
/**
* Register a custom driver creator Closure.
*
* @param string $driver
* @param \Closure $callback
* @return $this
* @static
*/
public static function extend($driver, $callback)
{
return \Illuminate\Filesystem\FilesystemManager::extend($driver, $callback);
}
示例2: getTimestamp
/**
* {@inheritdoc}
*/
public function getTimestamp($key)
{
if ($this->filesystem->exists($key) === false) {
return 0;
}
return $this->filesystem->lastModified($key);
}
示例3: getUrl
/**
* {@inheritdoc}
*/
public function getUrl()
{
if (!$this->isPubliclyAccessible()) {
throw MediaUrlException::cloudMediaNotPubliclyAccessible($this->media->disk);
}
return $this->filesystem->disk($this->media->disk)->url($this->media->getDiskPath());
}
示例4: __construct
public function __construct()
{
$this->manager = app('filesystem');
$this->storage_local = $this->manager->disk('local');
$this->storage_cloud = $this->manager->disk(config('filesystems.cloud'));
$this->storage_tmp = $this->manager->disk('tmp');
$this->setStorage();
}
示例5: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(Config $config, Storage $storage)
{
$conn = $config->get('laravel-db-commands.backup_db_conn');
$db = $config->get("database.connections.{$conn}");
$dump_dest = $config->get('laravel-db-commands.backup_dump_destination');
$backup_disk_name = $config->get('laravel-db-commands.backup_disk');
$backup_disk = $storage->disk($backup_disk_name);
$backup_name = $db['database'] . '-' . time() . '.sql.gz';
$tmp_file = "{$dump_dest}/{$backup_name}";
$this->dumpMysqlDatabase($db, $tmp_file);
$this->uploadDumpToDisk($backup_disk, $backup_name, $tmp_file);
}
示例6: handle
/**
* Handle the hook.
*
* @param \Docit\Core\Project $project
* @return void
*/
public function handle(Project $project)
{
if (!$project->config('enable_filesystem_hook')) {
$project->setFiles(new LocalFilesystem());
}
$disk = $project->config('default_filesystem_disk');
$settings = $project->config('filesystem_hook_settings');
if (!isset($settings[$disk])) {
return;
}
$files = $this->fsm->disk($disk);
if (isset($files)) {
$project->setFiles($files);
$project->setPath($project->getName());
}
}
示例7: listFiles
/**
* Generate a list of all files in the specified directory.
* @param atring $disk
* @param string $directory
* @param bool $recursive
* @return array
*/
protected function listFiles($disk, $directory = '', $recursive = true)
{
if ($recursive) {
return $this->filesystem->disk($disk)->allFiles($directory);
} else {
return $this->filesystem->disk($disk)->files($directory);
}
}
示例8: move
/**
* Move the file to a new location on disk.
*
* Will invoke the `save()` method on the model after the associated file has been moved to prevent synchronization errors
* @param \Plank\Mediable\Media $media
* @param string $directory directory relative to disk root
* @param string $name filename. Do not include extension
* @return void
* @throws \Plank\Mediable\Exceptions\MediaMoveException If attempting to change the file extension or a file with the same name already exists at the destination
*/
public function move(Media $media, $directory, $filename = null)
{
$storage = $this->filesystem->disk($media->disk);
if ($filename) {
$filename = $this->removeExtensionFromFilename($filename, $media->extension);
} else {
$filename = $media->filename;
}
$directory = trim($directory, '/');
$target_path = $directory . '/' . $filename . '.' . $media->extension;
if ($storage->has($target_path)) {
throw MediaMoveException::destinationExists($target_path);
}
$storage->move($media->getDiskPath(), $target_path);
$media->filename = $filename;
$media->directory = $directory;
$media->save();
}
示例9: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(Config $config, Storage $storage)
{
$conn = $config->get('laravel-db-commands.backup_db_conn');
$db = $config->get("database.connections.{$conn}");
$dump_dest = $config->get('laravel-db-commands.backup_dump_destination');
$backup_disk = $config->get('laravel-db-commands.backup_disk');
$db_host = $db['host'];
$db_name = $db['database'];
$db_user = $db['username'];
$db_pass = $db['password'];
$backup_name = $db_name . '-' . time() . '.sql.gz';
$tmp_file = "{$dump_dest}/{$backup_name}";
$this->info("Generating Backup File");
$output = shell_exec("mysqldump -h {$db_host} -u {$db_user} -p{$db_pass} {$db_name} | gzip > {$tmp_file}");
$this->info($output);
$this->info("Uploading database to S3");
$s3 = $storage->disk($backup_disk);
$s3->put($backup_name, file_get_contents($tmp_file));
}
示例10: createLocalDriver
public function createLocalDriver(array $config)
{
$permissions = isset($config['permissions']) ? $config['permissions'] : [];
$links = Arr::get($config, 'links') === 'skip' ? DistributedAdapter::SKIP_LINKS : DistributedAdapter::DISALLOW_LINKS;
if (array_key_exists('distributed', $config)) {
if ($config['distributed']) {
return $this->adapt($this->createDistributedFilesystem(new DistributedAdapter($config['root'], LOCK_EX, $links, $permissions), $config));
}
}
return parent::createLocalDriver($config);
}
示例11: exists
/**
* {@inheritdoc}
*/
public function exists($name)
{
return $this->filesystem->exists($this->getTemplatePath($name));
}
示例12: getDisk
/**
* returns disk filesystem
*
* @param string $name disk name
* @return \Illuminate\Contracts\Filesystem\Filesystem
*/
protected function getDisk($name)
{
return $this->filesystem->disk($name);
}
示例13: createRackspaceDriver
/**
* {@inheritdoc}
*/
public function createRackspaceDriver(array $config)
{
if ($this->skipOverride()) {
$adapter = parent::createRackspaceDriver($config);
} else {
$adapter = $this->adapt($this->createFlysystem(parent::createRackspaceDriver($config)->getAdapter(), $config));
}
return $adapter;
}
示例14: delete
/**
* Remover todos os convites.
* @return bool
*/
public function delete()
{
$this->storage->disk()->deleteDirectory('/invites');
return true;
}