Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96132467
PhabricatorFilesManagementWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 22, 23:34
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 23:34 (2 d)
Engine
blob
Format
Raw Data
Handle
23129540
Attached To
rPH Phabricator
PhabricatorFilesManagementWorkflow.php
View Options
<?php
abstract
class
PhabricatorFilesManagementWorkflow
extends
PhutilArgumentWorkflow
{
public
function
isExecutable
()
{
return
true
;
}
protected
function
buildIterator
(
PhutilArgumentParser
$args
)
{
if
(
$args
->
getArg
(
'all'
))
{
if
(
$args
->
getArg
(
'names'
))
{
throw
new
PhutilArgumentUsageException
(
"Specify either a list of files or `--all`, but not both."
);
}
return
new
LiskMigrationIterator
(
new
PhabricatorFile
());
}
if
(
$args
->
getArg
(
'names'
))
{
$iterator
=
array
();
foreach
(
$args
->
getArg
(
'names'
)
as
$name
)
{
$name
=
trim
(
$name
);
$id
=
preg_replace
(
'/^F/i'
,
''
,
$name
);
if
(
ctype_digit
(
$id
))
{
$file
=
id
(
new
PhabricatorFile
())->
loadOneWhere
(
'id = %d'
,
$id
);
if
(!
$file
)
{
throw
new
PhutilArgumentUsageException
(
"No file exists with ID '{$name}'."
);
}
}
else
{
$file
=
id
(
new
PhabricatorFile
())->
loadOneWhere
(
'phid = %d'
,
$name
);
if
(!
$file
)
{
throw
new
PhutilArgumentUsageException
(
"No file exists with PHID '{$name}'."
);
}
}
$iterator
[]
=
$file
;
}
return
$iterator
;
}
return
null
;
}
}
Event Timeline
Log In to Comment