Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
232
admin/phpMyAdmin/vendor/symfony/config/Resource/ClassExistenceResource.php
vendored
Normal file
232
admin/phpMyAdmin/vendor/symfony/config/Resource/ClassExistenceResource.php
vendored
Normal file
|
@ -0,0 +1,232 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
/**
|
||||
* ClassExistenceResource represents a class existence.
|
||||
* Freshness is only evaluated against resource existence.
|
||||
*
|
||||
* The resource must be a fully-qualified class name.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class ClassExistenceResource implements SelfCheckingResourceInterface
|
||||
{
|
||||
private $resource;
|
||||
private $exists;
|
||||
|
||||
private static $autoloadLevel = 0;
|
||||
private static $autoloadedClass;
|
||||
private static $existsCache = [];
|
||||
|
||||
/**
|
||||
* @param string $resource The fully-qualified class name
|
||||
* @param bool|null $exists Boolean when the existency check has already been done
|
||||
*/
|
||||
public function __construct(string $resource, bool $exists = null)
|
||||
{
|
||||
$this->resource = $resource;
|
||||
if (null !== $exists) {
|
||||
$this->exists = [$exists, null];
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
public function getResource(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws \ReflectionException when a parent class/interface/trait is not found
|
||||
*/
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
$loaded = class_exists($this->resource, false) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
|
||||
|
||||
if (null !== $exists = &self::$existsCache[$this->resource]) {
|
||||
if ($loaded) {
|
||||
$exists = [true, null];
|
||||
} elseif (0 >= $timestamp && !$exists[0] && null !== $exists[1]) {
|
||||
throw new \ReflectionException($exists[1]);
|
||||
}
|
||||
} elseif ([false, null] === $exists = [$loaded, null]) {
|
||||
if (!self::$autoloadLevel++) {
|
||||
spl_autoload_register(__CLASS__.'::throwOnRequiredClass');
|
||||
}
|
||||
$autoloadedClass = self::$autoloadedClass;
|
||||
self::$autoloadedClass = ltrim($this->resource, '\\');
|
||||
|
||||
try {
|
||||
$exists[0] = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
|
||||
} catch (\Exception $e) {
|
||||
$exists[1] = $e->getMessage();
|
||||
|
||||
try {
|
||||
self::throwOnRequiredClass($this->resource, $e);
|
||||
} catch (\ReflectionException $e) {
|
||||
if (0 >= $timestamp) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$exists[1] = $e->getMessage();
|
||||
|
||||
throw $e;
|
||||
} finally {
|
||||
self::$autoloadedClass = $autoloadedClass;
|
||||
if (!--self::$autoloadLevel) {
|
||||
spl_autoload_unregister(__CLASS__.'::throwOnRequiredClass');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null === $this->exists) {
|
||||
$this->exists = $exists;
|
||||
}
|
||||
|
||||
return $this->exists[0] xor !$exists[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep(): array
|
||||
{
|
||||
if (null === $this->exists) {
|
||||
$this->isFresh(0);
|
||||
}
|
||||
|
||||
return ['resource', 'exists'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
if (\is_bool($this->exists)) {
|
||||
$this->exists = [$this->exists, null];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws a reflection exception when the passed class does not exist but is required.
|
||||
*
|
||||
* A class is considered "not required" when it's loaded as part of a "class_exists" or similar check.
|
||||
*
|
||||
* This function can be used as an autoload function to throw a reflection
|
||||
* exception if the class was not found by previous autoload functions.
|
||||
*
|
||||
* A previous exception can be passed. In this case, the class is considered as being
|
||||
* required totally, so if it doesn't exist, a reflection exception is always thrown.
|
||||
* If it exists, the previous exception is rethrown.
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function throwOnRequiredClass(string $class, \Exception $previous = null)
|
||||
{
|
||||
// If the passed class is the resource being checked, we shouldn't throw.
|
||||
if (null === $previous && self::$autoloadedClass === $class) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) {
|
||||
if (null !== $previous) {
|
||||
throw $previous;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($previous instanceof \ReflectionException) {
|
||||
throw $previous;
|
||||
}
|
||||
|
||||
$message = sprintf('Class "%s" not found.', $class);
|
||||
|
||||
if (self::$autoloadedClass !== $class) {
|
||||
$message = substr_replace($message, sprintf(' while loading "%s"', self::$autoloadedClass), -1, 0);
|
||||
}
|
||||
|
||||
if (null !== $previous) {
|
||||
$message = $previous->getMessage();
|
||||
}
|
||||
|
||||
$e = new \ReflectionException($message, 0, $previous);
|
||||
|
||||
if (null !== $previous) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$trace = debug_backtrace();
|
||||
$autoloadFrame = [
|
||||
'function' => 'spl_autoload_call',
|
||||
'args' => [$class],
|
||||
];
|
||||
|
||||
if (\PHP_VERSION_ID >= 80000 && isset($trace[1])) {
|
||||
$callerFrame = $trace[1];
|
||||
$i = 2;
|
||||
} elseif (false !== $i = array_search($autoloadFrame, $trace, true)) {
|
||||
$callerFrame = $trace[++$i];
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (isset($callerFrame['function']) && !isset($callerFrame['class'])) {
|
||||
switch ($callerFrame['function']) {
|
||||
case 'get_class_methods':
|
||||
case 'get_class_vars':
|
||||
case 'get_parent_class':
|
||||
case 'is_a':
|
||||
case 'is_subclass_of':
|
||||
case 'class_exists':
|
||||
case 'class_implements':
|
||||
case 'class_parents':
|
||||
case 'trait_exists':
|
||||
case 'defined':
|
||||
case 'interface_exists':
|
||||
case 'method_exists':
|
||||
case 'property_exists':
|
||||
case 'is_callable':
|
||||
return;
|
||||
}
|
||||
|
||||
$props = [
|
||||
'file' => $callerFrame['file'] ?? null,
|
||||
'line' => $callerFrame['line'] ?? null,
|
||||
'trace' => \array_slice($trace, 1 + $i),
|
||||
];
|
||||
|
||||
foreach ($props as $p => $v) {
|
||||
if (null !== $v) {
|
||||
$r = new \ReflectionProperty(\Exception::class, $p);
|
||||
$r->setAccessible(true);
|
||||
$r->setValue($e, $v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
67
admin/phpMyAdmin/vendor/symfony/config/Resource/ComposerResource.php
vendored
Normal file
67
admin/phpMyAdmin/vendor/symfony/config/Resource/ComposerResource.php
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
/**
|
||||
* ComposerResource tracks the PHP version and Composer dependencies.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class ComposerResource implements SelfCheckingResourceInterface
|
||||
{
|
||||
private $vendors;
|
||||
|
||||
private static $runtimeVendors;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
self::refresh();
|
||||
$this->vendors = self::$runtimeVendors;
|
||||
}
|
||||
|
||||
public function getVendors(): array
|
||||
{
|
||||
return array_keys($this->vendors);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return __CLASS__;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
self::refresh();
|
||||
|
||||
return array_values(self::$runtimeVendors) === array_values($this->vendors);
|
||||
}
|
||||
|
||||
private static function refresh()
|
||||
{
|
||||
self::$runtimeVendors = [];
|
||||
|
||||
foreach (get_declared_classes() as $class) {
|
||||
if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) {
|
||||
$r = new \ReflectionClass($class);
|
||||
$v = \dirname($r->getFileName(), 2);
|
||||
if (is_file($v.'/composer/installed.json')) {
|
||||
self::$runtimeVendors[$v] = @filemtime($v.'/composer/installed.json');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
97
admin/phpMyAdmin/vendor/symfony/config/Resource/DirectoryResource.php
vendored
Normal file
97
admin/phpMyAdmin/vendor/symfony/config/Resource/DirectoryResource.php
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
/**
|
||||
* DirectoryResource represents a resources stored in a subdirectory tree.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class DirectoryResource implements SelfCheckingResourceInterface
|
||||
{
|
||||
private $resource;
|
||||
private $pattern;
|
||||
|
||||
/**
|
||||
* @param string $resource The file path to the resource
|
||||
* @param string|null $pattern A pattern to restrict monitored files
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct(string $resource, string $pattern = null)
|
||||
{
|
||||
$this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false);
|
||||
$this->pattern = $pattern;
|
||||
|
||||
if (false === $this->resource || !is_dir($this->resource)) {
|
||||
throw new \InvalidArgumentException(sprintf('The directory "%s" does not exist.', $resource));
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return md5(serialize([$this->resource, $this->pattern]));
|
||||
}
|
||||
|
||||
public function getResource(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
public function getPattern(): ?string
|
||||
{
|
||||
return $this->pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
if (!is_dir($this->resource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($timestamp < filemtime($this->resource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) {
|
||||
// if regex filtering is enabled only check matching files
|
||||
if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// always monitor directories for changes, except the .. entries
|
||||
// (otherwise deleted files wouldn't get detected)
|
||||
if ($file->isDir() && str_ends_with($file, '/..')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// for broken links
|
||||
try {
|
||||
$fileMTime = $file->getMTime();
|
||||
} catch (\RuntimeException $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// early return if a file's mtime exceeds the passed timestamp
|
||||
if ($timestamp < $fileMTime) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
56
admin/phpMyAdmin/vendor/symfony/config/Resource/FileExistenceResource.php
vendored
Normal file
56
admin/phpMyAdmin/vendor/symfony/config/Resource/FileExistenceResource.php
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
/**
|
||||
* FileExistenceResource represents a resource stored on the filesystem.
|
||||
* Freshness is only evaluated against resource creation or deletion.
|
||||
*
|
||||
* The resource can be a file or a directory.
|
||||
*
|
||||
* @author Charles-Henri Bruyand <charleshenri.bruyand@gmail.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class FileExistenceResource implements SelfCheckingResourceInterface
|
||||
{
|
||||
private $resource;
|
||||
|
||||
private $exists;
|
||||
|
||||
/**
|
||||
* @param string $resource The file path to the resource
|
||||
*/
|
||||
public function __construct(string $resource)
|
||||
{
|
||||
$this->resource = $resource;
|
||||
$this->exists = file_exists($resource);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
public function getResource(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
return file_exists($this->resource) === $this->exists;
|
||||
}
|
||||
}
|
64
admin/phpMyAdmin/vendor/symfony/config/Resource/FileResource.php
vendored
Normal file
64
admin/phpMyAdmin/vendor/symfony/config/Resource/FileResource.php
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
/**
|
||||
* FileResource represents a resource stored on the filesystem.
|
||||
*
|
||||
* The resource can be a file or a directory.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class FileResource implements SelfCheckingResourceInterface
|
||||
{
|
||||
/**
|
||||
* @var string|false
|
||||
*/
|
||||
private $resource;
|
||||
|
||||
/**
|
||||
* @param string $resource The file path to the resource
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct(string $resource)
|
||||
{
|
||||
$this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false);
|
||||
|
||||
if (false === $this->resource) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $resource));
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the canonicalized, absolute path to the resource.
|
||||
*/
|
||||
public function getResource(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp;
|
||||
}
|
||||
}
|
246
admin/phpMyAdmin/vendor/symfony/config/Resource/GlobResource.php
vendored
Normal file
246
admin/phpMyAdmin/vendor/symfony/config/Resource/GlobResource.php
vendored
Normal file
|
@ -0,0 +1,246 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Finder\Glob;
|
||||
|
||||
/**
|
||||
* GlobResource represents a set of resources stored on the filesystem.
|
||||
*
|
||||
* Only existence/removal is tracked (not mtimes.)
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @final
|
||||
*
|
||||
* @implements \IteratorAggregate<string, \SplFileInfo>
|
||||
*/
|
||||
class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
||||
{
|
||||
private $prefix;
|
||||
private $pattern;
|
||||
private $recursive;
|
||||
private $hash;
|
||||
private $forExclusion;
|
||||
private $excludedPrefixes;
|
||||
private $globBrace;
|
||||
|
||||
/**
|
||||
* @param string $prefix A directory prefix
|
||||
* @param string $pattern A glob pattern
|
||||
* @param bool $recursive Whether directories should be scanned recursively or not
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct(string $prefix, string $pattern, bool $recursive, bool $forExclusion = false, array $excludedPrefixes = [])
|
||||
{
|
||||
ksort($excludedPrefixes);
|
||||
$this->prefix = realpath($prefix) ?: (file_exists($prefix) ? $prefix : false);
|
||||
$this->pattern = $pattern;
|
||||
$this->recursive = $recursive;
|
||||
$this->forExclusion = $forExclusion;
|
||||
$this->excludedPrefixes = $excludedPrefixes;
|
||||
$this->globBrace = \defined('GLOB_BRACE') ? \GLOB_BRACE : 0;
|
||||
|
||||
if (false === $this->prefix) {
|
||||
throw new \InvalidArgumentException(sprintf('The path "%s" does not exist.', $prefix));
|
||||
}
|
||||
}
|
||||
|
||||
public function getPrefix(): string
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'glob.'.$this->prefix.(int) $this->recursive.$this->pattern.(int) $this->forExclusion.implode("\0", $this->excludedPrefixes);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
$hash = $this->computeHash();
|
||||
|
||||
if (null === $this->hash) {
|
||||
$this->hash = $hash;
|
||||
}
|
||||
|
||||
return $this->hash === $hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep(): array
|
||||
{
|
||||
if (null === $this->hash) {
|
||||
$this->hash = $this->computeHash();
|
||||
}
|
||||
|
||||
return ['prefix', 'pattern', 'recursive', 'hash', 'forExclusion', 'excludedPrefixes'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __wakeup(): void
|
||||
{
|
||||
$this->globBrace = \defined('GLOB_BRACE') ? \GLOB_BRACE : 0;
|
||||
}
|
||||
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
if (!file_exists($this->prefix) || (!$this->recursive && '' === $this->pattern)) {
|
||||
return;
|
||||
}
|
||||
$prefix = str_replace('\\', '/', $this->prefix);
|
||||
$paths = null;
|
||||
|
||||
if ('' === $this->pattern && is_file($prefix)) {
|
||||
$paths = [$this->prefix];
|
||||
} elseif (!str_starts_with($this->prefix, 'phar://') && !str_contains($this->pattern, '/**/')) {
|
||||
if ($this->globBrace || !str_contains($this->pattern, '{')) {
|
||||
$paths = glob($this->prefix.$this->pattern, \GLOB_NOSORT | $this->globBrace);
|
||||
} elseif (!str_contains($this->pattern, '\\') || !preg_match('/\\\\[,{}]/', $this->pattern)) {
|
||||
foreach ($this->expandGlob($this->pattern) as $p) {
|
||||
$paths[] = glob($this->prefix.$p, \GLOB_NOSORT);
|
||||
}
|
||||
$paths = array_merge(...$paths);
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $paths) {
|
||||
natsort($paths);
|
||||
foreach ($paths as $path) {
|
||||
if ($this->excludedPrefixes) {
|
||||
$normalizedPath = str_replace('\\', '/', $path);
|
||||
do {
|
||||
if (isset($this->excludedPrefixes[$dirPath = $normalizedPath])) {
|
||||
continue 2;
|
||||
}
|
||||
} while ($prefix !== $dirPath && $dirPath !== $normalizedPath = \dirname($dirPath));
|
||||
}
|
||||
|
||||
if (is_file($path)) {
|
||||
yield $path => new \SplFileInfo($path);
|
||||
}
|
||||
if (!is_dir($path)) {
|
||||
continue;
|
||||
}
|
||||
if ($this->forExclusion) {
|
||||
yield $path => new \SplFileInfo($path);
|
||||
continue;
|
||||
}
|
||||
if (!$this->recursive || isset($this->excludedPrefixes[str_replace('\\', '/', $path)])) {
|
||||
continue;
|
||||
}
|
||||
$files = iterator_to_array(new \RecursiveIteratorIterator(
|
||||
new \RecursiveCallbackFilterIterator(
|
||||
new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS),
|
||||
function (\SplFileInfo $file, $path) {
|
||||
return !isset($this->excludedPrefixes[str_replace('\\', '/', $path)]) && '.' !== $file->getBasename()[0];
|
||||
}
|
||||
),
|
||||
\RecursiveIteratorIterator::LEAVES_ONLY
|
||||
));
|
||||
uksort($files, 'strnatcmp');
|
||||
|
||||
foreach ($files as $path => $info) {
|
||||
if ($info->isFile()) {
|
||||
yield $path => $info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!class_exists(Finder::class)) {
|
||||
throw new \LogicException(sprintf('Extended glob pattern "%s" cannot be used as the Finder component is not installed.', $this->pattern));
|
||||
}
|
||||
|
||||
if (is_file($prefix = $this->prefix)) {
|
||||
$prefix = \dirname($prefix);
|
||||
$pattern = basename($prefix).$this->pattern;
|
||||
} else {
|
||||
$pattern = $this->pattern;
|
||||
}
|
||||
|
||||
$finder = new Finder();
|
||||
$regex = Glob::toRegex($pattern);
|
||||
if ($this->recursive) {
|
||||
$regex = substr_replace($regex, '(/|$)', -2, 1);
|
||||
}
|
||||
|
||||
$prefixLen = \strlen($prefix);
|
||||
foreach ($finder->followLinks()->sortByName()->in($prefix) as $path => $info) {
|
||||
$normalizedPath = str_replace('\\', '/', $path);
|
||||
if (!preg_match($regex, substr($normalizedPath, $prefixLen)) || !$info->isFile()) {
|
||||
continue;
|
||||
}
|
||||
if ($this->excludedPrefixes) {
|
||||
do {
|
||||
if (isset($this->excludedPrefixes[$dirPath = $normalizedPath])) {
|
||||
continue 2;
|
||||
}
|
||||
} while ($prefix !== $dirPath && $dirPath !== $normalizedPath = \dirname($dirPath));
|
||||
}
|
||||
|
||||
yield $path => $info;
|
||||
}
|
||||
}
|
||||
|
||||
private function computeHash(): string
|
||||
{
|
||||
$hash = hash_init('md5');
|
||||
|
||||
foreach ($this->getIterator() as $path => $info) {
|
||||
hash_update($hash, $path."\n");
|
||||
}
|
||||
|
||||
return hash_final($hash);
|
||||
}
|
||||
|
||||
private function expandGlob(string $pattern): array
|
||||
{
|
||||
$segments = preg_split('/\{([^{}]*+)\}/', $pattern, -1, \PREG_SPLIT_DELIM_CAPTURE);
|
||||
$paths = [$segments[0]];
|
||||
$patterns = [];
|
||||
|
||||
for ($i = 1; $i < \count($segments); $i += 2) {
|
||||
$patterns = [];
|
||||
|
||||
foreach (explode(',', $segments[$i]) as $s) {
|
||||
foreach ($paths as $p) {
|
||||
$patterns[] = $p.$s.$segments[1 + $i];
|
||||
}
|
||||
}
|
||||
|
||||
$paths = $patterns;
|
||||
}
|
||||
|
||||
$j = 0;
|
||||
foreach ($patterns as $i => $p) {
|
||||
if (str_contains($p, '{')) {
|
||||
$p = $this->expandGlob($p);
|
||||
array_splice($paths, $i + $j, 1, $p);
|
||||
$j += \count($p) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
267
admin/phpMyAdmin/vendor/symfony/config/Resource/ReflectionClassResource.php
vendored
Normal file
267
admin/phpMyAdmin/vendor/symfony/config/Resource/ReflectionClassResource.php
vendored
Normal file
|
@ -0,0 +1,267 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;
|
||||
use Symfony\Contracts\Service\ServiceSubscriberInterface;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class ReflectionClassResource implements SelfCheckingResourceInterface
|
||||
{
|
||||
private $files = [];
|
||||
private $className;
|
||||
private $classReflector;
|
||||
private $excludedVendors = [];
|
||||
private $hash;
|
||||
|
||||
public function __construct(\ReflectionClass $classReflector, array $excludedVendors = [])
|
||||
{
|
||||
$this->className = $classReflector->name;
|
||||
$this->classReflector = $classReflector;
|
||||
$this->excludedVendors = $excludedVendors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
if (null === $this->hash) {
|
||||
$this->hash = $this->computeHash();
|
||||
$this->loadFiles($this->classReflector);
|
||||
}
|
||||
|
||||
foreach ($this->files as $file => $v) {
|
||||
if (false === $filemtime = @filemtime($file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filemtime > $timestamp) {
|
||||
return $this->hash === $this->computeHash();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'reflection.'.$this->className;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep(): array
|
||||
{
|
||||
if (null === $this->hash) {
|
||||
$this->hash = $this->computeHash();
|
||||
$this->loadFiles($this->classReflector);
|
||||
}
|
||||
|
||||
return ['files', 'className', 'hash'];
|
||||
}
|
||||
|
||||
private function loadFiles(\ReflectionClass $class)
|
||||
{
|
||||
foreach ($class->getInterfaces() as $v) {
|
||||
$this->loadFiles($v);
|
||||
}
|
||||
do {
|
||||
$file = $class->getFileName();
|
||||
if (false !== $file && is_file($file)) {
|
||||
foreach ($this->excludedVendors as $vendor) {
|
||||
if (str_starts_with($file, $vendor) && false !== strpbrk(substr($file, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
|
||||
$file = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($file) {
|
||||
$this->files[$file] = null;
|
||||
}
|
||||
}
|
||||
foreach ($class->getTraits() as $v) {
|
||||
$this->loadFiles($v);
|
||||
}
|
||||
} while ($class = $class->getParentClass());
|
||||
}
|
||||
|
||||
private function computeHash(): string
|
||||
{
|
||||
if (null === $this->classReflector) {
|
||||
try {
|
||||
$this->classReflector = new \ReflectionClass($this->className);
|
||||
} catch (\ReflectionException $e) {
|
||||
// the class does not exist anymore
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$hash = hash_init('md5');
|
||||
|
||||
foreach ($this->generateSignature($this->classReflector) as $info) {
|
||||
hash_update($hash, $info);
|
||||
}
|
||||
|
||||
return hash_final($hash);
|
||||
}
|
||||
|
||||
private function generateSignature(\ReflectionClass $class): iterable
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
$attributes = [];
|
||||
foreach ($class->getAttributes() as $a) {
|
||||
$attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()];
|
||||
}
|
||||
yield print_r($attributes, true);
|
||||
$attributes = [];
|
||||
}
|
||||
|
||||
yield $class->getDocComment();
|
||||
yield (int) $class->isFinal();
|
||||
yield (int) $class->isAbstract();
|
||||
|
||||
if ($class->isTrait()) {
|
||||
yield print_r(class_uses($class->name), true);
|
||||
} else {
|
||||
yield print_r(class_parents($class->name), true);
|
||||
yield print_r(class_implements($class->name), true);
|
||||
yield print_r($class->getConstants(), true);
|
||||
}
|
||||
|
||||
if (!$class->isInterface()) {
|
||||
$defaults = $class->getDefaultProperties();
|
||||
|
||||
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
foreach ($p->getAttributes() as $a) {
|
||||
$attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()];
|
||||
}
|
||||
yield print_r($attributes, true);
|
||||
$attributes = [];
|
||||
}
|
||||
|
||||
yield $p->getDocComment();
|
||||
yield $p->isDefault() ? '<default>' : '';
|
||||
yield $p->isPublic() ? 'public' : 'protected';
|
||||
yield $p->isStatic() ? 'static' : '';
|
||||
yield '$'.$p->name;
|
||||
yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
|
||||
}
|
||||
}
|
||||
|
||||
$defined = \Closure::bind(static function ($c) { return \defined($c); }, null, $class->name);
|
||||
|
||||
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
foreach ($m->getAttributes() as $a) {
|
||||
$attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()];
|
||||
}
|
||||
yield print_r($attributes, true);
|
||||
$attributes = [];
|
||||
}
|
||||
|
||||
$defaults = [];
|
||||
$parametersWithUndefinedConstants = [];
|
||||
foreach ($m->getParameters() as $p) {
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
foreach ($p->getAttributes() as $a) {
|
||||
$attributes[] = [$a->getName(), \PHP_VERSION_ID >= 80100 ? (string) $a : $a->getArguments()];
|
||||
}
|
||||
yield print_r($attributes, true);
|
||||
$attributes = [];
|
||||
}
|
||||
|
||||
if (!$p->isDefaultValueAvailable()) {
|
||||
$defaults[$p->name] = null;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID >= 80100) {
|
||||
$defaults[$p->name] = (string) $p;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$p->isDefaultValueConstant() || $defined($p->getDefaultValueConstantName())) {
|
||||
$defaults[$p->name] = $p->getDefaultValue();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$defaults[$p->name] = $p->getDefaultValueConstantName();
|
||||
$parametersWithUndefinedConstants[$p->name] = true;
|
||||
}
|
||||
|
||||
if (!$parametersWithUndefinedConstants) {
|
||||
yield preg_replace('/^ @@.*/m', '', $m);
|
||||
} else {
|
||||
$t = $m->getReturnType();
|
||||
$stack = [
|
||||
$m->getDocComment(),
|
||||
$m->getName(),
|
||||
$m->isAbstract(),
|
||||
$m->isFinal(),
|
||||
$m->isStatic(),
|
||||
$m->isPublic(),
|
||||
$m->isPrivate(),
|
||||
$m->isProtected(),
|
||||
$m->returnsReference(),
|
||||
$t instanceof \ReflectionNamedType ? ((string) $t->allowsNull()).$t->getName() : (string) $t,
|
||||
];
|
||||
|
||||
foreach ($m->getParameters() as $p) {
|
||||
if (!isset($parametersWithUndefinedConstants[$p->name])) {
|
||||
$stack[] = (string) $p;
|
||||
} else {
|
||||
$t = $p->getType();
|
||||
$stack[] = $p->isOptional();
|
||||
$stack[] = $t instanceof \ReflectionNamedType ? ((string) $t->allowsNull()).$t->getName() : (string) $t;
|
||||
$stack[] = $p->isPassedByReference();
|
||||
$stack[] = $p->isVariadic();
|
||||
$stack[] = $p->getName();
|
||||
}
|
||||
}
|
||||
|
||||
yield implode(',', $stack);
|
||||
}
|
||||
|
||||
yield print_r($defaults, true);
|
||||
}
|
||||
|
||||
if ($class->isAbstract() || $class->isInterface() || $class->isTrait()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (interface_exists(EventSubscriberInterface::class, false) && $class->isSubclassOf(EventSubscriberInterface::class)) {
|
||||
yield EventSubscriberInterface::class;
|
||||
yield print_r($class->name::getSubscribedEvents(), true);
|
||||
}
|
||||
|
||||
if (interface_exists(MessageSubscriberInterface::class, false) && $class->isSubclassOf(MessageSubscriberInterface::class)) {
|
||||
yield MessageSubscriberInterface::class;
|
||||
foreach ($class->name::getHandledMessages() as $key => $value) {
|
||||
yield $key.print_r($value, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) {
|
||||
yield ServiceSubscriberInterface::class;
|
||||
yield print_r($class->name::getSubscribedServices(), true);
|
||||
}
|
||||
}
|
||||
}
|
31
admin/phpMyAdmin/vendor/symfony/config/Resource/ResourceInterface.php
vendored
Normal file
31
admin/phpMyAdmin/vendor/symfony/config/Resource/ResourceInterface.php
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
/**
|
||||
* ResourceInterface is the interface that must be implemented by all Resource classes.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface ResourceInterface
|
||||
{
|
||||
/**
|
||||
* Returns a string representation of the Resource.
|
||||
*
|
||||
* This method is necessary to allow for resource de-duplication, for example by means
|
||||
* of array_unique(). The string returned need not have a particular meaning, but has
|
||||
* to be identical for different ResourceInterface instances referring to the same
|
||||
* resource; and it should be unlikely to collide with that of other, unrelated
|
||||
* resource instances.
|
||||
*/
|
||||
public function __toString();
|
||||
}
|
46
admin/phpMyAdmin/vendor/symfony/config/Resource/SelfCheckingResourceChecker.php
vendored
Normal file
46
admin/phpMyAdmin/vendor/symfony/config/Resource/SelfCheckingResourceChecker.php
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
use Symfony\Component\Config\ResourceCheckerInterface;
|
||||
|
||||
/**
|
||||
* Resource checker for instances of SelfCheckingResourceInterface.
|
||||
*
|
||||
* As these resources perform the actual check themselves, we can provide
|
||||
* this class as a standard way of validating them.
|
||||
*
|
||||
* @author Matthias Pigulla <mp@webfactory.de>
|
||||
*/
|
||||
class SelfCheckingResourceChecker implements ResourceCheckerInterface
|
||||
{
|
||||
// Common shared cache, because this checker can be used in different
|
||||
// situations. For example, when using the full stack framework, the router
|
||||
// and the container have their own cache. But they may check the very same
|
||||
// resources
|
||||
private static $cache = [];
|
||||
|
||||
public function supports(ResourceInterface $metadata)
|
||||
{
|
||||
return $metadata instanceof SelfCheckingResourceInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SelfCheckingResourceInterface $resource
|
||||
*/
|
||||
public function isFresh(ResourceInterface $resource, int $timestamp)
|
||||
{
|
||||
$key = "$resource:$timestamp";
|
||||
|
||||
return self::$cache[$key] ?? self::$cache[$key] = $resource->isFresh($timestamp);
|
||||
}
|
||||
}
|
30
admin/phpMyAdmin/vendor/symfony/config/Resource/SelfCheckingResourceInterface.php
vendored
Normal file
30
admin/phpMyAdmin/vendor/symfony/config/Resource/SelfCheckingResourceInterface.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Resource;
|
||||
|
||||
/**
|
||||
* Interface for Resources that can check for freshness autonomously,
|
||||
* without special support from external services.
|
||||
*
|
||||
* @author Matthias Pigulla <mp@webfactory.de>
|
||||
*/
|
||||
interface SelfCheckingResourceInterface extends ResourceInterface
|
||||
{
|
||||
/**
|
||||
* Returns true if the resource has not been updated since the given timestamp.
|
||||
*
|
||||
* @param int $timestamp The last time the resource was loaded
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFresh(int $timestamp);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue