Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120826020
ExpungeCommand.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
ExpungeCommand.php
View Options
<?php
namespace
App\Console\Commands\DB
;
use
App\Fs\Lock
;
use
App\Policy\Greylist\Connect
;
use
App\Policy\Greylist\Whitelist
;
use
App\Policy\RateLimit
;
use
App\SignupCode
;
use
Carbon\Carbon
;
use
Illuminate\Console\Command
;
use
Illuminate\Support\Facades\DB
;
class
ExpungeCommand
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'db:expunge'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'Expunge old records from the database tables'
;
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
Connect
::
where
(
'updated_at'
,
'<'
,
Carbon
::
now
()->
subMonthsWithoutOverflow
(
6
))
->
delete
();
Whitelist
::
where
(
'updated_at'
,
'<'
,
Carbon
::
now
()->
subMonthsWithoutOverflow
(
6
))
->
delete
();
RateLimit
::
where
(
'updated_at'
,
'<'
,
Carbon
::
now
()->
subMonthsWithoutOverflow
(
6
))
->
delete
();
SignupCode
::
where
(
'created_at'
,
'<'
,
Carbon
::
now
()->
subMonthsWithoutOverflow
(
6
))
->
forceDelete
();
DB
::
table
(
'failed_jobs'
)->
where
(
'failed_at'
,
'<'
,
Carbon
::
now
()->
subMonthsWithoutOverflow
(
6
))
->
delete
();
// Remove expired filesystem locks
Lock
::
where
(
'timeout'
,
'>='
,
'0'
)->
whereRaw
(
'created_at > now() - interval timeout second'
)
->
delete
();
// TODO: What else? Should we force-delete deleted "dummy/spammer" accounts?
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 10:47 AM (6 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18741366
Default Alt Text
ExpungeCommand.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline