/var/www/segundoinformesodi.pjedomex.gob.mx/vendor/league/flysystem/src/UnableToWriteFile.php
namespace League\Flysystem;
use RuntimeException;
use Throwable;
final class UnableToWriteFile extends RuntimeException implements FilesystemOperationFailed
{
/**
* @var string
*/
private $location = '';
/**
* @var string
*/
private $reason;
public static function atLocation(string $location, string $reason = '', Throwable $previous = null): UnableToWriteFile
{
$e = new static(rtrim("Unable to write file at location: {$location}. {$reason}"), 0, $previous);
$e->location = $location;
$e->reason = $reason;
return $e;
}
public function operation(): string
{
return FilesystemOperationFailed::OPERATION_WRITE;
}
public function reason(): string
{
return $this->reason;
}
public function location(): string
{
return $this->location;
}
Arguments
"Unable to write file at location: anuario.txt. file_put_contents(/var/www/segundoinformesodi.pjedomex.gob.mx/config/../storage/app/anuario.txt): failed to open stream: Read-only file system"
/var/www/segundoinformesodi.pjedomex.gob.mx/vendor/league/flysystem/src/Local/LocalFilesystemAdapter.php
public function writeStream(string $path, $contents, Config $config): void
{
$this->writeToFile($path, $contents, $config);
}
/**
* @param resource|string $contents
*/
private function writeToFile(string $path, $contents, Config $config): void
{
$prefixedLocation = $this->prefixer->prefixPath($path);
$this->ensureDirectoryExists(
dirname($prefixedLocation),
$this->resolveDirectoryVisibility($config->get(Config::OPTION_DIRECTORY_VISIBILITY))
);
error_clear_last();
if (@file_put_contents($prefixedLocation, $contents, $this->writeFlags) === false) {
throw UnableToWriteFile::atLocation($path, error_get_last()['message'] ?? '');
}
if ($visibility = $config->get(Config::OPTION_VISIBILITY)) {
$this->setVisibility($path, (string) $visibility);
}
}
public function delete(string $path): void
{
$location = $this->prefixer->prefixPath($path);
if ( ! file_exists($location)) {
return;
}
error_clear_last();
if ( ! @unlink($location)) {
throw UnableToDeleteFile::atLocation($location, error_get_last()['message'] ?? '');
}
/var/www/segundoinformesodi.pjedomex.gob.mx/vendor/league/flysystem/src/Local/LocalFilesystemAdapter.php
private $mimeTypeDetector;
public function __construct(
string $location,
VisibilityConverter $visibility = null,
int $writeFlags = LOCK_EX,
int $linkHandling = self::DISALLOW_LINKS,
MimeTypeDetector $mimeTypeDetector = null
) {
$this->prefixer = new PathPrefixer($location, DIRECTORY_SEPARATOR);
$this->writeFlags = $writeFlags;
$this->linkHandling = $linkHandling;
$this->visibility = $visibility ?: new PortableVisibilityConverter();
$this->ensureDirectoryExists($location, $this->visibility->defaultForDirectories());
$this->mimeTypeDetector = $mimeTypeDetector ?: new FinfoMimeTypeDetector();
}
public function write(string $path, string $contents, Config $config): void
{
$this->writeToFile($path, $contents, $config);
}
public function writeStream(string $path, $contents, Config $config): void
{
$this->writeToFile($path, $contents, $config);
}
/**
* @param resource|string $contents
*/
private function writeToFile(string $path, $contents, Config $config): void
{
$prefixedLocation = $this->prefixer->prefixPath($path);
$this->ensureDirectoryExists(
dirname($prefixedLocation),
$this->resolveDirectoryVisibility($config->get(Config::OPTION_DIRECTORY_VISIBILITY))
);
error_clear_last();
if (@file_put_contents($prefixedLocation, $contents, $this->writeFlags) === false) {
/var/www/segundoinformesodi.pjedomex.gob.mx/vendor/league/flysystem/src/Filesystem.php
FilesystemAdapter $adapter,
array $config = [],
PathNormalizer $pathNormalizer = null
) {
$this->adapter = $adapter;
$this->config = new Config($config);
$this->pathNormalizer = $pathNormalizer ?: new WhitespacePathNormalizer();
}
public function fileExists(string $location): bool
{
return $this->adapter->fileExists($this->pathNormalizer->normalizePath($location));
}
public function write(string $location, string $contents, array $config = []): void
{
$this->adapter->write(
$this->pathNormalizer->normalizePath($location),
$contents,
$this->config->extend($config)
);
}
public function writeStream(string $location, $contents, array $config = []): void
{
/* @var resource $contents */
$this->assertIsResource($contents);
$this->rewindStream($contents);
$this->adapter->writeStream(
$this->pathNormalizer->normalizePath($location),
$contents,
$this->config->extend($config)
);
}
public function read(string $location): string
{
return $this->adapter->read($this->pathNormalizer->normalizePath($location));
}
/var/www/segundoinformesodi.pjedomex.gob.mx/framework/Filesystem/Driver/Driver.php
$this->config = $config;
$this->connect();
}
abstract protected function connect();
public function list(string $path, bool $recursive = false) : iterable {
return $this->filesystem->listContents($path, $recursive);
}
public function exists(string $path) : bool {
return $this->filesystem->fileExists($path);
}
public function get(string $path) : string {
return $this->filesystem->read($path);
}
public function put(string $path, $value) {
$this->filesystem->write($path, $value);
return $this;
}
public function delete(string $path) {
$this->filesystem->delete($path);
return $this;
}
}
?>
/var/www/segundoinformesodi.pjedomex.gob.mx/app/Http/Controllers/DownloadController.php
<?php
namespace App\Http\Controllers;
class DownloadController {
public function yearbook(){
if(!app('filesystem')->exists('anuario.txt')){
app('filesystem')->put('anuario.txt', '');
}
app('filesystem')->put('anuario.txt',
(int) app('filesystem')->get('anuario.txt', 0) + 1,
);
return redirect('/documents/2ºInformeAnuario.pdf');
}
public function document(){
if(!app('filesystem')->exists('documento.txt')){
app('filesystem')->put('documento.txt', '');
}
app('filesystem')->put('documento.txt',
(int) app('filesystem')->get('documento.txt', 0) + 1,
);
return redirect('/documents/2ºInformeDOCUMENTO.pdf');
}
}
?>
/var/www/segundoinformesodi.pjedomex.gob.mx/framework/Container.php
if (isset($parameters[$name])) {
$dependencies[$name] = $parameters[$name];
continue;
}
if ($parameter->isDefaultValueAvailable()) {
$dependencies[$name] = $parameter->getDefaultValue();
continue;
}
if ($type instanceof ReflectionNamedType) {
$dependencies[$name] = $this->resolve($type);
continue;
}
throw new InvalidArgumentException("{$name} cannot be resolved");
}
return call_user_func($callable, ...array_values($dependencies));
}
private function getReflector($callable)
{
if (is_array($callable)) {
return new ReflectionMethod($callable[0], $callable[1]);
}
return new ReflectionFunction($callable);
}
}
?>
/var/www/segundoinformesodi.pjedomex.gob.mx/framework/Container.php
if (isset($parameters[$name])) {
$dependencies[$name] = $parameters[$name];
continue;
}
if ($parameter->isDefaultValueAvailable()) {
$dependencies[$name] = $parameter->getDefaultValue();
continue;
}
if ($type instanceof ReflectionNamedType) {
$dependencies[$name] = $this->resolve($type);
continue;
}
throw new InvalidArgumentException("{$name} cannot be resolved");
}
return call_user_func($callable, ...array_values($dependencies));
}
private function getReflector($callable)
{
if (is_array($callable)) {
return new ReflectionMethod($callable[0], $callable[1]);
}
return new ReflectionFunction($callable);
}
}
?>
/var/www/segundoinformesodi.pjedomex.gob.mx/framework/Routing/Route.php
$parameterValues += $emptyValues;
$this->parameters = array_combine(
$parameterNames,
$parameterValues,
);
return true;
}
return false;
}
public function dispatch() {
if (is_array($this->handler)) {
[$class, $method] = $this->handler;
if(is_string($class)) {
return app()->call([new $class, $method]);
}
return app()->call([$class, $method]);
}
return app()->call($this->handler);
}
private function normalisePath(string $path) : string {
$path = trim($path, '/');
$path = "/{$path}/";
$path = preg_replace('/[\/]{2,}/', '/', $path);
return $path;
}
}
?>
/var/www/segundoinformesodi.pjedomex.gob.mx/framework/Routing/Router.php
return $path;
}
}
throw new Exception('no route with that name');
}
public function dispatch() {
$paths = $this->paths();
$requestMethod = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$requestPath = $_SERVER['REQUEST_URI'] ?? '/';
$matching = $this->match($requestMethod, $requestPath);
if($matching){
$this->current = $matching;
try {
return $matching->dispatch();
}
catch(Throwable $e){
$result = null;
if ($handler = config('handlers.exceptions')) {
$instance = new $handler();
if($result = $instance->showThrowable($e)) {
return $result;
}
}
return $this->dispatchError();
}
}
if(in_array($requestPath, $paths)) {
return $this->dispatchNotAllowed();
}
/var/www/segundoinformesodi.pjedomex.gob.mx/framework/App.php
foreach ($providers as $provider) {
$instance = new $provider;
if (method_exists($instance, 'bind')) {
$instance->bind($this);
}
}
}
private function dispatch(string $basePath)
{
$router = new Router();
$this->bind(Router::class, fn() => $router);
$routes = require "{$basePath}/app/routes.php";
$routes($router);
$response = $router->dispatch();
if(!$response instanceof Response) {
$response = $this->resolve('response')->content($response);
}
return $response;
}
}
?>
/var/www/segundoinformesodi.pjedomex.gob.mx/framework/App.php
}
return static::$instance;
}
private function __construct() {}
private function __clone() {}
public function prepare() {
$basePath = $this->resolve('paths.base');
$this->configure($basePath);
$this->bindProviders($basePath);
return $this;
}
public function run() : Response
{
return $this->prepare()->dispatch($this->resolve('paths.base'));
}
private function configure(string $basePath)
{
$dotenv = Dotenv::createImmutable($basePath);
$dotenv->load();
}
private function bindProviders(string $basePath)
{
$providers = require "{$basePath}/config/providers.php";
foreach ($providers as $provider) {
$instance = new $provider;
if (method_exists($instance, 'bind')) {
$instance->bind($this);
}
}
}
/var/www/segundoinformesodi.pjedomex.gob.mx/public/index.php
<?php
require_once __DIR__ . '/../vendor/autoload.php';
$app = \Framework\App::getInstance();
$app->bind('paths.base', fn() => __DIR__ . '/../');
$app->run()->send();
?>