From 985eb26c7e32cdc19536769def6ab037645100fb Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 20 May 2015 14:20:53 -0700 Subject: [PATCH] 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 --- ...PhabricatorSystemRemoveDestroyWorkflow.php | 76 ++++++++++++++++--- .../PhabricatorUSEnglishTranslation.php | 11 +++ 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php b/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php index 2a4244e97f..2abbc52691 100644 --- a/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php +++ b/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php @@ -54,23 +54,81 @@ final class PhabricatorSystemRemoveDestroyWorkflow } } + $banner = <<writeOut("\n\n%s\n\n", $banner); + $console->writeOut( - "**%s**\n\n", - pht(' IMPORTANT: OBJECTS WILL BE PERMANENTLY DESTROYED! ')); + "** %s ** %s\n\n%s\n\n". + "** %s ** %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( pht( - "There is no way to undo this operation or ever retrieve this data.". - "\n\n". - "These %s object(s) will be **completely destroyed forever**:". - "\n\n", - new PhutilNumber(count($named_objects)))); + 'These %s object(s) will be destroyed forever:', + new PhutilNumber(count($named_objects)))."\n\n"); foreach ($named_objects as $object_name => $object) { + $phid = $object->getPHID(); + $console->writeOut( - " - %s (%s)\n", + " - %s (%s) %s\n", $object_name, - get_class($object)); + get_class($object), + $handles[$phid]->getFullName()); } $force = $args->getArg('force'); diff --git a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php index a1e0433b2c..61dd34fbe2 100644 --- a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php +++ b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php @@ -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?', + ), + ); }