updated backend
This commit is contained in:
parent
1fea0f4fe7
commit
11521c2339
3459 changed files with 72735 additions and 168535 deletions
|
|
@ -1,99 +0,0 @@
|
|||
<?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\HttpKernel\Config;
|
||||
|
||||
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
|
||||
|
||||
/**
|
||||
* EnvParametersResource represents resources stored in prefixed environment variables.
|
||||
*
|
||||
* @author Chris Wilkinson <chriswilkinson84@gmail.com>
|
||||
*
|
||||
* @deprecated since version 3.4, to be removed in 4.0
|
||||
*/
|
||||
class EnvParametersResource implements SelfCheckingResourceInterface, \Serializable
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $prefix;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $variables;
|
||||
|
||||
/**
|
||||
* @param string $prefix
|
||||
*/
|
||||
public function __construct($prefix)
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
$this->variables = $this->findVariables();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return serialize($this->getResource());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array An array with two keys: 'prefix' for the prefix used and 'variables' containing all the variables watched by this resource
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return array('prefix' => $this->prefix, 'variables' => $this->variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh($timestamp)
|
||||
{
|
||||
return $this->findVariables() === $this->variables;
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(array('prefix' => $this->prefix, 'variables' => $this->variables));
|
||||
}
|
||||
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 70000) {
|
||||
$unserialized = unserialize($serialized, array('allowed_classes' => false));
|
||||
} else {
|
||||
$unserialized = unserialize($serialized);
|
||||
}
|
||||
|
||||
$this->prefix = $unserialized['prefix'];
|
||||
$this->variables = $unserialized['variables'];
|
||||
}
|
||||
|
||||
private function findVariables()
|
||||
{
|
||||
$variables = array();
|
||||
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (0 === strpos($key, $this->prefix)) {
|
||||
$variables[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
ksort($variables);
|
||||
|
||||
return $variables;
|
||||
}
|
||||
}
|
||||
|
|
@ -22,19 +22,28 @@ use Symfony\Component\HttpKernel\KernelInterface;
|
|||
class FileLocator extends BaseFileLocator
|
||||
{
|
||||
private $kernel;
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* @param KernelInterface $kernel A KernelInterface instance
|
||||
* @param null|string $path The path the global resource directory
|
||||
* @param array $paths An array of paths where to look for resources
|
||||
* @deprecated since Symfony 4.4
|
||||
*/
|
||||
public function __construct(KernelInterface $kernel, $path = null, array $paths = array())
|
||||
private $path;
|
||||
|
||||
public function __construct(KernelInterface $kernel/*, string $path = null, array $paths = [], bool $triggerDeprecation = true*/)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
if (null !== $path) {
|
||||
$this->path = $path;
|
||||
$paths[] = $path;
|
||||
|
||||
if (2 <= \func_num_args()) {
|
||||
$this->path = func_get_arg(1);
|
||||
$paths = 3 <= \func_num_args() ? func_get_arg(2) : [];
|
||||
if (null !== $this->path) {
|
||||
$paths[] = $this->path;
|
||||
}
|
||||
|
||||
if (4 !== \func_num_args() || func_get_arg(3)) {
|
||||
@trigger_error(sprintf('Passing more than one argument to %s is deprecated since Symfony 4.4 and will be removed in 5.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
}
|
||||
} else {
|
||||
$paths = [];
|
||||
}
|
||||
|
||||
parent::__construct($paths);
|
||||
|
|
@ -46,9 +55,36 @@ class FileLocator extends BaseFileLocator
|
|||
public function locate($file, $currentPath = null, $first = true)
|
||||
{
|
||||
if (isset($file[0]) && '@' === $file[0]) {
|
||||
return $this->kernel->locateResource($file, $this->path, $first);
|
||||
return $this->kernel->locateResource($file, $this->path, $first, false);
|
||||
}
|
||||
|
||||
return parent::locate($file, $currentPath, $first);
|
||||
$locations = parent::locate($file, $currentPath, $first);
|
||||
|
||||
if (isset($file[0]) && !(
|
||||
'/' === $file[0] || '\\' === $file[0]
|
||||
|| (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && ('\\' === $file[2] || '/' === $file[2]))
|
||||
|| null !== parse_url($file, PHP_URL_SCHEME)
|
||||
)) {
|
||||
$triggerDeprecation = false;
|
||||
|
||||
// no need to trigger deprecations when the loaded file is given as absolute path
|
||||
foreach ($this->paths as $deprecatedPath) {
|
||||
foreach ((array) $locations as $location) {
|
||||
if (null !== $currentPath && 0 === strpos($location, $currentPath)) {
|
||||
return $locations;
|
||||
}
|
||||
|
||||
if (0 === strpos($location, $deprecatedPath) && (null === $currentPath || false === strpos($location, $currentPath))) {
|
||||
$triggerDeprecation = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($triggerDeprecation) {
|
||||
@trigger_error(sprintf('Loading the file "%s" from the global resource directory "%s" is deprecated since Symfony 4.4 and will be removed in 5.0.', $file, $deprecatedPath), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
return $locations;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue