Update Laravel to v12
Some checks failed
PHP Unit / PHPUnit test suite (pull_request) Has been cancelled
Laravel Pint / Laravel Pint (pull_request) Has been cancelled

This commit is contained in:
Jonny Barnes 2025-03-01 15:00:41 +00:00
parent f2025b801b
commit 1dfa17abca
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
83 changed files with 1324 additions and 2323 deletions

View file

@ -35,30 +35,30 @@ class DownloadWebMention implements ShouldQueue
public function handle(Client $guzzle): void
{
$response = $guzzle->request('GET', $this->source);
//4XX and 5XX responses should get Guzzle to throw an exception,
//Laravel should catch and retry these automatically.
// 4XX and 5XX responses should get Guzzle to throw an exception,
// Laravel should catch and retry these automatically.
if ($response->getStatusCode() === 200) {
$filesystem = new FileSystem;
$filename = storage_path('HTML') . '/' . $this->createFilenameFromURL($this->source);
//backup file first
// backup file first
$filenameBackup = $filename . '.' . date('Y-m-d') . '.backup';
if ($filesystem->exists($filename)) {
$filesystem->copy($filename, $filenameBackup);
}
//check if base directory exists
// check if base directory exists
if (! $filesystem->exists($filesystem->dirname($filename))) {
$filesystem->makeDirectory(
$filesystem->dirname($filename),
0755, //mode
true //recursive
0755, // mode
true // recursive
);
}
//save new HTML
// save new HTML
$filesystem->put(
$filename,
(string) $response->getBody()
);
//remove backup if the same
// remove backup if the same
if ($filesystem->exists($filenameBackup)) {
if ($filesystem->get($filename) === $filesystem->get($filenameBackup)) {
$filesystem->delete($filenameBackup);

View file

@ -49,7 +49,7 @@ class ProcessLike implements ShouldQueue
$this->like->content = $tweet->html;
$this->like->save();
//POSSE like
// POSSE like
try {
$client->request(
'POST',

View file

@ -32,18 +32,21 @@ class ProcessMedia implements ShouldQueue
*/
public function handle(ImageManager $manager): void
{
// Load file
$file = Storage::disk('local')->get('media/' . $this->filename);
// Open file
try {
$image = $manager->read(storage_path('app/media/') . $this->filename);
$image = $manager->read($file);
} catch (DecoderException) {
// not an image; delete file and end job
unlink(storage_path('app/media/') . $this->filename);
Storage::disk('local')->delete('media/' . $this->filename);
return;
}
// Save the file publicly
Storage::disk('local')->copy('media/' . $this->filename, 'public/media/' . $this->filename);
Storage::disk('public')->put('media/' . $this->filename, $file);
// Create smaller versions if necessary
if ($image->width() > 1000) {
@ -54,13 +57,13 @@ class ProcessMedia implements ShouldQueue
$basename = trim(implode('.', $filenameParts), '.');
$medium = $image->resize(width: 1000);
Storage::disk('local')->put('public/media/' . $basename . '-medium.' . $extension, (string) $medium->encode());
Storage::disk('public')->put('media/' . $basename . '-medium.' . $extension, (string) $medium->encode());
$small = $image->resize(width: 500);
Storage::disk('local')->put('public/media/' . $basename . '-small.' . $extension, (string) $small->encode());
Storage::disk('public')->put('media/' . $basename . '-small.' . $extension, (string) $small->encode());
}
// Now we can delete the locally saved image
unlink(storage_path('app/media/') . $this->filename);
Storage::disk('local')->delete('media/' . $this->filename);
}
}

View file

@ -49,7 +49,7 @@ class SaveProfileImage implements ShouldQueue
$home = array_shift($home);
}
//dont save pbs.twimg.com links
// dont save pbs.twimg.com links
if (
$photo
&& parse_url($photo, PHP_URL_HOST) !== 'pbs.twimg.com'

View file

@ -72,7 +72,7 @@ class SendWebMentions implements ShouldQueue
$guzzle = resolve(Client::class);
$response = $guzzle->get($url);
//check HTTP Headers for webmention endpoint
// check HTTP Headers for webmention endpoint
$links = Header::parse($response->getHeader('Link'));
foreach ($links as $link) {
if (array_key_exists('rel', $link) && mb_stristr($link['rel'], 'webmention')) {
@ -80,7 +80,7 @@ class SendWebMentions implements ShouldQueue
}
}
//failed to find a header so parse HTML
// failed to find a header so parse HTML
$html = (string) $response->getBody();
$mf2 = new \Mf2\Parser($html, $url);