Skip to content

Commit

Permalink
Merge branch '5.x'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/tests.yml
#	composer.json
  • Loading branch information
jasonvarga committed Feb 25, 2025
2 parents 1c665ad + da24318 commit efa4d71
Show file tree
Hide file tree
Showing 27 changed files with 198 additions and 42 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ jobs:
strategy:
matrix:
php: [8.2, 8.3, 8.4]
laravel: [11.*]
laravel: [11.*, 12.*]
stability: [prefer-lowest, prefer-stable]
os: [ubuntu-latest]
include:
- os: windows-latest
php: 8.3
laravel: 11.*
stability: prefer-stable
exclude:
- php: 8.1
laravel: 11.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Release Notes

## 5.49.0 (2025-02-25)

### What's new
- Laravel 12 support [#11433](https://github.com/statamic/cms/issues/11433) by @duncanmcclean

### What's fixed
- Asset Container returns relative url for same site [#11372](https://github.com/statamic/cms/issues/11372) by @marcorieser



## 5.48.1 (2025-02-25)

### What's fixed
- Fix session expiry component [#11501](https://github.com/statamic/cms/issues/11501) by @jasonvarga
- Include port in CSP for Live Preview [#11498](https://github.com/statamic/cms/issues/11498) by @dmxmo
- Remove duplicate translation line from `translator` command [#11494](https://github.com/statamic/cms/issues/11494) by @duncanmcclean
- Fix carbon integer casting [#11496](https://github.com/statamic/cms/issues/11496) by @jasonvarga
- Only show spatie/fork prompt when pcntl extension is loaded [#11493](https://github.com/statamic/cms/issues/11493) by @duncanmcclean
- French translations [#11488](https://github.com/statamic/cms/issues/11488) by @ebeauchamps



## 5.48.0 (2025-02-21)

### What's new
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"composer/semver": "^3.4",
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"james-heinrich/getid3": "^1.9.21",
"laravel/framework": "^11.34",
"laravel/framework": "^11.34 || ^12.0",
"laravel/prompts": "^0.3.0",
"league/commonmark": "^2.2",
"league/csv": "^9.0",
Expand All @@ -23,12 +23,12 @@
"michelf/php-smartypants": "^1.8.1",
"nesbot/carbon": "^3.0",
"pixelfear/composer-dist-plugin": "^0.1.4",
"rebing/graphql-laravel": "^9.7",
"rebing/graphql-laravel": "^9.8",
"rhukster/dom-sanitizer": "^1.0.6",
"spatie/blink": "^1.3",
"spatie/ignition": "^1.15",
"spatie/ignition": "^1.15.1",
"statamic/stringy": "^3.1.2",
"stillat/blade-parser": "^1.10.1",
"stillat/blade-parser": "^2.0",
"symfony/lock": "^7.0.3",
"symfony/var-exporter": "^7.0.3",
"symfony/yaml": "^7.0.3",
Expand All @@ -42,8 +42,8 @@
"google/cloud-translate": "^1.6",
"laravel/pint": "1.16.0",
"mockery/mockery": "^1.6.10",
"orchestra/testbench": "^9.2",
"phpunit/phpunit": "^10.5.35",
"orchestra/testbench": "^9.2 || ^10.0",
"phpunit/phpunit": "^11.5.3",
"spatie/laravel-ray": "^1.37"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "İkon",
"ID": "ID",
"ID regenerated and Stache cleared": "ID yenidən yaradıldı və Stache təmizləndi",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Əgər \":actionText\" düyməsini tıklamaqda çətinlik çəkirsinizsə, aşağıdakı URL-ni kopyalayıb veb brauzerinizə yapışdırın:",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Əgər \":actionText\" düyməsini tıklamaqda çətinlik çəkirsinizsə, aşağıdakı URL-ni kopyalayıb veb brauzerinizə yapışdırın:",
"Image": "Şəkil",
"Image Cache": "Şəkil Keşi",
"Image cache cleared.": "Şəkil keşi təmizləndi.",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "Ikona",
"ID": "ID",
"ID regenerated and Stache cleared": "ID obnoveno a Stache vyprázdněno",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Pokud máte problém s kliknutím na tlačítko \":actionText\", zkopírujte a vložte URL níže do webového prohlížeče:",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Pokud máte problém s kliknutím na tlačítko \":actionText\", zkopírujte a vložte URL níže do webového prohlížeče:",
"Image": "Obrázek",
"Image Cache": "Cache obrázků",
"Image cache cleared.": "Cache obrázků smazána.",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "Ikon",
"ID": "ID",
"ID regenerated and Stache cleared": "ID regenereret og Stache ryddet",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Hvis du har problemer med at klikke på knappen \" :actionText \", skal du kopiere og indsætte nedenstående URL i din webbrowser:",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Hvis du har problemer med at klikke på knappen \" :actionText \", skal du kopiere og indsætte nedenstående URL i din webbrowser:",
"Image": "Billede",
"Image Cache": "Billedcache",
"Image cache cleared.": "Billedcache ryddet.",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "Icon",
"ID": "ID",
"ID regenerated and Stache cleared": "ID regeneriert und Stache gelöscht",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Wenn du beim Klicken auf den Button „:actionText“ Probleme hast, kopiere die folgende URL und füge sie in deinem Browser ein:",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Wenn du beim Klicken auf den Button „:actionText“ Probleme hast, kopiere die folgende URL und füge sie in deinem Browser ein:",
"Image": "Bild",
"Image Cache": "Bildercache",
"Image cache cleared.": "Der Bildercache wurde gelöscht.",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/de_CH.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "Icon",
"ID": "ID",
"ID regenerated and Stache cleared": "ID regeneriert und Stache gelöscht",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Wenn du beim Klicken auf den Button «:actionText» Probleme hast, kopiere die folgende URL und füge sie in deinem Browser ein:",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Wenn du beim Klicken auf den Button «:actionText» Probleme hast, kopiere die folgende URL und füge sie in deinem Browser ein:",
"Image": "Bild",
"Image Cache": "Bildercache",
"Image cache cleared.": "Der Bildercache wurde gelöscht.",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "Icono",
"ID": "IDENTIFICACIÓN",
"ID regenerated and Stache cleared": "ID regenerada y bigote limpiado",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Si tienes problemas para hacer clic en el botón de \":actionText\", copia y pega el siguiente URL en tu navegador:",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Si tienes problemas para hacer clic en el botón de \":actionText\", copia y pega el siguiente URL en tu navegador:",
"Image": "Imagen",
"Image Cache": "Caché de imágenes",
"Image cache cleared.": "Caché de imágenes borrado.",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "آیکون",
"ID": "شناسه",
"ID regenerated and Stache cleared": "شناسه با موفقیت از نو ساخته و کش خالی شد",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "اگر مشکلی در خصوص کلیلک روی دکمه‌ی \":actionText\" وجود دارد، می‌توانید آدرس زیر را کپی و در آدرس بار مرورگر پیست کنید:",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "اگر مشکلی در خصوص کلیلک روی دکمه‌ی \":actionText\" وجود دارد، می‌توانید آدرس زیر را کپی و در آدرس بار مرورگر پیست کنید:",
"Image": "تصویر",
"Image Cache": "کش تصویر",
"Image cache cleared.": "کش تصویر پاک شد",
Expand Down
5 changes: 4 additions & 1 deletion resources/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "Icône",
"ID": "ID",
"ID regenerated and Stache cleared": "ID regénéré et Stache effacé",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Si vous ne parvenez pas à cliquer sur le bouton \":actionText\", copiez et collez l'URL ci-dessous dans votre navigateur Web :",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Si vous ne parvenez pas à cliquer sur le bouton \":actionText\", copiez et collez l'URL ci-dessous dans votre navigateur Web :",
"Image": "Image",
"Image Cache": "Cache des images",
"Image cache cleared.": "Cache des images effacé.",
Expand Down Expand Up @@ -768,6 +768,7 @@
"Released on :date": "Publiée le :date",
"Remember me": "Se souvenir de moi",
"Remove": "Enlever",
"Remove All": "Tout enlever",
"Remove all empty nodes": "Enlever tous les noeuds vides",
"Remove Asset": "Enlever la ressource",
"Remove child page|Remove :count child pages": "Enlever la page enfant|Enlever :count pages enfants",
Expand Down Expand Up @@ -950,6 +951,7 @@
"Taxonomy saved": "Taxonomie enregistrée",
"Template": "Modèle",
"Templates": "Modèles",
"Term": "Terme",
"Term created": "Terme créé",
"Term deleted": "Terme supprimé",
"Term references updated": "Références des termes mises à jour",
Expand Down Expand Up @@ -1010,6 +1012,7 @@
"Uncheck All": "Décocher tout",
"Underline": "Souligner",
"Unlink": "Dissocier",
"Unlink All": "Tout dissocier",
"Unlisted Addons": "Addons non répertoriés",
"Unordered List": "Liste non ordonnée",
"Unpin from Favorites": "Supprimer des favoris",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"Icon": "Ikon",
"ID": "ID",
"ID regenerated and Stache cleared": "ID újragenerálva, Stache törölve",
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Ha nem tudja megkattintani a(z) \":actionText\" gombot, másolja ki és illessze be az alábbi URL-t a böngészőjébe:",
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Ha nem tudja megkattintani a(z) \":actionText\" gombot, másolja ki és illessze be az alábbi URL-t a böngészőjébe:",
"Image": "Kép",
"Image Cache": "Képgyorsítótár",
"Image cache cleared.": "A képgyorsítótár törölve.",
Expand Down
2 changes: 1 addition & 1 deletion src/API/AbstractCacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ protected function normalizeKey($key)
*/
public function cacheExpiry()
{
return Carbon::now()->addMinutes($this->config('expiry'));
return Carbon::now()->addMinutes((int) $this->config('expiry'));
}
}
5 changes: 4 additions & 1 deletion src/Assets/AssetContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Statamic\Facades\Stache;
use Statamic\Facades\URL;
use Statamic\Support\Arr;
use Statamic\Support\Str;
use Statamic\Support\Traits\FluentlyGetsAndSets;

class AssetContainer implements Arrayable, ArrayAccess, AssetContainerContract, Augmentable
Expand Down Expand Up @@ -138,7 +139,9 @@ public function url()
return null;
}

$url = rtrim($this->disk()->url('/'), '/');
$url = (string) Str::of($this->disk()->url('/'))
->rtrim('/')
->after(config('app.url'));

return ($url === '') ? '/' : $url;
}
Expand Down
98 changes: 98 additions & 0 deletions src/Auth/Passwords/LaravelTwelveTokenRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php

namespace Statamic\Auth\Passwords;

use Illuminate\Auth\Passwords\DatabaseTokenRepository;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Contracts\Hashing\Hasher as HasherContract;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Carbon;
use Statamic\Facades\YAML;

/** @deprecated */
class LaravelTwelveTokenRepository extends DatabaseTokenRepository
{
protected $path;

public function __construct(
protected Filesystem $files,
protected HasherContract $hasher,
protected string $table,
protected string $hashKey,
protected int $expires = 3600,
protected int $throttle = 60
) {
$this->path = storage_path("statamic/password_resets/$table.yaml");
}

public function create(CanResetPasswordContract $user)
{
$email = $user->getEmailForPasswordReset();

$token = $this->createNewToken();

$this->insert($this->getPayload($email, $token));

return $token;
}

protected function insert($payload)
{
$resets = $this->getResets();

$resets[$payload['email']] = [
'token' => $payload['token'],
'created_at' => $payload['created_at']->timestamp,
];

$this->putResets($resets);
}

public function delete(CanResetPasswordContract $user)
{
$this->putResets(
$this->getResets()->forget($user->email())
);
}

public function deleteExpired()
{
$this->putResets($this->getResets()->reject(function ($item, $email) {
return $this->tokenExpired($item['created_at']);
}));
}

public function exists(CanResetPasswordContract $user, $token)
{
$record = $this->getResets()->get($user->email());

return $record &&
! $this->tokenExpired(Carbon::createFromTimestamp($record['created_at'], config('app.timezone')))
&& $this->hasher->check($token, $record['token']);
}

public function recentlyCreatedToken(CanResetPasswordContract $user)
{
$record = $this->getResets()->get($user->email());

return $record && parent::tokenRecentlyCreated($record['created_at']);
}

protected function getResets()
{
if (! $this->files->exists($this->path)) {
return collect();
}

return collect(YAML::parse($this->files->get($this->path)));
}

protected function putResets($resets)
{
if (! $this->files->isDirectory($dir = dirname($this->path))) {
$this->files->makeDirectory($dir);
}

$this->files->put($this->path, YAML::dump($resets->all()));
}
}
15 changes: 13 additions & 2 deletions src/Auth/Passwords/PasswordBrokerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,23 @@ protected function createTokenRepository(array $config)
$key = base64_decode(substr($key, 7));
}

return new TokenRepository(
if (version_compare(app()->version(), '12', '<')) {
return new TokenRepository(
$this->app['files'],
$this->app['hash'],
$config['table'],
$key,
$config['expire'],
$config['throttle'] ?? 0
);
}

return new LaravelTwelveTokenRepository(
$this->app['files'],
$this->app['hash'],
$config['table'],
$key,
$config['expire'],
($config['expire'] ?? 60) * 60,
$config['throttle'] ?? 0
);
}
Expand Down
1 change: 1 addition & 0 deletions src/Console/Commands/InstallSsg.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function () {

if (
! Composer::isInstalled('spatie/fork')
&& extension_loaded('pcntl')
&& confirm('Would you like to install spatie/fork? It allows for running multiple workers at once.')
) {
spin(
Expand Down
2 changes: 1 addition & 1 deletion src/Git/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function commit($message = null)
public function dispatchCommit($message = null)
{
if ($delay = config('statamic.git.dispatch_delay')) {
$delayInMinutes = now()->addMinutes($delay);
$delayInMinutes = now()->addMinutes((int) $delay);
$message = null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL/ResponseCache/DefaultCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function put(Request $request, $response)
{
$key = $this->track($request);

$ttl = Carbon::now()->addMinutes(config('statamic.graphql.cache.expiry', 60));
$ttl = Carbon::now()->addMinutes((int) config('statamic.graphql.cache.expiry', 60));

Cache::put($key, $response, $ttl);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Http/Controllers/CP/SessionTimeoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function __invoke()
// remember me would have already been served a 403 error and wouldn't have got this far.
$lastActivity = session('last_activity', now()->timestamp);

return Carbon::createFromTimestamp($lastActivity, config('app.timezone'))
->addMinutes(config('session.lifetime'))
->diffInSeconds();
return abs((int) Carbon::createFromTimestamp($lastActivity, config('app.timezone'))
->addMinutes((int) config('session.lifetime'))
->diffInSeconds());
}
}
2 changes: 1 addition & 1 deletion src/Providers/CacheServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private function macroRememberWithExpiration()

$keyValuePair = $callback();
$value = reset($keyValuePair);
$expiration = Carbon::now()->addMinutes(key($keyValuePair));
$expiration = Carbon::now()->addMinutes((int) key($keyValuePair));

return Cache::remember($cacheKey, $expiration, function () use ($value) {
return $value;
Expand Down
2 changes: 1 addition & 1 deletion src/StaticCaching/Cachers/AbstractCacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getBaseUrl()
*/
public function getDefaultExpiration()
{
return $this->config('expiry');
return (int) $this->config('expiry');
}

/**
Expand Down
Loading

0 comments on commit efa4d71

Please sign in to comment.