@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 80 lines 2.7 kB view raw
1<?php 2 3final class PhabricatorConfigManagementMigrateWorkflow 4 extends PhabricatorConfigManagementWorkflow { 5 6 protected function didConstruct() { 7 $this 8 ->setName('migrate') 9 ->setExamples('**migrate**') 10 ->setSynopsis(pht( 11 'Migrate file-based configuration to more modern storage.')); 12 } 13 14 public function execute(PhutilArgumentParser $args) { 15 $console = PhutilConsole::getConsole(); 16 $key_count = 0; 17 18 $options = PhabricatorApplicationConfigOptions::loadAllOptions(); 19 $local_config = new PhabricatorConfigLocalSource(); 20 $database_config = new PhabricatorConfigDatabaseSource('default'); 21 $config_sources = PhabricatorEnv::getConfigSourceStack()->getStack(); 22 $console->writeOut( 23 "%s\n", 24 pht('Migrating file-based config to more modern config...')); 25 foreach ($config_sources as $config_source) { 26 if (!($config_source instanceof PhabricatorConfigFileSource)) { 27 $console->writeOut( 28 "%s\n", 29 pht( 30 'Skipping config of source type %s...', 31 get_class($config_source))); 32 continue; 33 } 34 $console->writeOut("%s\n", pht('Migrating file source...')); 35 $all_keys = $config_source->getAllKeys(); 36 foreach ($all_keys as $key => $value) { 37 $option = idx($options, $key); 38 if (!$option) { 39 $console->writeOut("%s\n", pht('Skipping obsolete option: %s', $key)); 40 continue; 41 } 42 $in_local = $local_config->getKeys(array($option->getKey())); 43 if ($in_local) { 44 $console->writeOut( 45 "%s\n", 46 pht('Skipping option "%s"; already in local config.', $key)); 47 continue; 48 } 49 $is_locked = $option->getLocked(); 50 if ($is_locked) { 51 $local_config->setKeys(array($option->getKey() => $value)); 52 $key_count++; 53 $console->writeOut( 54 "%s\n", 55 pht('Migrated option "%s" from file to local config.', $key)); 56 } else { 57 $in_database = $database_config->getKeys(array($option->getKey())); 58 if ($in_database) { 59 $console->writeOut( 60 "%s\n", 61 pht('Skipping option "%s"; already in database config.', $key)); 62 continue; 63 } else { 64 $config_entry = PhabricatorConfigEntry::loadConfigEntry($key); 65 $config_entry->setValue($value); 66 $config_entry->save(); 67 $key_count++; 68 $console->writeOut( 69 "%s\n", 70 pht('Migrated option "%s" from file to database config.', $key)); 71 } 72 } 73 } 74 } 75 76 $console->writeOut("%s\n", pht('Done. Migrated %d keys.', $key_count)); 77 return 0; 78 } 79 80}