@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 57 lines 1.5 kB view raw
1<?php 2 3$table = new PhabricatorRepository(); 4$conn_w = $table->establishConnection('w'); 5 6$default_path = PhabricatorEnv::getEnvConfig('repository.default-local-path'); 7$default_path = rtrim($default_path, '/'); 8 9foreach (new LiskMigrationIterator($table) as $repository) { 10 $local_path = $repository->getLocalPath(); 11 if (strlen($local_path)) { 12 // Repository already has a modern, unique local path. 13 continue; 14 } 15 16 $local_path = $repository->getDetail('local-path'); 17 if (!strlen($local_path)) { 18 // Repository does not have a local path using the older format. 19 continue; 20 } 21 22 $random = Filesystem::readRandomCharacters(8); 23 24 // Try the configured path first, then a default path, then a path with some 25 // random noise. 26 $paths = array( 27 $local_path, 28 $default_path.'/'.$repository->getID().'/', 29 $default_path.'/'.$repository->getID().'-'.$random.'/', 30 ); 31 32 foreach ($paths as $path) { 33 // Set, then get the path to normalize it. 34 $repository->setLocalPath($path); 35 $path = $repository->getLocalPath(); 36 37 try { 38 queryfx( 39 $conn_w, 40 'UPDATE %T SET localPath = %s WHERE id = %d', 41 $table->getTableName(), 42 $path, 43 $repository->getID()); 44 45 echo tsprintf( 46 "%s\n", 47 pht( 48 'Assigned repository "%s" to local path "%s".', 49 $repository->getDisplayName(), 50 $path)); 51 52 break; 53 } catch (AphrontDuplicateKeyQueryException $ex) { 54 // Ignore, try the next one. 55 } 56 } 57}