Upgrade to Laravel 13
This commit is contained in:
parent
e8e2bff5e4
commit
9f012b01e4
117 changed files with 1878 additions and 2215 deletions
|
|
@ -34,10 +34,10 @@ class CopyMediaToLocal extends Command
|
|||
foreach ($media as $mediaItem) {
|
||||
$filename = $mediaItem->path;
|
||||
|
||||
$this->info('Processing: ' . $filename);
|
||||
$this->info('Processing: '.$filename);
|
||||
|
||||
// If the file is already saved locally skip to next one
|
||||
if (Storage::disk('local')->exists('public/' . $filename)) {
|
||||
if (Storage::disk('local')->exists('public/'.$filename)) {
|
||||
$this->info('File already exists locally, skipping');
|
||||
|
||||
continue;
|
||||
|
|
@ -50,19 +50,19 @@ class CopyMediaToLocal extends Command
|
|||
continue;
|
||||
}
|
||||
$contents = Storage::disk('s3')->get($filename);
|
||||
Storage::disk('local')->put('public/' . $filename, $contents);
|
||||
Storage::disk('local')->put('public/'.$filename, $contents);
|
||||
|
||||
// Copy -medium and -small versions if they exist
|
||||
$filenameParts = explode('.', $filename);
|
||||
$extension = array_pop($filenameParts);
|
||||
$basename = trim(implode('.', $filenameParts), '.');
|
||||
$mediumFilename = $basename . '-medium.' . $extension;
|
||||
$smallFilename = $basename . '-small.' . $extension;
|
||||
$mediumFilename = $basename.'-medium.'.$extension;
|
||||
$smallFilename = $basename.'-small.'.$extension;
|
||||
if (Storage::disk('s3')->exists($mediumFilename)) {
|
||||
Storage::disk('local')->put('public/' . $mediumFilename, Storage::disk('s3')->get($mediumFilename));
|
||||
Storage::disk('local')->put('public/'.$mediumFilename, Storage::disk('s3')->get($mediumFilename));
|
||||
}
|
||||
if (Storage::disk('s3')->exists($smallFilename)) {
|
||||
Storage::disk('local')->put('public/' . $smallFilename, Storage::disk('s3')->get($smallFilename));
|
||||
Storage::disk('local')->put('public/'.$smallFilename, Storage::disk('s3')->get($smallFilename));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class MigratePlaceDataFromPostgis extends Command
|
|||
$places = Place::all();
|
||||
|
||||
$places->each(function ($place) {
|
||||
$this->info('Extracting Postgis data for place: ' . $place->name);
|
||||
$this->info('Extracting Postgis data for place: '.$place->name);
|
||||
|
||||
$place->latitude = $place->location->getLat();
|
||||
$place->longitude = $place->location->getLng();
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ class ParseCachedWebMentions extends Command
|
|||
*/
|
||||
public function handle(FileSystem $filesystem): void
|
||||
{
|
||||
$htmlFiles = $filesystem->allFiles(storage_path() . '/HTML');
|
||||
$htmlFiles = $filesystem->allFiles(storage_path().'/HTML');
|
||||
foreach ($htmlFiles as $file) {
|
||||
if ($file->getExtension() !== 'backup') { // we don’t want to parse `.backup` files
|
||||
$filepath = $file->getPathname();
|
||||
$this->info('Loading HTML from: ' . $filepath);
|
||||
$this->info('Loading HTML from: '.$filepath);
|
||||
$html = $filesystem->get($filepath);
|
||||
$url = $this->urlFromFilename($filepath);
|
||||
$webmention = WebMention::where('source', $url)->firstOrFail();
|
||||
|
|
@ -53,7 +53,7 @@ class ParseCachedWebMentions extends Command
|
|||
*/
|
||||
private function urlFromFilename(string $filepath): string
|
||||
{
|
||||
$dir = mb_substr($filepath, mb_strlen(storage_path() . '/HTML/'));
|
||||
$dir = mb_substr($filepath, mb_strlen(storage_path().'/HTML/'));
|
||||
$url = str_replace(['http/', 'https/'], ['http://', 'https://'], $dir);
|
||||
if (mb_substr($url, -10) === 'index.html') {
|
||||
$url = mb_substr($url, 0, -10);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class ReDownloadWebMentions extends Command
|
|||
{
|
||||
$webmentions = WebMention::all();
|
||||
foreach ($webmentions as $webmention) {
|
||||
$this->info('Initiation re-download of ' . $webmention->source);
|
||||
$this->info('Initiation re-download of '.$webmention->source);
|
||||
dispatch(new DownloadWebMention($webmention->source));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue