@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 50 lines 1.3 kB view raw
1<?php 2 3// See T13208. It was previously possible to replace a saved query with another 4// saved query, causing loss of the first query. Find projects which have their 5// default query set to an invalid query and throw the setting away. 6 7$viewer = PhabricatorUser::getOmnipotentUser(); 8 9$table = new PhabricatorProject(); 10$conn = $table->establishConnection('w'); 11 12$iterator = new LiskMigrationIterator($table); 13$search_engine = id(new ManiphestTaskSearchEngine()) 14 ->setViewer($viewer); 15 16foreach ($iterator as $project) { 17 $default_filter = $project->getDefaultWorkboardFilter(); 18 if (!strlen($default_filter)) { 19 continue; 20 } 21 22 if ($search_engine->isBuiltinQuery($default_filter)) { 23 continue; 24 } 25 26 $saved = id(new PhabricatorSavedQueryQuery()) 27 ->setViewer($viewer) 28 ->withQueryKeys(array($default_filter)) 29 ->executeOne(); 30 if ($saved) { 31 continue; 32 } 33 34 $properties = $project->getProperties(); 35 unset($properties['workboard.filter.default']); 36 37 queryfx( 38 $conn, 39 'UPDATE %T SET properties = %s WHERE id = %d', 40 $table->getTableName(), 41 phutil_json_encode($properties), 42 $project->getID()); 43 44 echo tsprintf( 45 "%s\n", 46 pht( 47 'Project ("%s") had an invalid query saved as a default workboard '. 48 'query. The query has been reset. See T13208.', 49 $project->getDisplayName())); 50}