composer-update-patch

This commit is contained in:
Manish Verma
2016-11-03 05:44:29 +05:30
parent 2dca47f5a4
commit 5d49d384a0
5118 changed files with 51603 additions and 122575 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer
php -r "unlink('composer-setup.php');"
rm composer-setup.php

View File

@@ -14,7 +14,7 @@
}
],
"require": {
"php": ">=5.4.0"
"php": ">=5.5.9"
},
"require-dev": {
"ext-fileinfo": "*",

View File

@@ -6,6 +6,7 @@ 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
@@ -25,16 +26,6 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
*/
protected $port = 21;
/**
* @var string|null
*/
protected $username;
/**
* @var string|null
*/
protected $password;
/**
* @var bool
*/
@@ -85,6 +76,11 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
*/
protected $alternativeRecursion = false;
/**
* @var SafeStorage
*/
protected $safeStorage;
/**
* Constructor.
*
@@ -92,6 +88,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
*/
public function __construct(array $config)
{
$this->safeStorage = new SafeStorage();
$this->setConfig($config);
}
@@ -226,7 +223,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
*/
public function getUsername()
{
return empty($this->username) ? 'anonymous' : $this->username;
return $this->safeStorage->retrieveSafely('username') ?: 'anonymous';
}
/**
@@ -238,7 +235,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
*/
public function setUsername($username)
{
$this->username = $username;
$this->safeStorage->storeSafely('username', $username);
return $this;
}
@@ -250,7 +247,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
*/
public function getPassword()
{
return $this->password;
return $this->safeStorage->retrieveSafely('password');
}
/**
@@ -262,7 +259,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
*/
public function setPassword($password)
{
$this->password = $password;
$this->safeStorage->storeSafely('password', $password);
return $this;
}

View File

@@ -73,13 +73,13 @@ class Local extends AbstractAdapter
{
$root = is_link($root) ? realpath($root) : $root;
$this->permissionMap = array_replace_recursive(static::$permissions, $permissions);
$realRoot = $this->ensureDirectory($root);
$this->ensureDirectory($root);
if ( ! is_dir($realRoot) || ! is_readable($realRoot)) {
if ( ! is_dir($root) || ! is_readable($root)) {
throw new LogicException('The root path ' . $root . ' is not readable.');
}
$this->setPathPrefix($realRoot);
$this->setPathPrefix($root);
$this->writeFlags = $writeFlags;
$this->linkHandling = $linkHandling;
}
@@ -89,7 +89,7 @@ class Local extends AbstractAdapter
*
* @param string $root root directory path
*
* @return string real path to root
* @return void
*
* @throws Exception in case the root directory can not be created
*/
@@ -104,8 +104,6 @@ class Local extends AbstractAdapter
throw new Exception(sprintf('Impossible to create the root directory "%s".', $root));
}
}
return realpath($root);
}
/**
@@ -258,7 +256,7 @@ class Local extends AbstractAdapter
public function listContents($directory = '', $recursive = false)
{
$result = [];
$location = $this->applyPathPrefix($directory) . $this->pathSeparator;
$location = $this->applyPathPrefix($directory);
if ( ! is_dir($location)) {
return [];

View File

@@ -50,7 +50,13 @@ class Config
*/
public function has($key)
{
return array_key_exists($key, $this->settings);
if (array_key_exists($key, $this->settings)) {
return true;
}
return $this->fallback instanceof Config
? $this->fallback->has($key)
: false;
}
/**

View File

@@ -0,0 +1,39 @@
<?php
namespace League\Flysystem;
final class SafeStorage
{
/**
* @var string
*/
private $hash;
/**
* @var array
*/
protected static $safeStorage = [];
public function __construct()
{
$this->hash = spl_object_hash($this);
static::$safeStorage[$this->hash] = [];
}
public function storeSafely($key, $value)
{
static::$safeStorage[$this->hash][$key] = $value;
}
public function retrieveSafely($key)
{
if (array_key_exists($key, static::$safeStorage[$this->hash])) {
return static::$safeStorage[$this->hash][$key];
}
}
public function __destruct()
{
unset(static::$safeStorage[$this->hash]);
}
}

View File

@@ -85,7 +85,7 @@ class Util
$normalized = preg_replace('#\p{C}+|^\./#u', '', $path);
$normalized = static::normalizeRelativePath($normalized);
if (preg_match('#/\.{2}|^\.{2}/|^\.{2}$#', $normalized)) {
if (preg_match('#(^|/)\.{2}(/|$)#', $normalized)) {
throw new LogicException(
'Path is outside of the defined root, path: [' . $path . '], resolved: [' . $normalized . ']'
);
@@ -110,7 +110,7 @@ class Util
$path = preg_replace('#/\.(?=/)|^\./|(/|^)\./?$#', '', $path);
// Regex for resolving relative paths
$regex = '#/*[^/\.]+/\.\.#Uu';
$regex = '#/*[^/\.]+/\.\.(?=/|$)#Uu';
while (preg_match($regex, $path)) {
$path = preg_replace($regex, '', $path);