@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.

at recaptime-dev/main 53 lines 1.3 kB view raw
1<?php 2 3// Previously, files generated by "View Raw File" were written as permanent 4// files with excessively wide view permissions. This destroys these files 5// so they are recreated as temporary files with correct permissions when 6// next accessed. 7 8$table = new DifferentialChangeset(); 9$conn = $table->establishConnection('w'); 10$viewer = PhabricatorUser::getOmnipotentUser(); 11 12$iterator = new LiskRawMigrationIterator( 13 $conn, 14 $table->getTableName()); 15 16echo tsprintf( 17 "%s\n", 18 pht('Purging old raw changeset file caches...')); 19 20$keys = array( 21 'raw:new:phid', 22 'raw:old:phid', 23); 24 25foreach ($iterator as $changeset) { 26 try { 27 $metadata = phutil_json_decode($changeset['metadata']); 28 29 $phids = array(); 30 foreach ($keys as $key) { 31 if (isset($metadata[$key])) { 32 $phids[] = $metadata[$key]; 33 } 34 } 35 36 foreach ($phids as $phid) { 37 $file = id(new PhabricatorFileQuery()) 38 ->setViewer($viewer) 39 ->withPHIDs(array($phid)) 40 ->executeOne(); 41 if ($file) { 42 id(new PhabricatorDestructionEngine()) 43 ->destroyObject($file); 44 } 45 } 46 47 // NOTE: We don't bother updating the changeset record itself: we already 48 // regenerate the cache properly if the stored value isn't valid. 49 50 } catch (Exception $ex) { 51 // Just move on if we run into trouble. 52 } 53}