mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#4984 [evdepismis-theme] yapılacaklar
This commit is contained in:
parent
c55cf375d4
commit
6e3b5ea83b
@ -11,6 +11,7 @@ use Visiosoft\AdvsModule\Adv\AdvRepository;
|
||||
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
||||
use Visiosoft\AdvsModule\Console\Commands\DeleteNonExistingCoverPhotos;
|
||||
use Visiosoft\AdvsModule\Http\Middleware\redirectDiffrentLang;
|
||||
use Visiosoft\AdvsModule\Http\Middleware\SetLang;
|
||||
use Visiosoft\AdvsModule\Listener\AddAdvsSettingsScript;
|
||||
@ -42,6 +43,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
AdvsModulePlugin::class,
|
||||
];
|
||||
|
||||
protected $commands = [
|
||||
DeleteNonExistingCoverPhotos::class
|
||||
];
|
||||
|
||||
protected $routes = [
|
||||
// Admin AdvsController
|
||||
'admin/advs' => [
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DeleteNonExistingCoverPhotos extends Command
|
||||
{
|
||||
protected $signature = 'classifieds:refresh-cover-images';
|
||||
|
||||
protected $description = 'Nullify non existing cover images.';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$classifieds = DB::table('advs_advs')
|
||||
->whereNotNull('cover_photo')
|
||||
->get();
|
||||
|
||||
$nullableClassifieds = array();
|
||||
foreach ($classifieds as $classified) {
|
||||
$name = pathinfo($classified->cover_photo);
|
||||
|
||||
if (!file_exists(storage_path("streams/default/files-module/local/images/{$name['basename']}"))) {
|
||||
$nullableClassifieds[] = $classified->id;
|
||||
}
|
||||
}
|
||||
|
||||
DB::table('advs_advs')
|
||||
->whereIn('id', $nullableClassifieds)
|
||||
->update(['cover_photo' => null]);
|
||||
|
||||
$this->info('Classifieds refreshed!');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user