Differential D14073 Diff 34742 src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php
| Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | $console->writeOut( | ||||
| 'instead.'))); | 'instead.'))); | ||||
| $phids = mpull($named_objects, 'getPHID'); | $phids = mpull($named_objects, 'getPHID'); | ||||
| $handles = PhabricatorUser::getOmnipotentUser()->loadHandles($phids); | $handles = PhabricatorUser::getOmnipotentUser()->loadHandles($phids); | ||||
| $console->writeOut( | $console->writeOut( | ||||
| pht( | pht( | ||||
| 'These %s object(s) will be destroyed forever:', | 'These %s object(s) will be destroyed forever:', | ||||
| new PhutilNumber(count($named_objects)))."\n\n"); | phutil_count($named_objects))."\n\n"); | ||||
| foreach ($named_objects as $object_name => $object) { | foreach ($named_objects as $object_name => $object) { | ||||
| $phid = $object->getPHID(); | $phid = $object->getPHID(); | ||||
| $console->writeOut( | $console->writeOut( | ||||
| " - %s (%s) %s\n", | " - %s (%s) %s\n", | ||||
| $object_name, | $object_name, | ||||
| get_class($object), | get_class($object), | ||||
| $handles[$phid]->getFullName()); | $handles[$phid]->getFullName()); | ||||
| } | } | ||||
| $force = $args->getArg('force'); | $force = $args->getArg('force'); | ||||
| if (!$force) { | if (!$force) { | ||||
| $ok = $console->confirm( | $ok = $console->confirm( | ||||
| pht( | pht( | ||||
| 'Are you absolutely certain you want to destroy these %s object(s)?', | 'Are you absolutely certain you want to destroy these %s object(s)?', | ||||
| new PhutilNumber(count($named_objects)))); | phutil_count($named_objects))); | ||||
| if (!$ok) { | if (!$ok) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| pht('Aborted, your objects are safe.')); | pht('Aborted, your objects are safe.')); | ||||
| } | } | ||||
| } | } | ||||
| $console->writeOut("%s\n", pht('Destroying objects...')); | $console->writeOut("%s\n", pht('Destroying objects...')); | ||||
| foreach ($named_objects as $object_name => $object) { | foreach ($named_objects as $object_name => $object) { | ||||
| $console->writeOut( | $console->writeOut( | ||||
| pht( | pht( | ||||
| "Destroying %s **%s**...\n", | "Destroying %s **%s**...\n", | ||||
| get_class($object), | get_class($object), | ||||
| $object_name)); | $object_name)); | ||||
| id(new PhabricatorDestructionEngine()) | id(new PhabricatorDestructionEngine()) | ||||
| ->destroyObject($object); | ->destroyObject($object); | ||||
| } | } | ||||
| $console->writeOut( | $console->writeOut( | ||||
| "%s\n", | "%s\n", | ||||
| pht( | pht( | ||||
| 'Permanently destroyed %s object(s).', | 'Permanently destroyed %s object(s).', | ||||
| new PhutilNumber(count($named_objects)))); | phutil_count($named_objects))); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||