Skip to content

Commit

Permalink
Merge branch '11.x'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/Illuminate/Foundation/Application.php
  • Loading branch information
driesvints committed May 27, 2024
2 parents 500c039 + 193f913 commit 5611359
Show file tree
Hide file tree
Showing 70 changed files with 4,312 additions and 114 deletions.
127 changes: 73 additions & 54 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ jobs:
- name: Remove optional "v" prefix
id: version
run: |
VERSION=${{ inputs.version }}
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
env:
VERSION: ${{ inputs.version }}

- name: Check if branch and version match
id: guard
run: |
MAJOR_VERSION="${NUMERIC_VERSION%%.*}"
BRANCH_MAJOR_VERSION="${BRANCH%%.*}"
echo "MAJOR_VERSION=$(echo $MAJOR_VERSION)" >> $GITHUB_OUTPUT;
echo "BRANCH_MAJOR_VERSION=$(echo $BRANCH_MAJOR_VERSION)" >> $GITHUB_OUTPUT;
if [ "$MAJOR_VERSION" != "$BRANCH_MAJOR_VERSION" ]; then
echo "Mismatched versions! Aborting."
VERSION_MISMATCH='true';
Expand All @@ -47,7 +45,7 @@ jobs:
VERSION_MISMATCH='false';
fi
echo "VERSION_MISMATCH=$(echo $VERSION_MISMATCH)" >> $GITHUB_OUTPUT;
echo "VERSION_MISMATCH=$(echo $VERSION_MISMATCH)" >> "$GITHUB_OUTPUT";
env:
BRANCH: ${{ github.ref_name }}
NUMERIC_VERSION: ${{ steps.version.outputs.version }}
Expand All @@ -67,53 +65,74 @@ jobs:
with:
commit_message: "Update version to v${{ steps.version.outputs.version }}"

- name: SSH into splitter server
uses: appleboy/ssh-action@master
# - name: SSH into splitter server
# uses: appleboy/ssh-action@master
# with:
# host: 104.248.56.26
# username: forge
# key: ${{ secrets.SSH_PRIVATE_KEY_SPLITTER }}
# script: |
# cd laravel-${{ github.ref_name }}
# git pull origin ${{ github.ref_name }}
# bash ./bin/release.sh v${{ steps.version.outputs.version }}
# script_stop: true

- name: Generate release notes
id: generated-notes
uses: RedCrafter07/release-notes-action@main
with:
host: 104.248.56.26
username: forge
key: ${{ secrets.SSH_PRIVATE_KEY_SPLITTER }}
script: |
cd laravel-${{ github.ref_name }}
git pull origin ${{ github.ref_name }}
bash ./bin/release.sh v${{ steps.version.outputs.version }}
script_stop: true

# - name: Generate release notes
# id: generated-notes
# uses: RedCrafter07/release-notes-action@main
# with:
# tag-name: v${{ steps.version.outputs.version }}
# token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref_name }}

# - name: Cleanup release notes
# id: cleaned-notes
# run: |
# RELEASE_NOTES=$(echo $RELEASE_NOTES | sed '/## What/d')
# RELEASE_NOTES=$(echo $RELEASE_NOTES | sed '/## New Contributors/,$d')
# echo "notes=${RELEASE_NOTES}" >> "$GITHUB_OUTPUT"
# env:
# RELEASE_NOTES: ${{ steps.generated-notes.outputs.release-notes }}

# - name: Create release
# uses: softprops/action-gh-release@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: v${{ steps.version.outputs.version }}
# name: v${{ steps.version.outputs.version }}
# body: ${{ steps.cleaned-notes.outputs.notes }}
# target_commitish: ${{ github.ref_name }}
# make_latest: 'legacy'

# update-changelog:
# needs: release

# name: Update changelog

# uses: laravel/.github/.github/workflows/update-changelog.yml@main
# with:
# branch: ${{ github.ref_name }}
# version: "v${{ needs.release.outputs.version }}"
# notes: ${{ needs.release.outputs.notes }}
tag-name: v${{ steps.version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}

- name: Cleanup release notes
id: cleaned-notes
run: |
START_FROM=$(echo -n "$RELEASE_NOTES" | awk "/What's Changed/{ print NR; exit }" -)
DROP_FROM_CONTRIBUTORS=$(echo -n "$RELEASE_NOTES" | awk "/New Contributors/{ print NR; exit }" -)
DROP_FROM_FULL_CHANGELOG=$(echo -n "$RELEASE_NOTES" | awk "/Full Changelog/{ print NR; exit }" -)
# Drop everything starting from "Full Changelog"
if [ ! -z "$DROP_FROM_FULL_CHANGELOG" ]; then
RELEASE_NOTES=$(echo -n "$RELEASE_NOTES" | sed "${DROP_FROM_FULL_CHANGELOG},$ d")
fi
# Drop everything starting from "New Contributors"
if [ ! -z "$DROP_FROM_CONTRIBUTORS" ]; then
RELEASE_NOTES=$(echo -n "$RELEASE_NOTES" | sed "${DROP_FROM_CONTRIBUTORS},$ d")
fi
# Drop the line "What's Changed"
if [ ! -z "$START_FROM" ]; then
RELEASE_NOTES=$(echo -n "$RELEASE_NOTES" | sed "${START_FROM}d")
fi
{
echo 'notes<<EOF'
echo "$RELEASE_NOTES"
echo EOF
} >> "$GITHUB_OUTPUT";
env:
RELEASE_NOTES: ${{ steps.generated-notes.outputs.release-notes }}

- name: Create release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
name: v${{ steps.version.outputs.version }}
body: ${{ steps.cleaned-notes.outputs.notes }}
target_commitish: ${{ github.ref_name }}
make_latest: "${{ github.ref_name == github.event.repository.default_branch }}"

update-changelog:
needs: release

name: Update changelog

uses: laravel/.github/.github/workflows/update-changelog.yml@main
with:
branch: ${{ github.ref_name }}
version: "v${{ needs.release.outputs.version }}"
notes: ${{ needs.release.outputs.notes }}
9 changes: 0 additions & 9 deletions .github/workflows/update-changelog.yml

This file was deleted.

7 changes: 6 additions & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ php:
- bad-syntax-strategy.php
js:
finder:
exclude:
- src/Illuminate/Foundation/resources/exceptions/renderer/dist
not-name:
- webpack.mix.js
css: true
css:
finder:
exclude:
- src/Illuminate/Foundation/resources/exceptions/renderer/dist
4 changes: 2 additions & 2 deletions src/Illuminate/Bus/DatabaseBatchRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
use Closure;
use DateTimeInterface;
use Illuminate\Database\Connection;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\PostgresConnection;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\Str;
use Throwable;

class DatabaseBatchRepository implements PrunableBatchRepository
{
Expand Down Expand Up @@ -352,7 +352,7 @@ protected function unserialize($serialized)

try {
return unserialize($serialized);
} catch (ModelNotFoundException) {
} catch (Throwable) {
return [];
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/Illuminate/Bus/Queueable.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ public function delay($delay)
return $this;
}

/**
* Set the delay for the job to zero seconds.
*
* @return $this
*/
public function withoutDelay()
{
$this->delay = 0;

return $this;
}

/**
* Indicate that the job should be dispatched after all database transactions have committed.
*
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Cache/DatabaseStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ public function add($key, $value, $seconds)
$value = $this->serialize($value);
$expiration = $this->getTime() + $seconds;

$doesntSupportInsertOrIgnore = [SqlServerConnection::class];

if (! in_array(get_class($this->getConnection()), $doesntSupportInsertOrIgnore)) {
if (! $this->getConnection() instanceof SqlServerConnection) {
return $this->table()->insertOrIgnore(compact('key', 'value', 'expiration')) > 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Concerns/CreatesMatchingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function handleTestCreation($path)
return false;
}

return $this->callSilent('make:test', [
return $this->call('make:test', [
'name' => Str::of($path)->after($this->laravel['path'])->beforeLast('.php')->append('Test')->replace('\\', '/'),
'--pest' => $this->option('pest'),
'--phpunit' => $this->option('phpunit'),
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Console/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ public function handle()
$info = $this->type;

if (in_array(CreatesMatchingTest::class, class_uses_recursive($this))) {
if ($this->handleTestCreation($path)) {
$info .= ' and test';
}
$this->handleTestCreation($path);
}

if (windows_os()) {
Expand Down
43 changes: 43 additions & 0 deletions src/Illuminate/Console/Prohibitable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Illuminate\Console;

trait Prohibitable
{
/**
* Indicates if the command should be prohibited from running.
*
* @var bool
*/
protected static $prohibitedFromRunning = false;

/**
* Indicate whether the command should be prohibited from running.
*
* @param bool $prohibit
* @return bool
*/
public static function prohibit($prohibit = true)
{
static::$prohibitedFromRunning = $prohibit;
}

/**
* Determine if the command is prohibited from running and display a warning if so.
*
* @param bool $quiet
* @return bool
*/
protected function isProhibited(bool $quiet = false)
{
if (! static::$prohibitedFromRunning) {
return false;
}

if (! $quiet) {
$this->components->warn('This command is prohibited from running in this environment.');
}

return true;
}
}
3 changes: 3 additions & 0 deletions src/Illuminate/Contracts/Routing/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Illuminate\Contracts\Routing;

/**
* @method string query(string $path, array $query = [], mixed $extra = [], bool|null $secure = null)
*/
interface UrlGenerator
{
/**
Expand Down
6 changes: 4 additions & 2 deletions src/Illuminate/Database/Console/Migrations/FreshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Prohibitable;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Events\DatabaseRefreshed;
use Illuminate\Database\Migrations\Migrator;
Expand All @@ -13,7 +14,7 @@
#[AsCommand(name: 'migrate:fresh')]
class FreshCommand extends Command
{
use ConfirmableTrait;
use ConfirmableTrait, Prohibitable;

/**
* The console command name.
Expand Down Expand Up @@ -56,7 +57,8 @@ public function __construct(Migrator $migrator)
*/
public function handle()
{
if (! $this->confirmToProceed()) {
if ($this->isProhibited() ||
! $this->confirmToProceed()) {
return 1;
}

Expand Down
6 changes: 4 additions & 2 deletions src/Illuminate/Database/Console/Migrations/RefreshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Prohibitable;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Events\DatabaseRefreshed;
use Symfony\Component\Console\Attribute\AsCommand;
Expand All @@ -12,7 +13,7 @@
#[AsCommand(name: 'migrate:refresh')]
class RefreshCommand extends Command
{
use ConfirmableTrait;
use ConfirmableTrait, Prohibitable;

/**
* The console command name.
Expand All @@ -35,7 +36,8 @@ class RefreshCommand extends Command
*/
public function handle()
{
if (! $this->confirmToProceed()) {
if ($this->isProhibited() ||
! $this->confirmToProceed()) {
return 1;
}

Expand Down
6 changes: 4 additions & 2 deletions src/Illuminate/Database/Console/Migrations/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
namespace Illuminate\Database\Console\Migrations;

use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Prohibitable;
use Illuminate\Database\Migrations\Migrator;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand(name: 'migrate:reset')]
class ResetCommand extends BaseCommand
{
use ConfirmableTrait;
use ConfirmableTrait, Prohibitable;

/**
* The console command name.
Expand Down Expand Up @@ -53,7 +54,8 @@ public function __construct(Migrator $migrator)
*/
public function handle()
{
if (! $this->confirmToProceed()) {
if ($this->isProhibited() ||
! $this->confirmToProceed()) {
return 1;
}

Expand Down
Loading

0 comments on commit 5611359

Please sign in to comment.