From 6845016d8e809a2fdb9293be79e34417ccb9b1f0 Mon Sep 17 00:00:00 2001 From: Anyon Date: Fri, 2 Jun 2017 14:19:58 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]Composer=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/autoload.php | 2 +- vendor/composer/ClassLoader.php | 46 +++++++++++++++---- vendor/composer/LICENSE | 2 +- vendor/composer/autoload_real.php | 16 +++---- vendor/composer/autoload_static.php | 8 ++-- vendor/composer/installed.json | 46 +++++++++---------- vendor/symfony/options-resolver/composer.json | 2 +- .../think-installer/src/ThinkFramework.php | 22 ++++----- 8 files changed, 87 insertions(+), 57 deletions(-) diff --git a/vendor/autoload.php b/vendor/autoload.php index e3140ce69..fa8ae7abf 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit59af68441ce8f025170b30378685dd2f::getLoader(); +return ComposerAutoloaderInit14c73d9b1e5753bdff3c064df55184de::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index ac67d302a..2c72175e7 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -55,6 +55,7 @@ class ClassLoader private $classMap = array(); private $classMapAuthoritative = false; private $missingClasses = array(); + private $apcuPrefix; public function getPrefixes() { @@ -271,6 +272,26 @@ class ClassLoader return $this->classMapAuthoritative; } + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + /** * Registers this instance as an autoloader. * @@ -313,11 +334,6 @@ class ClassLoader */ public function findFile($class) { - // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - // class map lookup if (isset($this->classMap[$class])) { return $this->classMap[$class]; @@ -325,6 +341,12 @@ class ClassLoader if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { return false; } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } $file = $this->findFileWithExtension($class, '.php'); @@ -333,6 +355,10 @@ class ClassLoader $file = $this->findFileWithExtension($class, '.hh'); } + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + if (false === $file) { // Remember that this class does not exist. $this->missingClasses[$class] = true; @@ -348,9 +374,13 @@ class ClassLoader $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + foreach ($this->prefixDirsPsr4[$search] as $dir) { + $length = $this->prefixLengthsPsr4[$first][$search]; if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index 1a2812488..f27399a04 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2016 Nils Adermann, Jordi Boggiano +Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index f5c374a46..22f2ff81c 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit59af68441ce8f025170b30378685dd2f +class ComposerAutoloaderInit14c73d9b1e5753bdff3c064df55184de { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit59af68441ce8f025170b30378685dd2f return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit59af68441ce8f025170b30378685dd2f', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit14c73d9b1e5753bdff3c064df55184de', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit59af68441ce8f025170b30378685dd2f', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit14c73d9b1e5753bdff3c064df55184de', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit59af68441ce8f025170b30378685dd2f::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit14c73d9b1e5753bdff3c064df55184de::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit59af68441ce8f025170b30378685dd2f $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit59af68441ce8f025170b30378685dd2f::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit14c73d9b1e5753bdff3c064df55184de::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire59af68441ce8f025170b30378685dd2f($fileIdentifier, $file); + composerRequire14c73d9b1e5753bdff3c064df55184de($fileIdentifier, $file); } return $loader; } } -function composerRequire59af68441ce8f025170b30378685dd2f($fileIdentifier, $file) +function composerRequire14c73d9b1e5753bdff3c064df55184de($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 31d8b303a..a42f8d3c0 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit59af68441ce8f025170b30378685dd2f +class ComposerStaticInit14c73d9b1e5753bdff3c064df55184de { public static $files = array ( '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', @@ -383,9 +383,9 @@ class ComposerStaticInit59af68441ce8f025170b30378685dd2f public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit59af68441ce8f025170b30378685dd2f::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit59af68441ce8f025170b30378685dd2f::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit59af68441ce8f025170b30378685dd2f::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit14c73d9b1e5753bdff3c064df55184de::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit14c73d9b1e5753bdff3c064df55184de::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit14c73d9b1e5753bdff3c064df55184de::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 5a77b13e1..ff9eca6f3 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,17 +1,17 @@ [ { "name": "topthink/think-installer", - "version": "v1.0.11", - "version_normalized": "1.0.11.0", + "version": "v1.0.12", + "version_normalized": "1.0.12.0", "source": { "type": "git", "url": "https://github.com/top-think/think-installer.git", - "reference": "4c6e1ebecd1afce3f4ccc47e147d61bbe1bf641d" + "reference": "1be326e68f63de4e95977ed50f46ae75f017556d" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/top-think/think-installer/4c6e1ebecd1afce3f4ccc47e147d61bbe1bf641d.zip", - "reference": "4c6e1ebecd1afce3f4ccc47e147d61bbe1bf641d", + "url": "https://files.phpcomposer.com/files/top-think/think-installer/1be326e68f63de4e95977ed50f46ae75f017556d.zip", + "reference": "1be326e68f63de4e95977ed50f46ae75f017556d", "shasum": "" }, "require": { @@ -20,7 +20,7 @@ "require-dev": { "composer/composer": "1.0.*@dev" }, - "time": "2016-12-01 09:08:45", + "time": "2017-05-27T06:58:09+00:00", "type": "composer-plugin", "extra": { "class": "think\\composer\\Plugin" @@ -60,7 +60,7 @@ "require": { "php": ">=5.3.3" }, - "time": "2017-05-10 07:41:59", + "time": "2017-05-10T07:41:59+00:00", "type": "project", "installation-source": "dist", "autoload": { @@ -100,7 +100,7 @@ "phpunit/phpunit": "~4.0", "squizlabs/php_codesniffer": "~2.3" }, - "time": "2016-11-18 02:57:31", + "time": "2016-11-18T02:57:31+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -149,7 +149,7 @@ "require": { "php": ">=5.3.3" }, - "time": "2017-03-22 10:03:27", + "time": "2017-03-22T10:03:27+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -194,7 +194,7 @@ "phpunit/phpunit": "4.8.*", "sebastian/phpcpd": "2.*" }, - "time": "2017-05-20 10:43:04", + "time": "2017-05-20T10:43:04+00:00", "type": "think-framework", "installation-source": "dist", "autoload": { @@ -235,7 +235,7 @@ "reference": "0c55455df26a1626a60d0dc35d2d89002b741d44", "shasum": "" }, - "time": "2016-07-06 01:47:11", + "time": "2016-07-06T01:47:11+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -273,7 +273,7 @@ "reference": "fc552c8fe5798679a52f4f0d7e60763f64aeb155", "shasum": "" }, - "time": "2017-05-05 07:52:33", + "time": "2017-05-05T07:52:33+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -309,7 +309,7 @@ "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f", "shasum": "" }, - "time": "2017-04-05 07:15:37", + "time": "2017-04-05T07:15:37+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -351,7 +351,7 @@ "topthink/think-helper": ">=1.0.4", "topthink/think-installer": ">=1.0.10" }, - "time": "2017-02-28 08:07:37", + "time": "2017-02-28T08:07:37+00:00", "type": "think-extend", "extra": { "think-config": { @@ -381,27 +381,27 @@ }, { "name": "symfony/options-resolver", - "version": "v3.2.8", - "version_normalized": "3.2.8.0", + "version": "v3.3.0", + "version_normalized": "3.3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "8cbb4f23414e2a5e92690cf67680a979a461113c" + "reference": "ff48982d295bcac1fd861f934f041ebc73ae40f0" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/symfony/options-resolver/8cbb4f23414e2a5e92690cf67680a979a461113c.zip", - "reference": "8cbb4f23414e2a5e92690cf67680a979a461113c", + "url": "https://files.phpcomposer.com/files/symfony/options-resolver/ff48982d295bcac1fd861f934f041ebc73ae40f0.zip", + "reference": "ff48982d295bcac1fd861f934f041ebc73ae40f0", "shasum": "" }, "require": { "php": ">=5.5.9" }, - "time": "2017-04-12 14:13:17", + "time": "2017-04-12T14:14:56+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "installation-source": "dist", @@ -462,7 +462,7 @@ "symfony/framework-bundle": "^2.3|^3.0", "symfony/http-kernel": "^2.3|^3.0" }, - "time": "2017-04-08 09:13:59", + "time": "2017-04-08T09:13:59+00:00", "type": "library", "extra": { "branch-alias": { @@ -519,7 +519,7 @@ "phpunit/phpunit": "~4.0", "satooshi/php-coveralls": "~1.0" }, - "time": "2017-04-25 09:15:12", + "time": "2017-04-25T09:15:12+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/symfony/options-resolver/composer.json b/vendor/symfony/options-resolver/composer.json index 28cb1d7bd..a751730af 100644 --- a/vendor/symfony/options-resolver/composer.json +++ b/vendor/symfony/options-resolver/composer.json @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } } } diff --git a/vendor/topthink/think-installer/src/ThinkFramework.php b/vendor/topthink/think-installer/src/ThinkFramework.php index 7c3deaa79..cdb7d8434 100644 --- a/vendor/topthink/think-installer/src/ThinkFramework.php +++ b/vendor/topthink/think-installer/src/ThinkFramework.php @@ -2,12 +2,21 @@ namespace think\composer; -use Composer\Package\PackageInterface; use Composer\Installer\LibraryInstaller; +use Composer\Package\PackageInterface; use Composer\Repository\InstalledRepositoryInterface; class ThinkFramework extends LibraryInstaller { + public function install(InstalledRepositoryInterface $repo, PackageInterface $package) + { + parent::install($repo, $package); + if ($this->composer->getPackage()->getType() == 'project' && $package->getInstallationSource() != 'source') { + //remove tests dir + $this->filesystem->removeDirectory($this->getInstallPath($package) . DIRECTORY_SEPARATOR . 'tests'); + } + } + /** * {@inheritDoc} */ @@ -31,19 +40,10 @@ class ThinkFramework extends LibraryInstaller return 'thinkphp'; } - public function install(InstalledRepositoryInterface $repo, PackageInterface $package) - { - parent::install($repo, $package); - if ($this->composer->getPackage()->getType() == 'project') { - //remove tests dir - $this->filesystem->removeDirectory($this->getInstallPath($package) . DIRECTORY_SEPARATOR . 'tests'); - } - } - public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target) { parent::update($repo, $initial, $target); - if ($this->composer->getPackage()->getType() == 'project') { + if ($this->composer->getPackage()->getType() == 'project' && $target->getInstallationSource() != 'source') { //remove tests dir $this->filesystem->removeDirectory($this->getInstallPath($target) . DIRECTORY_SEPARATOR . 'tests'); }