changes to sms packages and option to create user

This commit is contained in:
Simon Pocrnjič
2025-11-06 21:54:07 +01:00
parent ad8e0d5cee
commit 1395b72ae8
102 changed files with 1386 additions and 319 deletions
+2 -2
View File
@@ -2,12 +2,13 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Post;
use Illuminate\Console\Command;
class ImportPosts extends Command
{
protected $signature = 'import:posts';
protected $description = 'Import posts into Algolia without clearing the index';
public function __construct()
@@ -22,4 +23,3 @@ public function handle()
$this->info('Posts have been imported into Algolia.');
}
}
@@ -10,12 +10,15 @@
class PruneDocumentPreviews extends Command
{
protected $signature = 'documents:prune-previews {--days=90 : Delete previews older than this many days} {--dry-run : Show what would be deleted without deleting}';
protected $description = 'Deletes generated document preview files older than N days and clears their metadata.';
public function handle(): int
{
$days = (int) $this->option('days');
if ($days < 1) { $days = 90; }
if ($days < 1) {
$days = 90;
}
$cutoff = Carbon::now()->subDays($days);
$previewDisk = config('files.preview_disk', 'public');
@@ -27,6 +30,7 @@ public function handle(): int
$count = $query->count();
if ($count === 0) {
$this->info('No stale previews found.');
return self::SUCCESS;
}
@@ -36,9 +40,12 @@ public function handle(): int
$query->chunkById(200, function ($docs) use ($previewDisk, $dry) {
foreach ($docs as $doc) {
$path = $doc->preview_path;
if (!$path) { continue; }
if (! $path) {
continue;
}
if ($dry) {
$this->line("Would delete: {$previewDisk}://{$path} (document #{$doc->id})");
continue;
}
try {