Updates
This commit is contained in:
@@ -6,7 +6,6 @@ use DateTime;
|
||||
use League\Flysystem\AdapterInterface;
|
||||
use League\Flysystem\Config;
|
||||
use League\Flysystem\NotSupportedException;
|
||||
use League\Flysystem\SafeStorage;
|
||||
use RuntimeException;
|
||||
|
||||
abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
@@ -26,6 +25,16 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
*/
|
||||
protected $port = 21;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $username;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
@@ -76,11 +85,6 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
*/
|
||||
protected $alternativeRecursion = false;
|
||||
|
||||
/**
|
||||
* @var SafeStorage
|
||||
*/
|
||||
protected $safeStorage;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -88,7 +92,6 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
*/
|
||||
public function __construct(array $config)
|
||||
{
|
||||
$this->safeStorage = new SafeStorage();
|
||||
$this->setConfig($config);
|
||||
}
|
||||
|
||||
@@ -223,7 +226,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->safeStorage->retrieveSafely('username') ?: 'anonymous';
|
||||
return empty($this->username) ? 'anonymous' : $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,7 +238,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->safeStorage->storeSafely('username', $username);
|
||||
$this->username = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -247,7 +250,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->safeStorage->retrieveSafely('password');
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -259,7 +262,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->safeStorage->storeSafely('password', $password);
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
12
vendor/league/flysystem/src/Adapter/Local.php
vendored
12
vendor/league/flysystem/src/Adapter/Local.php
vendored
@@ -73,13 +73,13 @@ class Local extends AbstractAdapter
|
||||
{
|
||||
$root = is_link($root) ? realpath($root) : $root;
|
||||
$this->permissionMap = array_replace_recursive(static::$permissions, $permissions);
|
||||
$this->ensureDirectory($root);
|
||||
$realRoot = $this->ensureDirectory($root);
|
||||
|
||||
if ( ! is_dir($root) || ! is_readable($root)) {
|
||||
if ( ! is_dir($realRoot) || ! is_readable($realRoot)) {
|
||||
throw new LogicException('The root path ' . $root . ' is not readable.');
|
||||
}
|
||||
|
||||
$this->setPathPrefix($root);
|
||||
$this->setPathPrefix($realRoot);
|
||||
$this->writeFlags = $writeFlags;
|
||||
$this->linkHandling = $linkHandling;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class Local extends AbstractAdapter
|
||||
*
|
||||
* @param string $root root directory path
|
||||
*
|
||||
* @return void
|
||||
* @return string real path to root
|
||||
*
|
||||
* @throws Exception in case the root directory can not be created
|
||||
*/
|
||||
@@ -104,6 +104,8 @@ class Local extends AbstractAdapter
|
||||
throw new Exception(sprintf('Impossible to create the root directory "%s".', $root));
|
||||
}
|
||||
}
|
||||
|
||||
return realpath($root);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,7 +258,7 @@ class Local extends AbstractAdapter
|
||||
public function listContents($directory = '', $recursive = false)
|
||||
{
|
||||
$result = [];
|
||||
$location = $this->applyPathPrefix($directory);
|
||||
$location = $this->applyPathPrefix($directory) . $this->pathSeparator;
|
||||
|
||||
if ( ! is_dir($location)) {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user