Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / resources / sql / autopatches / 20150102.policyname.php
blobcf94b918e7b0632fa3b7f60b76bf3df2afab7b62
1 <?php
3 $policies = array(
4 'Administrators',
5 'LegalpadSignature',
6 'LunarPhase',
7 'Projects',
8 'Users',
9 );
10 $map = array();
12 foreach ($policies as $policy) {
13 $old_name = "PhabricatorPolicyRule{$policy}";
14 $new_name = "Phabricator{$policy}PolicyRule";
15 $map[$old_name] = $new_name;
18 echo pht('Migrating policies...')."\n";
19 $table = new PhabricatorPolicy();
20 $conn_w = $table->establishConnection('w');
22 foreach (new LiskMigrationIterator($table) as $policy) {
23 $old_rules = $policy->getRules();
24 $new_rules = array();
26 foreach ($old_rules as $rule) {
27 $existing_rule = $rule['rule'];
28 $rule['rule'] = idx($map, $existing_rule, $existing_rule);
29 $new_rules[] = $rule;
32 queryfx(
33 $conn_w,
34 'UPDATE %T SET rules = %s WHERE id = %d',
35 $table->getTableName(),
36 json_encode($new_rules),
37 $policy->getID());