Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F116132638
PhabricatorConfigManagementDeleteWorkflow.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
Thu, Jun 5, 02:36
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jun 7, 02:36 (11 h, 46 m)
Engine
blob
Format
Raw Data
Handle
26604214
Attached To
rPH Phabricator
PhabricatorConfigManagementDeleteWorkflow.php
View Options
<?php
final
class
PhabricatorConfigManagementDeleteWorkflow
extends
PhabricatorConfigManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'delete'
)
->
setExamples
(
'**delete** __key__'
)
->
setSynopsis
(
'Delete a local configuration value.'
)
->
setArguments
(
array
(
array
(
'name'
=>
'args'
,
'wildcard'
=>
true
,
),
));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$console
=
PhutilConsole
::
getConsole
();
$argv
=
$args
->
getArg
(
'args'
);
if
(
count
(
$argv
)
==
0
)
{
throw
new
PhutilArgumentUsageException
(
"Specify a configuration key to delete."
);
}
$key
=
$argv
[
0
];
if
(
count
(
$argv
)
>
1
)
{
throw
new
PhutilArgumentUsageException
(
"Too many arguments: expected one key."
);
}
$options
=
PhabricatorApplicationConfigOptions
::
loadAllOptions
();
if
(
empty
(
$options
[
$key
]))
{
throw
new
PhutilArgumentUsageException
(
"No such configuration key '{$key}'! Use `config list` to list all "
.
"keys."
);
}
$config
=
new
PhabricatorConfigLocalSource
();
$values
=
$config
->
getKeys
(
array
(
$key
));
if
(!
$values
)
{
throw
new
PhutilArgumentUsageException
(
"Configuration key '{$key}' is not set in local configuration!"
);
}
$config
->
deleteKeys
(
array
(
$key
));
$console
->
writeOut
(
pht
(
"Deleted '%s' from local configuration."
,
$key
).
"
\n
"
);
}
}
Event Timeline
Log In to Comment