1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

Increase severity of bin/remove destroy warning

Summary:
Make sure we're 100% clear that this is really, truly not recommended.

Also improve the text itself, and show the objects which are being destroyed more clearly.

Test Plan: Removed objects with `bin/remove destroy`.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12952
This commit is contained in:
epriestley 2015-05-20 14:20:53 -07:00
parent 4787069e96
commit 985eb26c7e
2 changed files with 78 additions and 9 deletions

View file

@ -54,23 +54,81 @@ final class PhabricatorSystemRemoveDestroyWorkflow
} }
} }
$banner = <<<EOBANNER
uuuuuuu
uu###########uu
uu#################uu
u#####################u
u#######################u
u#########################u
u#########################u
u######" "###" "######u
"####" u#u ####"
###u u#u u###
###u u###u u###
"####uu### ###uu####"
"#######" "#######"
u#######u#######u
u#"#"#"#"#"#"#u
uuu ##u# # # # #u## uuu
u#### #####u#u#u### u####
#####uu "#########" uu######
u###########uu """"" uuuu##########
####"""##########uuu uu#########"""###"
""" ""###########uu ""#"""
uuuu ""##########uuu
u###uuu#########uu ""###########uuu###
##########"""" ""###########"
"#####" ""####""
###" ####"
EOBANNER;
$console->writeOut("\n\n<fg:red>%s</fg>\n\n", $banner);
$console->writeOut( $console->writeOut(
"<bg:red>**%s**</bg>\n\n", "<bg:red>** %s **</bg> %s\n\n%s\n\n".
pht(' IMPORTANT: OBJECTS WILL BE PERMANENTLY DESTROYED! ')); "<bg:red>** %s **</bg> %s\n\n%s\n\n",
pht('IMPORTANT'),
pht('DATA WILL BE PERMANENTLY DESTROYED'),
phutil_console_wrap(
pht(
'Objects will be permanently destroyed. There is no way to '.
'undo this operation or ever retrieve this data unless you '.
'maintain external backups.')),
pht('IMPORTANT'),
pht('DELETING OBJECTS OFTEN BREAKS THINGS'),
phutil_console_wrap(
pht(
'Destroying objects may cause related objects to stop working, '.
'and may leave scattered references to objects which no longer '.
'exist. In most cases, it is much better to disable or archive '.
'objects instead of destroying them. This risk is greatest when '.
'deleting complex or highly connected objects like repositories, '.
'projects and users.'.
"\n\n".
'These tattered edges are an expected consquence of destroying '.
'objects, and the Phabricator upstream will not help you fix '.
'them. We strongly recomend disabling or archiving objects '.
'instead.')));
$phids = mpull($named_objects, 'getPHID');
$handles = PhabricatorUser::getOmnipotentUser()->loadHandles($phids);
$console->writeOut( $console->writeOut(
pht( pht(
"There is no way to undo this operation or ever retrieve this data.". 'These %s object(s) will be destroyed forever:',
"\n\n". new PhutilNumber(count($named_objects)))."\n\n");
"These %s object(s) will be **completely destroyed forever**:".
"\n\n",
new PhutilNumber(count($named_objects))));
foreach ($named_objects as $object_name => $object) { foreach ($named_objects as $object_name => $object) {
$phid = $object->getPHID();
$console->writeOut( $console->writeOut(
" - %s (%s)\n", " - %s (%s) %s\n",
$object_name, $object_name,
get_class($object)); get_class($object),
$handles[$phid]->getFullName());
} }
$force = $args->getArg('force'); $force = $args->getArg('force');

View file

@ -1067,6 +1067,17 @@ final class PhabricatorUSEnglishTranslation
), ),
), ),
'These %s object(s) will be destroyed forever:' => array(
'This object will be destroyed forever:',
'These objects will be destroyed forever:',
),
'Are you absolutely certain you want to destroy these %s '.
'object(s)?' => array(
'Are you absolutely certain you want to destroy this object?',
'Are you absolutely certain you want to destroy these objects?',
),
); );
} }