/** * {@inheritdoc} */ public function __construct($app) { parent::__construct($app); if (class_exists('\\League\\Flysystem\\Azure\\AzureAdapter')) { $this->extend('azure', function ($app, $config) { $endpoint = sprintf('DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s', $config['accountName'], $config['apiKey']); $client = \WindowsAzure\Common\ServicesBuilder::getInstance()->createBlobService($endpoint); return $this->createFlysystem(new \League\Flysystem\Azure\AzureAdapter($client, $config['container']), $config); }); } if (class_exists('\\League\\Flysystem\\Copy\\CopyAdapter')) { $this->extend('copy', function ($app, $config) { $client = new \Barracuda\Copy\API($config['consumerKey'], $config['consumerSecret'], $config['accessToken'], $config['tokenSecret']); return $this->createFlysystem(new \League\Flysystem\Copy\CopyAdapter($client), $config); }); } if (class_exists('\\League\\Flysystem\\Dropbox\\DropboxAdapter')) { $this->extend('dropbox', function ($app, $config) { $client = new \Dropbox\Client($config['accessToken'], $config['clientIdentifier']); return $this->createFlysystem(new \League\Flysystem\Dropbox\DropboxAdapter($client), $config); }); } if (class_exists('\\League\\Flysystem\\GridFS\\GridFSAdapter')) { $this->extend('gridfs', function ($app, $config) { $mongoClient = new \MongoClient($config['server'], Arr::except($config, ['driver', 'server', 'context', 'dbName']), Arr::get($config, 'context', null)); $gridFs = $mongoClient->selectDB($config['dbName'])->getGridFS(); return $this->createFlysystem(new \League\Flysystem\GridFS\GridFSAdapter($gridFs), $config); }); } if (class_exists('\\League\\Flysystem\\Memory\\MemoryAdapter')) { $this->extend('memory', function ($app, $config) { return $this->createFlysystem(new \League\Flysystem\Memory\MemoryAdapter(), $config); }); } if (class_exists('\\League\\Flysystem\\Phpcr\\PhpcrAdapter')) { $this->extend('phpcr', function ($app, $config) { $credentials = new \PHPCR\SimpleCredentials(null, null); $logger = new \Jackalope\Transport\LoggingPsr3Logger(Log::getMonolog()); if (class_exists('\\Jackalope\\RepositoryFactoryJackrabbit')) { $repository = (new \Jackalope\RepositoryFactoryJackrabbit())->getRepository(["jackalope.jackrabbit_uri" => $config['jackrabbit_url'], 'jackalope.logger' => $logger]); $credentials = new \PHPCR\SimpleCredentials($config['user'], $config['pass']); } elseif (class_exists('Jackalope\\RepositoryFactoryDoctrineDBAL')) { $repository = (new \Jackalope\RepositoryFactoryDoctrineDBAL())->getRepository(['jackalope.doctrine_dbal_connection' => \Doctrine\DBAL\DriverManager::getConnection(['pdo' => DB::connection(Arr::get($config, 'database'))->getPdo()]), 'jackalope.logger' => $logger]); } elseif (class_exists('\\Jackalope\\RepositoryFactoryPrismic')) { $repository = (new \Jackalope\RepositoryFactoryPrismic())->getRepository(['jackalope.prismic_uri' => $config['prismic_uri'], 'jackalope.logger' => $logger]); } else { throw new \League\Flysystem\NotSupportedException("Couldn't find supported PHPCR Repository implementation. Install and configure one of Jackalope's JackRabbit, Doctrine DBAL, or Prismic.io implementations and try again."); } $session = $repository->login($credentials, $config['workspace']); return $this->createFlysystem(new \League\Flysystem\Phpcr\PhpcrAdapter($session, $config['root']), $config); }); } if (class_exists('\\League\\Flysystem\\Replicate\\ReplicateAdapter')) { $this->extend('replicate', function ($app, $config) { return $this->createFlysystem(new \League\Flysystem\Replicate\ReplicateAdapter($this->disk($config['master'])->getAdapter(), $this->disk($config['replica'])->getAdapter()), $config); }); } if (class_exists('\\League\\Flysystem\\Sftp\\SftpAdapter')) { $this->extend('sftp', function ($app, $config) { return $this->createFlysystem(new \League\Flysystem\Sftp\SftpAdapter($config), $config); }); } if (class_exists('\\League\\Flysystem\\Vfs\\VfsAdapter')) { $this->extend('vfs', function ($app, $config) { return $this->createFlysystem(new \League\Flysystem\Vfs\VfsAdapter(new VirtualFileSystem\FileSystem()), $config); }); } if (class_exists('\\League\\Flysystem\\WebDAV\\WebDAVAdapter')) { $this->extend('webdav', function ($app, $config) { if (!empty($config['authType'])) { if (is_string($config['authType']) && strtolower($config['authType']) == 'ntlm') { $config['authType'] = \Sabre\DAV\Client::AUTH_NTLM; } elseif (is_string($config['authType']) && strtolower($config['authType']) == 'digest') { $config['authType'] = \Sabre\DAV\Client::AUTH_DIGEST; } else { $config['authType'] = \Sabre\DAV\Client::AUTH_BASIC; } } if (!empty($config['encoding'])) { if (is_string($config['encoding']) && strtolower($config['encoding']) == 'all') { $config['encoding'] = \Sabre\DAV\Client::ENCODING_ALL; } else { if (is_string($config['encoding'])) { $encList = explode(',', $config['encoding']); } elseif (is_array($config['encoding'])) { $encList = $config['encoding']; } elseif (!is_numeric($config['encoding'])) { $encList = (array) $config['encoding']; } if (isset($encList)) { $config['encoding'] = 0; foreach ($encList as $encoding) { switch ($encoding) { case 'deflate': $config['encoding'] &= \Sabre\DAV\Client::ENCODING_DEFLATE; break; case 'gzip': $config['encoding'] &= \Sabre\DAV\Client::ENCODING_GZIP; break; case 'identity': default: $config['encoding'] &= \Sabre\DAV\Client::ENCODING_IDENTITY; break; } } } } } return $this->createFlysystem(new \League\Flysystem\WebDAV\WebDAVAdapter(new \Sabre\DAV\Client($config)), $config); }); } if (class_exists('\\League\\Flysystem\\ZipArchive\\ZipArchiveAdapter')) { $this->extend('zip', function ($app, $config) { return $this->createFlysystem(new \League\Flysystem\ZipArchive\ZipArchiveAdapter($config['path']), $config); }); } }
public function __construct(\Illuminate\Contracts\Foundation\Application $app) { parent::__construct($app); }