Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F970982
PhabricatorFilesManagementPurgeWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorFilesManagementPurgeWorkflow.php
View Options
<?php
final
class
PhabricatorFilesManagementPurgeWorkflow
extends
PhabricatorFilesManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'purge'
)
->
setSynopsis
(
pht
(
'Delete files with missing data.'
))
->
setArguments
(
array
(
array
(
'name'
=>
'all'
,
'help'
=>
pht
(
'Update all files.'
),
),
array
(
'name'
=>
'dry-run'
,
'help'
=>
pht
(
'Show what would be updated.'
),
),
array
(
'name'
=>
'names'
,
'wildcard'
=>
true
,
),
));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$console
=
PhutilConsole
::
getConsole
();
$iterator
=
$this
->
buildIterator
(
$args
);
if
(!
$iterator
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Either specify a list of files to purge, or use `%s` '
.
'to purge all files.'
,
'--all'
));
}
$is_dry_run
=
$args
->
getArg
(
'dry-run'
);
foreach
(
$iterator
as
$file
)
{
$fid
=
'F'
.
$file
->
getID
();
try
{
$file
->
loadFileData
();
$okay
=
true
;
}
catch
(
Exception
$ex
)
{
$okay
=
false
;
}
if
(
$okay
)
{
$console
->
writeOut
(
"%s
\n
"
,
pht
(
'%s: File data is OK, not purging.'
,
$fid
));
}
else
{
if
(
$is_dry_run
)
{
$console
->
writeOut
(
"%s
\n
"
,
pht
(
'%s: Would purge (dry run).'
,
$fid
));
}
else
{
$console
->
writeOut
(
"%s
\n
"
,
pht
(
'%s: Purging.'
,
$fid
));
$file
->
delete
();
}
}
}
return
0
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jun 18, 5:33 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
223918
Default Alt Text
PhabricatorFilesManagementPurgeWorkflow.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment