More fixes for gitolite configuration script

More usages of undefined variable.
Corrected mistake in collection of system keys.
This commit is contained in:
2020-11-03 17:08:00 +01:00
parent 57099f29d1
commit c9fb4c2945

View File

@@ -54,7 +54,7 @@ class Configuration {
$this->keys_directory = "$gitolite_root/keydir"; $this->keys_directory = "$gitolite_root/keydir";
$this->config_file = "$gitolite_root/conf/gitolite.conf"; $this->config_file = "$gitolite_root/conf/gitolite.conf";
$this->system_keys = $this->getSystemPublicKeys(); $this->collectSystemPublicKeys();
if (!file_exists($this->config_file)) { if (!file_exists($this->config_file)) {
die("Not found: $this->config_file\n"); die("Not found: $this->config_file\n");
@@ -154,7 +154,6 @@ class Configuration {
// public key duplication in the case system key is used by phabricator user. // public key duplication in the case system key is used by phabricator user.
protected function getSystemPublicKeys() { protected function getSystemPublicKeys() {
$files = scandir($this->keys_directory); $files = scandir($this->keys_directory);
$system_keys = array();
foreach ($files as $file) { foreach ($files as $file) {
if (startswith($file, "PHAB")) { if (startswith($file, "PHAB")) {
continue; continue;
@@ -167,7 +166,6 @@ class Configuration {
$this->system_keys[$key] = $file_we; $this->system_keys[$key] = $file_we;
$this->used_keys[$file_we] = true; $this->used_keys[$file_we] = true;
} }
return $system_keys;
} }
protected function removeUnusedPublicKeys() { protected function removeUnusedPublicKeys() {
@@ -324,19 +322,19 @@ function handleCustomPolicy($config, $policy) {
$rule_type = $rule['rule']; $rule_type = $rule['rule'];
if ($rule_type == 'PhabricatorPolicyRuleUsers') { if ($rule_type == 'PhabricatorPolicyRuleUsers') {
$policy_config_user_names = $policy_config_user_names =
handleUsersPolicyRule($system_keys, $rule); handleUsersPolicyRule($config, $rule);
} else if ($rule_type == 'PhabricatorProjectsPolicyRule') { } else if ($rule_type == 'PhabricatorProjectsPolicyRule') {
$policy_config_user_names = $policy_config_user_names =
handleProjectsPolicyRule($system_keys, $rule); handleProjectsPolicyRule($config, $rule);
} else if ($rule_type == 'PhabricatorProjectsAllPolicyRule') { } else if ($rule_type == 'PhabricatorProjectsAllPolicyRule') {
$policy_config_user_names = $policy_config_user_names =
handleProjectsAllPolicyRule($system_keys, $rule); handleProjectsAllPolicyRule($config $rule);
} else if ($rule_type == 'PhabricatorAdministratorsPolicyRule') { } else if ($rule_type == 'PhabricatorAdministratorsPolicyRule') {
$policy_config_user_names = $policy_config_user_names =
handleAdministratorsPolicyRule($system_keys, $rule); handleAdministratorsPolicyRule($config, $rule);
} else if ($rule_type == 'PhabricatorLegalpadSignaturePolicyRule') { } else if ($rule_type == 'PhabricatorLegalpadSignaturePolicyRule') {
$policy_config_user_names = $policy_config_user_names =
handleLegalpadSignaturePolicyRule($system_keys, $rule); handleLegalpadSignaturePolicyRule($config, $rule);
} }
$config_user_names = array_merge( $config_user_names = array_merge(