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

Rename `PhabricatorPolicyRule` subclasses for consistency

Summary: Ref T5655. Fixes T6849. This is another take on D11131, which was missing the DB migration and was reverted in rP7c4de0f6be77ddaea593e1f41ae27211ec179a55.

Test Plan: Ran `./bin/storage upgrade` and verified that the classes were renamed in the `phabricator_policy.policy` table.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6849, T5655

Differential Revision: https://secure.phabricator.com/D11166

+56 -22
+38
resources/sql/autopatches/20150102.policyname.php
··· 1 + <?php 2 + 3 + $policies = array( 4 + 'Administrators', 5 + 'LegalpadSignature', 6 + 'LunarPhase', 7 + 'Projects', 8 + 'Users', 9 + ); 10 + $map = array(); 11 + 12 + foreach ($policies as $policy) { 13 + $old_name = "PhabricatorPolicyRule{$policy}"; 14 + $new_name = "Phabricator{$policy}PolicyRule"; 15 + $map[$old_name] = $new_name; 16 + } 17 + 18 + echo "Migrating policies...\n"; 19 + $table = new PhabricatorPolicy(); 20 + $conn_w = $table->establishConnection('w'); 21 + 22 + foreach (new LiskMigrationIterator($table) as $policy) { 23 + $old_rules = $policy->getRules(); 24 + $new_rules = array(); 25 + 26 + foreach ($old_rules as $rule) { 27 + $existing_rule = $rule['rule']; 28 + $rule['rule'] = idx($map, $existing_rule, $existing_rule); 29 + $new_rules[] = $rule; 30 + } 31 + 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()); 38 + }
+10 -10
src/__phutil_library_map__.php
··· 1230 1230 'PhabricatorActionListView' => 'view/layout/PhabricatorActionListView.php', 1231 1231 'PhabricatorActionView' => 'view/layout/PhabricatorActionView.php', 1232 1232 'PhabricatorActivitySettingsPanel' => 'applications/settings/panel/PhabricatorActivitySettingsPanel.php', 1233 + 'PhabricatorAdministratorsPolicyRule' => 'applications/policy/rule/PhabricatorAdministratorsPolicyRule.php', 1233 1234 'PhabricatorAllCapsTranslation' => 'infrastructure/internationalization/translation/PhabricatorAllCapsTranslation.php', 1234 1235 'PhabricatorAlmanacApplication' => 'applications/almanac/application/PhabricatorAlmanacApplication.php', 1235 1236 'PhabricatorAmazonAuthProvider' => 'applications/auth/provider/PhabricatorAmazonAuthProvider.php', ··· 1857 1858 'PhabricatorLegalpadApplication' => 'applications/legalpad/application/PhabricatorLegalpadApplication.php', 1858 1859 'PhabricatorLegalpadConfigOptions' => 'applications/legalpad/config/PhabricatorLegalpadConfigOptions.php', 1859 1860 'PhabricatorLegalpadDocumentPHIDType' => 'applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php', 1861 + 'PhabricatorLegalpadSignaturePolicyRule' => 'applications/policy/rule/PhabricatorLegalpadSignaturePolicyRule.php', 1860 1862 'PhabricatorLipsumArtist' => 'applications/lipsum/image/PhabricatorLipsumArtist.php', 1861 1863 'PhabricatorLipsumGenerateWorkflow' => 'applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php', 1862 1864 'PhabricatorLipsumManagementWorkflow' => 'applications/lipsum/management/PhabricatorLipsumManagementWorkflow.php', ··· 1866 1868 'PhabricatorLocalDiskFileStorageEngine' => 'applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php', 1867 1869 'PhabricatorLocalTimeTestCase' => 'view/__tests__/PhabricatorLocalTimeTestCase.php', 1868 1870 'PhabricatorLogoutController' => 'applications/auth/controller/PhabricatorLogoutController.php', 1871 + 'PhabricatorLunarPhasePolicyRule' => 'applications/policy/rule/PhabricatorLunarPhasePolicyRule.php', 1869 1872 'PhabricatorMacroApplication' => 'applications/macro/application/PhabricatorMacroApplication.php', 1870 1873 'PhabricatorMacroAudioController' => 'applications/macro/controller/PhabricatorMacroAudioController.php', 1871 1874 'PhabricatorMacroCommentController' => 'applications/macro/controller/PhabricatorMacroCommentController.php', ··· 2154 2157 'PhabricatorPolicyPHIDTypePolicy' => 'applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php', 2155 2158 'PhabricatorPolicyQuery' => 'applications/policy/query/PhabricatorPolicyQuery.php', 2156 2159 'PhabricatorPolicyRule' => 'applications/policy/rule/PhabricatorPolicyRule.php', 2157 - 'PhabricatorPolicyRuleAdministrators' => 'applications/policy/rule/PhabricatorPolicyRuleAdministrators.php', 2158 - 'PhabricatorPolicyRuleLegalpadSignature' => 'applications/policy/rule/PhabricatorPolicyRuleLegalpadSignature.php', 2159 - 'PhabricatorPolicyRuleLunarPhase' => 'applications/policy/rule/PhabricatorPolicyRuleLunarPhase.php', 2160 - 'PhabricatorPolicyRuleProjects' => 'applications/policy/rule/PhabricatorPolicyRuleProjects.php', 2161 - 'PhabricatorPolicyRuleUsers' => 'applications/policy/rule/PhabricatorPolicyRuleUsers.php', 2162 2160 'PhabricatorPolicyTestCase' => 'applications/policy/__tests__/PhabricatorPolicyTestCase.php', 2163 2161 'PhabricatorPolicyTestObject' => 'applications/policy/__tests__/PhabricatorPolicyTestObject.php', 2164 2162 'PhabricatorPolicyType' => 'applications/policy/constants/PhabricatorPolicyType.php', ··· 2224 2222 'PhabricatorProjectUpdateController' => 'applications/project/controller/PhabricatorProjectUpdateController.php', 2225 2223 'PhabricatorProjectWatchController' => 'applications/project/controller/PhabricatorProjectWatchController.php', 2226 2224 'PhabricatorProjectWikiExplainController' => 'applications/project/controller/PhabricatorProjectWikiExplainController.php', 2225 + 'PhabricatorProjectsPolicyRule' => 'applications/policy/rule/PhabricatorProjectsPolicyRule.php', 2227 2226 'PhabricatorPygmentSetupCheck' => 'applications/config/check/PhabricatorPygmentSetupCheck.php', 2228 2227 'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php', 2229 2228 'PhabricatorRecaptchaConfigOptions' => 'applications/config/option/PhabricatorRecaptchaConfigOptions.php', ··· 2558 2557 'PhabricatorUserTestCase' => 'applications/people/storage/__tests__/PhabricatorUserTestCase.php', 2559 2558 'PhabricatorUserTitleField' => 'applications/people/customfield/PhabricatorUserTitleField.php', 2560 2559 'PhabricatorUserTransaction' => 'applications/people/storage/PhabricatorUserTransaction.php', 2560 + 'PhabricatorUsersPolicyRule' => 'applications/policy/rule/PhabricatorUsersPolicyRule.php', 2561 2561 'PhabricatorVCSResponse' => 'applications/repository/response/PhabricatorVCSResponse.php', 2562 2562 'PhabricatorWatcherHasObjectEdgeType' => 'applications/transactions/edges/PhabricatorWatcherHasObjectEdgeType.php', 2563 2563 'PhabricatorWordPressAuthProvider' => 'applications/auth/provider/PhabricatorWordPressAuthProvider.php', ··· 4383 4383 'PhabricatorActionListView' => 'AphrontView', 4384 4384 'PhabricatorActionView' => 'AphrontView', 4385 4385 'PhabricatorActivitySettingsPanel' => 'PhabricatorSettingsPanel', 4386 + 'PhabricatorAdministratorsPolicyRule' => 'PhabricatorPolicyRule', 4386 4387 'PhabricatorAllCapsTranslation' => 'PhabricatorTranslation', 4387 4388 'PhabricatorAlmanacApplication' => 'PhabricatorApplication', 4388 4389 'PhabricatorAmazonAuthProvider' => 'PhabricatorOAuth2AuthProvider', ··· 5058 5059 'PhabricatorLegalpadApplication' => 'PhabricatorApplication', 5059 5060 'PhabricatorLegalpadConfigOptions' => 'PhabricatorApplicationConfigOptions', 5060 5061 'PhabricatorLegalpadDocumentPHIDType' => 'PhabricatorPHIDType', 5062 + 'PhabricatorLegalpadSignaturePolicyRule' => 'PhabricatorPolicyRule', 5061 5063 'PhabricatorLipsumGenerateWorkflow' => 'PhabricatorLipsumManagementWorkflow', 5062 5064 'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow', 5063 5065 'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist', ··· 5065 5067 'PhabricatorLocalDiskFileStorageEngine' => 'PhabricatorFileStorageEngine', 5066 5068 'PhabricatorLocalTimeTestCase' => 'PhabricatorTestCase', 5067 5069 'PhabricatorLogoutController' => 'PhabricatorAuthController', 5070 + 'PhabricatorLunarPhasePolicyRule' => 'PhabricatorPolicyRule', 5068 5071 'PhabricatorMacroApplication' => 'PhabricatorApplication', 5069 5072 'PhabricatorMacroAudioController' => 'PhabricatorMacroController', 5070 5073 'PhabricatorMacroCommentController' => 'PhabricatorMacroController', ··· 5353 5356 'PhabricatorPolicyManagementWorkflow' => 'PhabricatorManagementWorkflow', 5354 5357 'PhabricatorPolicyPHIDTypePolicy' => 'PhabricatorPHIDType', 5355 5358 'PhabricatorPolicyQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 5356 - 'PhabricatorPolicyRuleAdministrators' => 'PhabricatorPolicyRule', 5357 - 'PhabricatorPolicyRuleLegalpadSignature' => 'PhabricatorPolicyRule', 5358 - 'PhabricatorPolicyRuleLunarPhase' => 'PhabricatorPolicyRule', 5359 - 'PhabricatorPolicyRuleProjects' => 'PhabricatorPolicyRule', 5360 - 'PhabricatorPolicyRuleUsers' => 'PhabricatorPolicyRule', 5361 5359 'PhabricatorPolicyTestCase' => 'PhabricatorTestCase', 5362 5360 'PhabricatorPolicyTestObject' => 'PhabricatorPolicyInterface', 5363 5361 'PhabricatorPolicyType' => 'PhabricatorPolicyConstants', ··· 5443 5441 'PhabricatorProjectUpdateController' => 'PhabricatorProjectController', 5444 5442 'PhabricatorProjectWatchController' => 'PhabricatorProjectController', 5445 5443 'PhabricatorProjectWikiExplainController' => 'PhabricatorProjectController', 5444 + 'PhabricatorProjectsPolicyRule' => 'PhabricatorPolicyRule', 5446 5445 'PhabricatorPygmentSetupCheck' => 'PhabricatorSetupCheck', 5447 5446 'PhabricatorRecaptchaConfigOptions' => 'PhabricatorApplicationConfigOptions', 5448 5447 'PhabricatorRedirectController' => 'PhabricatorController', ··· 5811 5810 'PhabricatorUserTestCase' => 'PhabricatorTestCase', 5812 5811 'PhabricatorUserTitleField' => 'PhabricatorUserCustomField', 5813 5812 'PhabricatorUserTransaction' => 'PhabricatorApplicationTransaction', 5813 + 'PhabricatorUsersPolicyRule' => 'PhabricatorPolicyRule', 5814 5814 'PhabricatorVCSResponse' => 'AphrontResponse', 5815 5815 'PhabricatorWatcherHasObjectEdgeType' => 'PhabricatorEdgeType', 5816 5816 'PhabricatorWordPressAuthProvider' => 'PhabricatorOAuth2AuthProvider',
+3 -3
src/applications/policy/__tests__/PhabricatorPolicyDataTestCase.php
··· 48 48 array( 49 49 array( 50 50 'action' => PhabricatorPolicy::ACTION_ALLOW, 51 - 'rule' => 'PhabricatorPolicyRuleUsers', 51 + 'rule' => 'PhabricatorUsersPolicyRule', 52 52 'value' => array($user_a->getPHID()), 53 53 ), 54 54 )) ··· 84 84 array( 85 85 array( 86 86 'action' => PhabricatorPolicy::ACTION_ALLOW, 87 - 'rule' => 'PhabricatorPolicyRuleAdministrators', 87 + 'rule' => 'PhabricatorAdministratorsPolicyRule', 88 88 'value' => null, 89 89 ), 90 90 )) ··· 118 118 array( 119 119 array( 120 120 'action' => PhabricatorPolicy::ACTION_ALLOW, 121 - 'rule' => 'PhabricatorPolicyRuleLunarPhase', 121 + 'rule' => 'PhabricatorLunarPhasePolicyRule', 122 122 'value' => 'new', 123 123 ), 124 124 ))
+1 -2
src/applications/policy/rule/PhabricatorPolicyRuleAdministrators.php src/applications/policy/rule/PhabricatorAdministratorsPolicyRule.php
··· 1 1 <?php 2 2 3 - final class PhabricatorPolicyRuleAdministrators 4 - extends PhabricatorPolicyRule { 3 + final class PhabricatorAdministratorsPolicyRule extends PhabricatorPolicyRule { 5 4 6 5 public function getRuleDescription() { 7 6 return pht('administrators');
+1 -1
src/applications/policy/rule/PhabricatorPolicyRuleLegalpadSignature.php src/applications/policy/rule/PhabricatorLegalpadSignaturePolicyRule.php
··· 1 1 <?php 2 2 3 - final class PhabricatorPolicyRuleLegalpadSignature 3 + final class PhabricatorLegalpadSignaturePolicyRule 4 4 extends PhabricatorPolicyRule { 5 5 6 6 private $signatures = array();
+1 -2
src/applications/policy/rule/PhabricatorPolicyRuleLunarPhase.php src/applications/policy/rule/PhabricatorLunarPhasePolicyRule.php
··· 1 1 <?php 2 2 3 - final class PhabricatorPolicyRuleLunarPhase 4 - extends PhabricatorPolicyRule { 3 + final class PhabricatorLunarPhasePolicyRule extends PhabricatorPolicyRule { 5 4 6 5 const PHASE_FULL = 'full'; 7 6 const PHASE_NEW = 'new';
+1 -2
src/applications/policy/rule/PhabricatorPolicyRuleProjects.php src/applications/policy/rule/PhabricatorProjectsPolicyRule.php
··· 1 1 <?php 2 2 3 - final class PhabricatorPolicyRuleProjects 4 - extends PhabricatorPolicyRule { 3 + final class PhabricatorProjectsPolicyRule extends PhabricatorPolicyRule { 5 4 6 5 private $memberships = array(); 7 6
+1 -2
src/applications/policy/rule/PhabricatorPolicyRuleUsers.php src/applications/policy/rule/PhabricatorUsersPolicyRule.php
··· 1 1 <?php 2 2 3 - final class PhabricatorPolicyRuleUsers 4 - extends PhabricatorPolicyRule { 3 + final class PhabricatorUsersPolicyRule extends PhabricatorPolicyRule { 5 4 6 5 public function getRuleDescription() { 7 6 return pht('users');