@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove `bin/files purge` workflow

Summary:
Fixes T12948. See that task for substantial discussion and context. Briefly:

- This workflow is very old, and won't work for large (>2GB) files.
- This workflow has become more dangerous than it once was, and can fail in several ways that delete data and/or make recovery much more difficult (see T12948 for more discussion).
- This was originally added in D6068, which is a bit muddled, but looks like "one install ran into a weird issue so I wrote a script for them"; this would be a Consulting/Support issue and not come upstream today. I can't identify any arguments for retaining this workflow there, at least.

Test Plan:
- Grepped for `files purge`, got nothing.
- Grepped for `purge`, looked for anything that looked like instructions or documentation, got nothing.

I don't recall recommending anyone run this script in many years, and didn't even remember that it existed or what it did when T12948 was reported, so I believe it is not in widespread use.

Reviewers: joshuaspence, chad

Reviewed By: joshuaspence

Maniphest Tasks: T12948

Differential Revision: https://secure.phabricator.com/D18384

-73
-2
src/__phutil_library_map__.php
··· 2900 2900 'PhabricatorFilesManagementGenerateKeyWorkflow' => 'applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php', 2901 2901 'PhabricatorFilesManagementIntegrityWorkflow' => 'applications/files/management/PhabricatorFilesManagementIntegrityWorkflow.php', 2902 2902 'PhabricatorFilesManagementMigrateWorkflow' => 'applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php', 2903 - 'PhabricatorFilesManagementPurgeWorkflow' => 'applications/files/management/PhabricatorFilesManagementPurgeWorkflow.php', 2904 2903 'PhabricatorFilesManagementRebuildWorkflow' => 'applications/files/management/PhabricatorFilesManagementRebuildWorkflow.php', 2905 2904 'PhabricatorFilesManagementWorkflow' => 'applications/files/management/PhabricatorFilesManagementWorkflow.php', 2906 2905 'PhabricatorFilesOnDiskBuiltinFile' => 'applications/files/builtin/PhabricatorFilesOnDiskBuiltinFile.php', ··· 8238 8237 'PhabricatorFilesManagementGenerateKeyWorkflow' => 'PhabricatorFilesManagementWorkflow', 8239 8238 'PhabricatorFilesManagementIntegrityWorkflow' => 'PhabricatorFilesManagementWorkflow', 8240 8239 'PhabricatorFilesManagementMigrateWorkflow' => 'PhabricatorFilesManagementWorkflow', 8241 - 'PhabricatorFilesManagementPurgeWorkflow' => 'PhabricatorFilesManagementWorkflow', 8242 8240 'PhabricatorFilesManagementRebuildWorkflow' => 'PhabricatorFilesManagementWorkflow', 8243 8241 'PhabricatorFilesManagementWorkflow' => 'PhabricatorManagementWorkflow', 8244 8242 'PhabricatorFilesOnDiskBuiltinFile' => 'PhabricatorFilesBuiltinFile',
-71
src/applications/files/management/PhabricatorFilesManagementPurgeWorkflow.php
··· 1 - <?php 2 - 3 - final class PhabricatorFilesManagementPurgeWorkflow 4 - extends PhabricatorFilesManagementWorkflow { 5 - 6 - protected function didConstruct() { 7 - $this 8 - ->setName('purge') 9 - ->setSynopsis(pht('Delete files with missing data.')) 10 - ->setArguments( 11 - array( 12 - array( 13 - 'name' => 'all', 14 - 'help' => pht('Update all files.'), 15 - ), 16 - array( 17 - 'name' => 'dry-run', 18 - 'help' => pht('Show what would be updated.'), 19 - ), 20 - array( 21 - 'name' => 'names', 22 - 'wildcard' => true, 23 - ), 24 - )); 25 - } 26 - 27 - public function execute(PhutilArgumentParser $args) { 28 - $console = PhutilConsole::getConsole(); 29 - 30 - $iterator = $this->buildIterator($args); 31 - if (!$iterator) { 32 - throw new PhutilArgumentUsageException( 33 - pht( 34 - 'Either specify a list of files to purge, or use `%s` '. 35 - 'to purge all files.', 36 - '--all')); 37 - } 38 - 39 - $is_dry_run = $args->getArg('dry-run'); 40 - 41 - foreach ($iterator as $file) { 42 - $fid = 'F'.$file->getID(); 43 - 44 - try { 45 - $file->loadFileData(); 46 - $okay = true; 47 - } catch (Exception $ex) { 48 - $okay = false; 49 - } 50 - 51 - if ($okay) { 52 - $console->writeOut( 53 - "%s\n", 54 - pht('%s: File data is OK, not purging.', $fid)); 55 - } else { 56 - if ($is_dry_run) { 57 - $console->writeOut( 58 - "%s\n", 59 - pht('%s: Would purge (dry run).', $fid)); 60 - } else { 61 - $console->writeOut( 62 - "%s\n", 63 - pht('%s: Purging.', $fid)); 64 - $file->delete(); 65 - } 66 - } 67 - } 68 - 69 - return 0; 70 - } 71 - }