本文整理汇总了PHP中League\Flysystem\Filesystem::getAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::getAdapter方法的具体用法?PHP Filesystem::getAdapter怎么用?PHP Filesystem::getAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Flysystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::getAdapter方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* @param array $fileList
*/
public function delete(array $fileList)
{
foreach ($fileList as $file) {
$this->logger->notice('Deleting ' . $file . ' in s3 bucket ' . $this->filesystem->getAdapter()->getBucket());
try {
$this->filesystem->delete($file);
} catch (\Exception $e) {
$this->logger->error('Exception while deleting ' . $file . ': ' . $e->getMessage());
}
}
}
示例2: getIcon
/**
* Find the icon based on the used Adapter
*
* @return string
*/
protected function getIcon()
{
try {
$adapter = $this->fs->getAdapter();
} catch (\Exception $e) {
$adapter = null;
}
if ($adapter instanceof AbstractFtpAdapter) {
$icon = 'volume_icon_ftp.png';
} elseif ($adapter instanceof DropboxAdapter) {
$icon = 'volume_icon_dropbox.png';
} else {
$icon = 'volume_icon_local.png';
}
$parentUrl = defined('ELFINDER_IMG_PARENT_URL') ? rtrim(ELFINDER_IMG_PARENT_URL, '/') . '/' : '';
return $parentUrl . 'img/' . $icon;
}
示例3: setProtectedFilesystem
/**
* Assign filesystem to use for non-public files
*
* @param Filesystem $filesystem
* @return $this
*/
public function setProtectedFilesystem(Filesystem $filesystem)
{
if (!$filesystem->getAdapter() instanceof ProtectedAdapter) {
throw new InvalidArgumentException("Configured adapter must implement ProtectedAdapter");
}
$this->protectedFilesystem = $filesystem;
return $this;
}
示例4: makeZip
/**
* @param Filesystem $filesystem
*/
public static function makeZip(Filesystem $filesystem)
{
$zip = $filesystem->getAdapter();
if (is_a($zip, 'ZipArchiveAdapter')) {
$zip->getArchive()->close();
}
}
示例5: archive_backup
function archive_backup($config, $files)
{
info(__FUNCTION__ . ' start...<br />');
$fs = new Filesystem(new ZipArchiveAdapter($config['archive']['target']));
foreach ($files as $remote => $file) {
// info(sprintf('put: %s to %s<br />', $file, $remote));
try {
$fp = fopen($file, 'r+');
$fs->putStream($remote, $fp);
fclose($fp);
} catch (Exception $e) {
info('<span class="color:red">error: ' . $e->getMessage() . '</span>');
info('<span class="color:red">file: ' . $file . '</span>');
}
}
$fs->getAdapter()->getArchive()->close();
info(__FUNCTION__ . ' finished...<br />');
}
示例6: let
function let(InvalidItemsCollector $collector, CsvWriter $writer, Filesystem $filesystem, LocalAdapter $adapter)
{
$filesystem->getAdapter()->willReturn($adapter);
$adapter->getPathPrefix()->willReturn(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'archivist/');
$this->beConstructedWith($collector, $writer, $filesystem, '/root');
}
示例7: getPathPrefix
/**
* Get base path.
*
* @return string
*/
public function getPathPrefix()
{
return $this->filesystem->getAdapter()->getPathPrefix();
}
示例8: flushZipArchive
/**
* Close and reopen a zip archive, forcing writing to disk
*
* @param \League\Flysystem\Filesystem $filesystem
*/
protected static function flushZipArchive(Filesystem $filesystem)
{
$_adapter = $filesystem->getAdapter();
if ($_adapter instanceof ZipArchiveAdapter) {
$_filename = $_adapter->getArchive()->filename;
$_adapter->getArchive()->close();
$_adapter->openArchive($_filename);
}
}
示例9: size
/**
* {@inheritdoc}
*/
public function size(Filesystem $filesystem)
{
/** @var ReadonlyAdapter $firstAdapter */
$firstAdapter = $filesystem->getAdapter();
/** @var ZipArchiveAdapter $adapter */
$adapter = $firstAdapter->getAdapter();
return filesize($adapter->getArchive()->filename);
}
示例10: let
function let(ZipFilesystemFactory $factory, Filesystem $filesystem, LocalAdapter $adapter, JobRegistry $jobRegistry)
{
$filesystem->getAdapter()->willReturn($adapter);
$adapter->getPathPrefix()->willReturn(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'archivist');
$this->beConstructedWith($factory, $filesystem, $jobRegistry);
}
示例11: getDirectory
/**
* @return string
*/
public function getDirectory()
{
/** @var AbstractAdapter $adapter */
$adapter = $this->filesystem->getAdapter();
return $adapter->getPathPrefix();
}
示例12: testGetAdapter
public function testGetAdapter()
{
$this->assertEquals($this->adapter, $this->filesystem->getAdapter());
}