Update v1.0.6.5

This commit is contained in:
sujitprasad
2016-03-02 12:25:21 +05:30
parent 7011553462
commit c56ff86194
218 changed files with 17161 additions and 2358 deletions

View File

@@ -1,4 +1,4 @@
Copyright (c) 2013-2015 Frank de Jonge
Copyright (c) 2013-2016 Frank de Jonge
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -18,10 +18,9 @@
},
"require-dev": {
"ext-fileinfo": "*",
"phpunit/phpunit": "~4.8",
"phpunit/phpunit": "~4.8 || ~5.0",
"mockery/mockery": "~0.9",
"phpspec/phpspec": "^2.2",
"phpspec/prophecy-phpunit": "~1.0"
"phpspec/phpspec": "^2.2"
},
"autoload": {
"psr-4": {

View File

@@ -305,8 +305,8 @@ class Ftp extends AbstractFtpAdapter
protected function createActualDirectory($directory, $connection)
{
// List the current directory
$listing = ftp_nlist($connection, '.');
$listing = ftp_nlist($connection, '.') ?: [];
foreach ($listing as $key => $item) {
if (preg_match('~^\./.*~', $item)) {
$listing[$key] = substr($item, 2);
@@ -337,7 +337,7 @@ class Ftp extends AbstractFtpAdapter
return ['type' => 'dir', 'path' => $path];
}
$listing = ftp_rawlist($connection, str_replace('*', '\\*', $path));
$listing = ftp_rawlist($connection, '-A ' . str_replace('*', '\\*', $path));
if (empty($listing)) {
return false;

View File

@@ -29,7 +29,7 @@ class NullAdapter extends AbstractAdapter
public function write($path, $contents, Config $config)
{
$type = 'file';
$result = compact('contents', 'type', 'size', 'path');
$result = compact('contents', 'type', 'path');
if ($visibility = $config->get('visibility')) {
$result['visibility'] = $visibility;

View File

@@ -31,11 +31,7 @@ class Util
*/
public static function normalizeDirname($dirname)
{
if ($dirname === '.') {
return '';
}
return $dirname;
return $dirname === '.' ? '' : $dirname;
}
/**
@@ -159,7 +155,7 @@ class Util
{
$mimeType = MimeType::detectByContent($content);
if (empty($mimeType) || in_array($mimeType, ['text/plain', 'application/x-empty'])) {
if (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm'])) {
$extension = pathinfo($path, PATHINFO_EXTENSION);
if ($extension) {

View File

@@ -22,10 +22,7 @@ class MimeType
return;
}
$finfo = new Finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->buffer($content);
return $mimeType ?: null;
return (new Finfo(FILEINFO_MIME_TYPE))->buffer($content) ?: null;
}
/**
@@ -124,6 +121,7 @@ class MimeType
'bmp' => 'image/bmp',
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'svg' => 'image/svg+xml',
'css' => 'text/css',
'html' => 'text/html',
'htm' => 'text/html',

View File

@@ -0,0 +1,36 @@
<?php
namespace League\Flysystem\Util;
class StreamHasher
{
/**
* @var string
*/
private $algo;
/**
* StreamHasher constructor.
*
* @param string $algo
*/
public function __construct($algo)
{
$this->algo = $algo;
}
/**
* @param $resource
*
* @return string
*/
public function hash($resource)
{
rewind($resource);
$context = hash_init($this->algo);
hash_update_stream($context, $resource);
fclose($resource);
return hash_final($context);
}
}