Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '13.12.0';
const VERSION = '13.16.1';

/**
* The base path for the Laravel installation.
Expand Down
65 changes: 65 additions & 0 deletions src/Illuminate/Foundation/ArrayMaintenanceMode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace Illuminate\Foundation;

use Illuminate\Contracts\Foundation\MaintenanceMode;

class ArrayMaintenanceMode implements MaintenanceMode
{
/**
* Indicates if maintenance mode is currently active.
*
* @var bool
*/
protected $active = false;

/**
* The payload provided when maintenance mode was activated.
*
* @var array
*/
protected $payload = [];

/**
* Take the application down for maintenance.
*
* @param array $payload
* @return void
*/
public function activate(array $payload): void
{
$this->active = true;
$this->payload = $payload;
}

/**
* Take the application out of maintenance.
*
* @return void
*/
public function deactivate(): void
{
$this->active = false;
$this->payload = [];
}

/**
* Determine if the application is currently down for maintenance.
*
* @return bool
*/
public function active(): bool
{
return $this->active;
}

/**
* Get the data array which was provided when the application was placed into maintenance.
*
* @return array
*/
public function data(): array
{
return $this->payload;
}
}
5 changes: 5 additions & 0 deletions src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ public function handleDeprecationError($message, $file, $line, $level = E_DEPREC
return;
}

if (! static::$app->bound('config')) {
return;
}

try {
$logger = static::$app->make(LogManager::class);
} catch (Exception) {
Expand Down Expand Up @@ -121,6 +125,7 @@ public function handleDeprecationError($message, $file, $line, $level = E_DEPREC
protected function shouldIgnoreDeprecationErrors()
{
return ! class_exists(LogManager::class)
|| is_null(static::$app)
|| ! static::$app->hasBeenBootstrapped()
|| (static::$app->runningUnitTests() && ! Env::get('LOG_DEPRECATIONS_WHILE_TESTING'));
}
Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Foundation/Cloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ public static function ensureMigrationsUseUnpooledConnection(Application $app):

/**
* Configure managed queues if applicable.
*
* @throws \JsonException
*/
public static function configureManagedQueues(Application $app): void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Cloud/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public function emitMany(array $payloads): void

/**
* Write the payload to the socket.
*
* @param list<array<string, mixed>> $payloads
*/
protected function write(string $payload): void
{
Expand Down Expand Up @@ -101,6 +99,8 @@ protected function write(string $payload): void
* Format the payload.
*
* @param list<array<string, mixed>> $payloads
*
* @throws \JsonException
*/
protected function format(array $payloads): string
{
Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Foundation/Cloud/FailedJobProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public function all()
*
* @param mixed $id
* @return object|null
*
* @throws \JsonException
*/
public function find($id)
{
Expand Down
30 changes: 30 additions & 0 deletions src/Illuminate/Foundation/Cloud/JsonFormatter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Illuminate\Foundation\Cloud;

use Illuminate\Container\Container;
use Monolog\Formatter\JsonFormatter as BaseFormatter;
use Monolog\LogRecord;

class JsonFormatter extends BaseFormatter
{
/**
* {@inheritdoc}
*/
protected function normalizeRecord(LogRecord $record): array
{
$normalized = parent::normalizeRecord($record);

$app = Container::getInstance();

if ($app->bound('request')) {
$requestId = $app->make('request')->header('Cloud-Request-ID');

if ($requestId !== null) {
$normalized['cloud_request_id'] = $requestId;
}
}

return $normalized;
}
}
4 changes: 3 additions & 1 deletion src/Illuminate/Foundation/Cloud/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ public function normalizeQueue($queue)

return Str::of($this->queue->getQueue($queue))
->when($prefix, fn ($str) => $str->chopStart($prefix.'/'))
->when($suffix, fn ($str) => $str->chopEnd($suffix))
->when($suffix, fn ($str) => $str->endsWith('.fifo')
? $str->chopEnd('.fifo')->chopEnd($suffix)->append('.fifo')
: $str->chopEnd($suffix))
->toString();
}

Expand Down
90 changes: 90 additions & 0 deletions src/Illuminate/Foundation/Console/DevCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace Illuminate\Foundation\Console;

use Illuminate\Console\Command;
use Illuminate\Console\Prohibitable;
use Illuminate\Foundation\DevCommands;
use Illuminate\Support\NodePackageManager;
use Symfony\Component\Console\Attribute\AsCommand;

use function Termwind\terminal;

#[AsCommand(name: 'dev')]
class DevCommand extends Command
{
use Prohibitable;

/**
* The console command name.
*
* @var string
*/
protected $name = 'dev';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Run the dev processes';

/**
* Execute the console command.
*
* @return int
*
* @throws \Exception
*/
public function handle(NodePackageManager $packageManager)
{
if ($this->isProhibited()) {
return self::FAILURE;
}

$devCommands = DevCommands::commands();

$commands = array_column($devCommands, 'command');
$colors = array_column($devCommands, 'color');
$names = array_column($devCommands, 'name');

$longestName = max(array_map(strlen(...), $names));

$columns = getenv('COLUMNS');

putenv('COLUMNS='.max(terminal()->width() - $longestName - 4, 1));

$this->line('');

foreach ($devCommands as $devCommand) {
$this->line(
sprintf(
'<fg=%s>[%s]</>%s<fg=#888888>%s</>',
$devCommand['color'],
$devCommand['name'],
str_repeat(' ', ($longestName - strlen($devCommand['name'])) + 1),
$devCommand['command'],
),
);
}

$this->line('');

$command = $packageManager->getExecCommand(sprintf(
'concurrently -c "%s" "%s" --names=%s --kill-others',
implode(',', $colors),
implode('" "', $commands),
implode(',', $names)
));

if (extension_loaded('pcntl')) {
pcntl_exec('/usr/bin/env', ['sh', '-c', $command]);
}

passthru($command, $exitCode);

$columns === false ? putenv('COLUMNS') : putenv("COLUMNS={$columns}");

return $exitCode;
}
}
2 changes: 2 additions & 0 deletions src/Illuminate/Foundation/Console/RouteListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ protected function getMiddleware($route)
*
* @param \Illuminate\Routing\Route $route
* @return string|null
*
* @throws \ReflectionException
*/
protected function getClosurePath(Route $route)
{
Expand Down
122 changes: 122 additions & 0 deletions src/Illuminate/Foundation/DevCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php

namespace Illuminate\Foundation;

class DevCommand
{
/**
* Color of the command when output to the console.
*
* @var string|null
*/
protected ?string $color = null;

/**
* Create a new DevCommand instance.
*
* @param string $command
* @param string|null $name
* @return void
*/
public function __construct(protected string $command, protected ?string $name = null)
{
$this->name ??= strstr($command, ' ', true);
}

/**
* Get the command name.
*
* @return string
*/
public function name(): string
{
return $this->name;
}

/**
* Set the command color.
*
* @param string $color
* @return self
*/
public function color(string $color): self
{
$this->color = $color;

return $this;
}

/**
* Set the command color to blue.
*
* @return self
*/
public function blue(): self
{
return $this->color(DevCommandColor::BLUE->value);
}

/**
* Set the command color to purple.
*
* @return self
*/
public function purple(): self
{
return $this->color(DevCommandColor::PURPLE->value);
}

/**
* Set the command color to pink.
*
* @return self
*/
public function pink(): self
{
return $this->color(DevCommandColor::PINK->value);
}

/**
* Set the command color to orange.
*
* @return self
*/
public function orange(): self
{
return $this->color(DevCommandColor::ORANGE->value);
}

/**
* Set the command color to green.
*
* @return self
*/
public function green(): self
{
return $this->color(DevCommandColor::GREEN->value);
}

/**
* Set the command color to yellow.
*
* @return self
*/
public function yellow(): self
{
return $this->color(DevCommandColor::YELLOW->value);
}

/**
* Get the command as an array.
*
* @return array{command: string, name: string, color: string|null}
*/
public function toArray(): array
{
return [
'command' => $this->command,
'name' => $this->name,
'color' => $this->color,
];
}
}
Loading