Whoops\Exception\ErrorException: fwrite(): write of 3776 bytes failed with errno=28 No space left on device in /var/www/grav/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:131 Stack trace: #0 /var/www/grav/system/src/Grav/Common/Debugger.php(352): Whoops\Run->handleError() #1 [internal function]: Grav\Common\Debugger->deprecatedErrorHandler() #2 /var/www/grav/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php(131): fwrite() #3 /var/www/grav/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php(117): Monolog\Handler\StreamHandler->streamWrite() #4 /var/www/grav/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(39): Monolog\Handler\StreamHandler->write() #5 /var/www/grav/vendor/monolog/monolog/src/Monolog/Logger.php(344): Monolog\Handler\AbstractProcessingHandler->handle() #6 /var/www/grav/vendor/monolog/monolog/src/Monolog/Logger.php(470): Monolog\Logger->addRecord() #7 /var/www/grav/system/src/Grav/Common/Errors/Errors.php(61): Monolog\Logger->addCritical() #8 /var/www/grav/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php(50): Grav\Common\Errors\Errors->Grav\Common\Errors\{closure}() #9 /var/www/grav/vendor/filp/whoops/src/Whoops/Run.php(321): Whoops\Handler\CallbackHandler->handle() #10 [internal function]: Whoops\Run->handleException() #11 {main}
return true; } public function getStatusFile() { return $this->status_file; } public function statusFileExists() { return file_exists($this->status_file); } public function storeStatusFile() { $problems = $this->getProblemsSerializable(); $json = json_encode($problems); file_put_contents($this->status_file, $json); } public function check($problems_dir = null) { $problems_dir = $problems_dir ?: dirname(__DIR__); $problems = []; $problems_found = false; foreach (new \DirectoryIterator($problems_dir) as $file) { if ($file->isDot() || $file->isDir()) { continue; } $classname = 'Grav\\Plugin\\Problems\\' . $file->getBasename('.php'); /** @var Problem $problem */ $problem = new $classname(); $problems[$problem->getId()] = $problem; } // Fire event to allow other plugins to add problems Grav::instance()->fireEvent('onProblemsInitialized', new Event(['problems' => $problems]));
"file_put_contents(): write of 2576 bytes failed with errno=28 No space left on device"
return true; } public function getStatusFile() { return $this->status_file; } public function statusFileExists() { return file_exists($this->status_file); } public function storeStatusFile() { $problems = $this->getProblemsSerializable(); $json = json_encode($problems); file_put_contents($this->status_file, $json); } public function check($problems_dir = null) { $problems_dir = $problems_dir ?: dirname(__DIR__); $problems = []; $problems_found = false; foreach (new \DirectoryIterator($problems_dir) as $file) { if ($file->isDot() || $file->isDir()) { continue; } $classname = 'Grav\\Plugin\\Problems\\' . $file->getBasename('.php'); /** @var Problem $problem */ $problem = new $classname(); $problems[$problem->getId()] = $problem; } // Fire event to allow other plugins to add problems Grav::instance()->fireEvent('onProblemsInitialized', new Event(['problems' => $problems]));
} public function onPluginsInitialized() { if (\defined('GRAV_CLI') || $this->isAdmin()) { return; } $this->checker = new ProblemChecker(); if (!$this->checker->statusFileExists()) { // If no issues remain, save a state file in the cache if (!$this->problemsFound()) { // delete any existing validated files /** @var \SplFileInfo $fileInfo */ foreach (new \GlobIterator(CACHE_DIR . ProblemChecker::PROBLEMS_PREFIX . '*') as $fileInfo) { @unlink($fileInfo->getPathname()); } // create a file in the cache dir so it only runs on cache changes $this->checker->storeStatusFile(); } else { $this->renderProblems(); } } } private function renderProblems() { /** @var Uri $uri */ $uri = $this->grav['uri']; /** @var \Twig_Environment $twig */ $twig = $this->getTwig(); $data = [ 'problems' => $this->problems, 'base_url' => $baseUrlRelative = $uri->rootUrl(false), 'problems_url' => $baseUrlRelative . '/user/plugins/problems', ];
} } /** * Triggers the listeners of an event. * * This method can be overridden to add functionality that is executed * for each listener. * * @param callable[] $listeners The event listeners * @param string $eventName The name of the event to dispatch * @param Event $event The event object to pass to the event handlers/listeners */ protected function doDispatch($listeners, $eventName, Event $event) { foreach ($listeners as $listener) { if ($event->isPropagationStopped()) { break; } $listener($event, $eventName, $this); } } /** * Sorts the internal list of listeners for the given event by priority. * * @param string $eventName The name of the event */ private function sortListeners($eventName) { krsort($this->listeners[$eventName]); $this->sorted[$eventName] = []; foreach ($this->listeners[$eventName] as $priority => $listeners) { foreach ($listeners as $k => $listener) { if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { $listener[0] = $listener[0](); $this->listeners[$eventName][$priority][$k] = $listener; } $this->sorted[$eventName][] = $listener;
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordan Alliot <jordan.alliot@gmail.com> * @author Nicolas Grekas <p@tchwork.com> */ class EventDispatcher implements EventDispatcherInterface { private $listeners = []; private $sorted = []; /** * {@inheritdoc} */ public function dispatch($eventName, Event $event = null) { if (null === $event) { $event = new Event(); } if ($listeners = $this->getListeners($eventName)) { $this->doDispatch($listeners, $eventName, $event); } return $event; } /** * {@inheritdoc} */ public function getListeners($eventName = null) { if (null !== $eventName) { if (empty($this->listeners[$eventName])) { return []; } if (!isset($this->sorted[$eventName])) { $this->sortListeners($eventName); } return $this->sorted[$eventName];
use Symfony\Component\EventDispatcher\Event as BaseEvent; use Symfony\Component\EventDispatcher\EventDispatcher as BaseEventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * Implements Symfony EventDispatcher interface. * * @package RocketTheme\Toolbox\Event * @author RocketTheme * @license MIT */ class EventDispatcher extends BaseEventDispatcher implements EventDispatcherInterface { public function dispatch($eventName, BaseEvent $event = null) { if (null === $event) { $event = new Event(); } return parent::dispatch($eventName, $event); } }
foreach ($values as $i => $value) { header($key . ': ' . $value, $i === 0); } } } /** * Fires an event with optional parameters. * * @param string $eventName * @param Event $event * * @return Event */ public function fireEvent($eventName, Event $event = null) { /** @var EventDispatcher $events */ $events = $this['events']; return $events->dispatch($eventName, $event); } /** * Set the final content length for the page and flush the buffer * */ public function shutdown() { // Prevent user abort allowing onShutdown event to run without interruptions. if (\function_exists('ignore_user_abort')) { @ignore_user_abort(true); } // Close the session allowing new requests to be handled. if (isset($this['session'])) { $this['session']->close(); } if ($this['config']->get('system.debugger.shutdown.close_connection', true)) { // Flush the response and close the connection to allow time consuming tasks to be performed without leaving
*/ namespace Grav\Common\Processors; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; class PluginsProcessor extends ProcessorBase { public $id = 'plugins'; public $title = 'Plugins'; public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { $this->startTimer(); // TODO: remove in 2.0. $this->container['accounts']; $this->container['plugins']->init(); $this->container->fireEvent('onPluginsInitialized'); $this->stopTimer(); return $handler->handle($request); } }
private $handler; /** @var ContainerInterface|null */ private $container; /** * {@inheritdoc} * @throws InvalidArgumentException */ public function handle(ServerRequestInterface $request): ResponseInterface { $middleware = array_shift($this->middleware); // Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); } }
// Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); } }
} /** @var Uri $uri */ $uri = $this->container['uri']; $uri->init(); // Redirect pages with trailing slash if configured to do so. $path = $uri->path() ?: '/'; if ($path !== '/' && $config->get('system.pages.redirect_trailing_slash', false) && Utils::endsWith($path, '/')) { $redirect = (string) $uri::getCurrentRoute()->toString(); $this->container->redirect($redirect); } $this->container->setLocale(); $this->stopTimer(); return $handler->handle($request); } }
private $handler; /** @var ContainerInterface|null */ private $container; /** * {@inheritdoc} * @throws InvalidArgumentException */ public function handle(ServerRequestInterface $request): ResponseInterface { $middleware = array_shift($this->middleware); // Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); } }
// Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); } }
*/ namespace Grav\Common\Processors; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; class DebuggerProcessor extends ProcessorBase { public $id = '_debugger'; public $title = 'Init Debugger'; public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { $this->startTimer(); $this->container['debugger']->init(); $this->stopTimer(); return $handler->handle($request); } }
private $handler; /** @var ContainerInterface|null */ private $container; /** * {@inheritdoc} * @throws InvalidArgumentException */ public function handle(ServerRequestInterface $request): ResponseInterface { $middleware = array_shift($this->middleware); // Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); } }
// Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); } }
*/ namespace Grav\Common\Processors; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; class ErrorsProcessor extends ProcessorBase { public $id = '_errors'; public $title = 'Error Handlers Reset'; public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { $this->startTimer(); $this->container['errors']->resetHandlers(); $this->stopTimer(); return $handler->handle($request); } }
private $handler; /** @var ContainerInterface|null */ private $container; /** * {@inheritdoc} * @throws InvalidArgumentException */ public function handle(ServerRequestInterface $request): ResponseInterface { $middleware = array_shift($this->middleware); // Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); } }
// Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); } }
/** @var Config $config */ $config = $grav['config']; switch ($config->get('system.log.handler', 'file')) { case 'syslog': $log = $grav['log']; $log->popHandler(); $facility = $config->get('system.log.syslog.facility', 'local6'); $logHandler = new SyslogHandler('grav', $facility); $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%"); $logHandle