composer update
This commit is contained in:
16
vendor/league/flysystem/SECURITY.md
vendored
Normal file
16
vendor/league/flysystem/SECURITY.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.0.x | :white_check_mark: |
|
||||
| 2.0.x | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
When you've encountered a security vulnerability, please disclose it securely.
|
||||
|
||||
The security process is described at:
|
||||
[https://flysystem.thephpleague.com/docs/security/](https://flysystem.thephpleague.com/docs/security/)
|
||||
|
||||
9
vendor/league/flysystem/composer.json
vendored
9
vendor/league/flysystem/composer.json
vendored
@@ -1,11 +1,18 @@
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"type": "library",
|
||||
"description": "Filesystem abstraction: Many filesystems, one API.",
|
||||
"keywords": [
|
||||
"filesystem", "filesystems", "files", "storage", "dropbox", "aws",
|
||||
"abstraction", "s3", "ftp", "sftp", "remote", "webdav",
|
||||
"file systems", "cloud", "cloud files", "rackspace", "copy.com"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"type": "other",
|
||||
"url": "https://offset.earth/frankdejonge"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
@@ -19,7 +26,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "^3.4",
|
||||
"phpunit/phpunit": "^5.7.10"
|
||||
"phpunit/phpunit": "^5.7.26"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -557,6 +557,10 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
|
||||
*/
|
||||
protected function normalizePermissions($permissions)
|
||||
{
|
||||
if (is_numeric($permissions)) {
|
||||
return ((int) $permissions) & 0777;
|
||||
}
|
||||
|
||||
// remove the type identifier
|
||||
$permissions = substr($permissions, 1);
|
||||
|
||||
|
||||
44
vendor/league/flysystem/src/Adapter/Ftp.php
vendored
44
vendor/league/flysystem/src/Adapter/Ftp.php
vendored
@@ -6,9 +6,11 @@ use ErrorException;
|
||||
use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait;
|
||||
use League\Flysystem\AdapterInterface;
|
||||
use League\Flysystem\Config;
|
||||
use League\Flysystem\ConnectionErrorException;
|
||||
use League\Flysystem\ConnectionRuntimeException;
|
||||
use League\Flysystem\InvalidRootException;
|
||||
use League\Flysystem\Util;
|
||||
use League\Flysystem\Util\MimeType;
|
||||
use RuntimeException;
|
||||
|
||||
class Ftp extends AbstractFtpAdapter
|
||||
{
|
||||
@@ -129,13 +131,13 @@ class Ftp extends AbstractFtpAdapter
|
||||
public function connect()
|
||||
{
|
||||
if ($this->ssl) {
|
||||
$this->connection = ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout());
|
||||
$this->connection = @ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout());
|
||||
} else {
|
||||
$this->connection = ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout());
|
||||
$this->connection = @ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout());
|
||||
}
|
||||
|
||||
if ( ! $this->connection) {
|
||||
throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort());
|
||||
throw new ConnectionRuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort());
|
||||
}
|
||||
|
||||
$this->login();
|
||||
@@ -153,7 +155,7 @@ class Ftp extends AbstractFtpAdapter
|
||||
if ($this->utf8) {
|
||||
$response = ftp_raw($this->connection, "OPTS UTF8 ON");
|
||||
if (substr($response[0], 0, 3) !== '200') {
|
||||
throw new RuntimeException(
|
||||
throw new ConnectionRuntimeException(
|
||||
'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort()
|
||||
);
|
||||
}
|
||||
@@ -163,7 +165,7 @@ class Ftp extends AbstractFtpAdapter
|
||||
/**
|
||||
* Set the connections to passive mode.
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws ConnectionRuntimeException
|
||||
*/
|
||||
protected function setConnectionPassiveMode()
|
||||
{
|
||||
@@ -172,7 +174,7 @@ class Ftp extends AbstractFtpAdapter
|
||||
}
|
||||
|
||||
if ( ! ftp_pasv($this->connection, $this->passive)) {
|
||||
throw new RuntimeException(
|
||||
throw new ConnectionRuntimeException(
|
||||
'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort()
|
||||
);
|
||||
}
|
||||
@@ -187,7 +189,7 @@ class Ftp extends AbstractFtpAdapter
|
||||
$connection = $this->connection;
|
||||
|
||||
if ($root && ! ftp_chdir($connection, $root)) {
|
||||
throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot());
|
||||
throw new InvalidRootException('Root is invalid or does not exist: ' . $this->getRoot());
|
||||
}
|
||||
|
||||
// Store absolute path for further reference.
|
||||
@@ -200,7 +202,7 @@ class Ftp extends AbstractFtpAdapter
|
||||
/**
|
||||
* Login.
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws ConnectionRuntimeException
|
||||
*/
|
||||
protected function login()
|
||||
{
|
||||
@@ -215,7 +217,7 @@ class Ftp extends AbstractFtpAdapter
|
||||
|
||||
if ( ! $isLoggedIn) {
|
||||
$this->disconnect();
|
||||
throw new RuntimeException(
|
||||
throw new ConnectionRuntimeException(
|
||||
'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort(
|
||||
) . ', username: ' . $this->getUsername()
|
||||
);
|
||||
@@ -228,7 +230,7 @@ class Ftp extends AbstractFtpAdapter
|
||||
public function disconnect()
|
||||
{
|
||||
if (is_resource($this->connection)) {
|
||||
ftp_close($this->connection);
|
||||
@ftp_close($this->connection);
|
||||
}
|
||||
|
||||
$this->connection = null;
|
||||
@@ -526,19 +528,12 @@ class Ftp extends AbstractFtpAdapter
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws ErrorException
|
||||
* @throws ConnectionErrorException
|
||||
*/
|
||||
public function isConnected()
|
||||
{
|
||||
try {
|
||||
return is_resource($this->connection) && ftp_rawlist($this->connection, $this->getRoot()) !== false;
|
||||
} catch (ErrorException $e) {
|
||||
if (strpos($e->getMessage(), 'ftp_rawlist') === false) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return is_resource($this->connection)
|
||||
&& $this->getRawExecResponseCode('NOOP') === 200;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,4 +564,11 @@ class Ftp extends AbstractFtpAdapter
|
||||
|
||||
return ftp_rawlist($connection, $options . ' ' . $path);
|
||||
}
|
||||
|
||||
private function getRawExecResponseCode($command)
|
||||
{
|
||||
$response = @ftp_raw($this->connection, trim($command));
|
||||
|
||||
return (int) preg_replace('/\D/', '', implode(' ', $response));
|
||||
}
|
||||
}
|
||||
|
||||
9
vendor/league/flysystem/src/ConnectionErrorException.php
vendored
Normal file
9
vendor/league/flysystem/src/ConnectionErrorException.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace League\Flysystem;
|
||||
|
||||
use ErrorException;
|
||||
|
||||
class ConnectionErrorException extends ErrorException implements FilesystemException
|
||||
{
|
||||
}
|
||||
9
vendor/league/flysystem/src/ConnectionRuntimeException.php
vendored
Normal file
9
vendor/league/flysystem/src/ConnectionRuntimeException.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace League\Flysystem;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class ConnectionRuntimeException extends RuntimeException implements FilesystemException
|
||||
{
|
||||
}
|
||||
2
vendor/league/flysystem/src/Exception.php
vendored
2
vendor/league/flysystem/src/Exception.php
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace League\Flysystem;
|
||||
|
||||
class Exception extends \Exception
|
||||
class Exception extends \Exception implements FilesystemException
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
7
vendor/league/flysystem/src/FilesystemException.php
vendored
Normal file
7
vendor/league/flysystem/src/FilesystemException.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace League\Flysystem;
|
||||
|
||||
interface FilesystemException
|
||||
{
|
||||
}
|
||||
@@ -7,6 +7,6 @@ use LogicException;
|
||||
/**
|
||||
* Thrown when the MountManager cannot find a filesystem.
|
||||
*/
|
||||
class FilesystemNotFoundException extends LogicException
|
||||
class FilesystemNotFoundException extends LogicException implements FilesystemException
|
||||
{
|
||||
}
|
||||
|
||||
9
vendor/league/flysystem/src/InvalidRootException.php
vendored
Normal file
9
vendor/league/flysystem/src/InvalidRootException.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace League\Flysystem;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class InvalidRootException extends RuntimeException implements FilesystemException
|
||||
{
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace League\Flysystem;
|
||||
use RuntimeException;
|
||||
use SplFileInfo;
|
||||
|
||||
class NotSupportedException extends RuntimeException
|
||||
class NotSupportedException extends RuntimeException implements FilesystemException
|
||||
{
|
||||
/**
|
||||
* Create a new exception for a link.
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace League\Flysystem;
|
||||
|
||||
use LogicException;
|
||||
|
||||
class RootViolationException extends LogicException
|
||||
class RootViolationException extends LogicException implements FilesystemException
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
6
vendor/league/flysystem/src/Util.php
vendored
6
vendor/league/flysystem/src/Util.php
vendored
@@ -267,12 +267,16 @@ class Util
|
||||
*
|
||||
* @param resource $resource
|
||||
*
|
||||
* @return int stream size
|
||||
* @return int|null stream size
|
||||
*/
|
||||
public static function getStreamSize($resource)
|
||||
{
|
||||
$stat = fstat($resource);
|
||||
|
||||
if ( ! is_array($stat) || ! isset($stat['size'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $stat['size'];
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,8 @@ class MimeType
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => 'text/plain',
|
||||
'markdown' => 'text/markdown',
|
||||
'md' => 'text/markdown',
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => 'application/xml',
|
||||
@@ -185,6 +187,7 @@ class MimeType
|
||||
'odm' => 'application/vnd.oasis.opendocument.text-master',
|
||||
'odb' => 'application/vnd.oasis.opendocument.database',
|
||||
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
||||
'webp' => 'image/webp',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user