This commit is contained in:
Torsten 2018-08-07 10:42:11 +02:00
parent 98419bd18d
commit 8a69e45efa
4919 changed files with 28311 additions and 224136 deletions

18
pfosten/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php vendored Executable file → Normal file
View file

@ -61,7 +61,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
fseek($file, 0, SEEK_END);
$result = array();
while (count($result) < $limit && $line = $this->readLineFromFile($file)) {
while (\count($result) < $limit && $line = $this->readLineFromFile($file)) {
$values = str_getcsv($line);
list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent, $csvStatusCode) = $values;
$csvTime = (int) $csvTime;
@ -136,17 +136,25 @@ class FileProfilerStorage implements ProfilerStorageInterface
$profileIndexed = is_file($file);
if (!$profileIndexed) {
// Create directory
$dir = dirname($file);
$dir = \dirname($file);
if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir));
}
}
$profileToken = $profile->getToken();
// when there are errors in sub-requests, the parent and/or children tokens
// may equal the profile token, resulting in infinite loops
$parentToken = $profile->getParentToken() !== $profileToken ? $profile->getParentToken() : null;
$childrenToken = array_filter(array_map(function ($p) use ($profileToken) {
return $profileToken !== $p->getToken() ? $p->getToken() : null;
}, $profile->getChildren()));
// Store profile
$data = array(
'token' => $profile->getToken(),
'parent' => $profile->getParentToken(),
'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()),
'token' => $profileToken,
'parent' => $parentToken,
'children' => $childrenToken,
'data' => $profile->getCollectors(),
'ip' => $profile->getIp(),
'method' => $profile->getMethod(),

10
pfosten/vendor/symfony/http-kernel/Profiler/Profile.php vendored Executable file → Normal file
View file

@ -44,8 +44,6 @@ class Profile
private $children = array();
/**
* Constructor.
*
* @param string $token The token
*/
public function __construct($token)
@ -75,8 +73,6 @@ class Profile
/**
* Sets the parent token.
*
* @param Profile $parent
*/
public function setParent(Profile $parent)
{
@ -168,7 +164,7 @@ class Profile
}
/**
* @param int The time
* @param int $time The time
*/
public function setTime($time)
{
@ -216,8 +212,6 @@ class Profile
/**
* Adds the child token.
*
* @param Profile $child
*/
public function addChild(Profile $child)
{
@ -268,8 +262,6 @@ class Profile
/**
* Adds a Collector.
*
* @param DataCollectorInterface $collector A DataCollectorInterface instance
*/
public function addCollector(DataCollectorInterface $collector)
{

49
pfosten/vendor/symfony/http-kernel/Profiler/Profiler.php vendored Executable file → Normal file
View file

@ -11,12 +11,12 @@
namespace Symfony\Component\HttpKernel\Profiler;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
use Psr\Log\LoggerInterface;
/**
* Profiler.
@ -25,9 +25,6 @@ use Psr\Log\LoggerInterface;
*/
class Profiler
{
/**
* @var ProfilerStorageInterface
*/
private $storage;
/**
@ -35,26 +32,18 @@ class Profiler
*/
private $collectors = array();
/**
* @var LoggerInterface
*/
private $logger;
/**
* @var bool
*/
private $initiallyEnabled = true;
private $enabled = true;
/**
* Constructor.
*
* @param ProfilerStorageInterface $storage A ProfilerStorageInterface instance
* @param LoggerInterface $logger A LoggerInterface instance
* @param bool $enable The initial enabled state
*/
public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null)
public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null, $enable = true)
{
$this->storage = $storage;
$this->logger = $logger;
$this->initiallyEnabled = $this->enabled = (bool) $enable;
}
/**
@ -76,8 +65,6 @@ class Profiler
/**
* Loads the Profile for the given Response.
*
* @param Response $response A Response instance
*
* @return Profile|false A Profile instance
*/
public function loadProfileFromResponse(Response $response)
@ -104,8 +91,6 @@ class Profiler
/**
* Saves a Profile.
*
* @param Profile $profile A Profile instance
*
* @return bool
*/
public function saveProfile(Profile $profile)
@ -118,7 +103,7 @@ class Profiler
}
if (!($ret = $this->storage->write($profile)) && null !== $this->logger) {
$this->logger->warning('Unable to store the profiler information.', array('configured_storage' => get_class($this->storage)));
$this->logger->warning('Unable to store the profiler information.', array('configured_storage' => \get_class($this->storage)));
}
return $ret;
@ -155,10 +140,6 @@ class Profiler
/**
* Collects data for the given Response.
*
* @param Request $request A Request instance
* @param Response $response A Response instance
* @param \Exception $exception An exception instance if the request threw one
*
* @return Profile|null A Profile instance or null if the profiler is disabled
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
@ -190,6 +171,18 @@ class Profiler
return $profile;
}
public function reset()
{
foreach ($this->collectors as $collector) {
if (!method_exists($collector, 'reset')) {
continue;
}
$collector->reset();
}
$this->enabled = $this->initiallyEnabled;
}
/**
* Gets the Collectors associated with this profiler.
*
@ -215,11 +208,13 @@ class Profiler
/**
* Adds a Collector.
*
* @param DataCollectorInterface $collector A DataCollectorInterface instance
*/
public function add(DataCollectorInterface $collector)
{
if (!method_exists($collector, 'reset')) {
@trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DataCollectorInterface::class, \get_class($collector)), E_USER_DEPRECATED);
}
$this->collectors[$collector->getName()] = $collector;
}

View file

@ -46,8 +46,6 @@ interface ProfilerStorageInterface
/**
* Saves a Profile.
*
* @param Profile $profile A Profile instance
*
* @return bool Write operation successful
*/
public function write(Profile $profile);