@@ -71,7 +71,6 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @param array $original_keys |
73 | 73 | * @param array $new_keys |
74 | - * @param Git_RemoteServer_GerritServerFactory $remote_gerrit_factory |
|
75 | 74 | * @return void |
76 | 75 | * @throws Git_UserSynchronisationException |
77 | 76 | */ |
@@ -118,7 +117,6 @@ discard block |
||
118 | 117 | /** |
119 | 118 | * Makes sure there is one copy of each key on each remote server |
120 | 119 | * |
121 | - * @param Git_RemoteServer_GerritServerFactory $remote_gerrit_factory |
|
122 | 120 | * @return void |
123 | 121 | * @throws Git_UserSynchronisationException |
124 | 122 | */ |
@@ -202,7 +200,7 @@ discard block |
||
202 | 200 | * |
203 | 201 | * @param array $keys_to_add |
204 | 202 | * @param array $keys_to_remove |
205 | - * @return array |
|
203 | + * @return boolean |
|
206 | 204 | */ |
207 | 205 | private function areThereKeysToUpdate(Array $keys_to_add, Array $keys_to_remove) { |
208 | 206 | return $keys_to_add || $keys_to_remove; |
@@ -36,7 +36,7 @@ |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | - /** @return bool */ |
|
39 | + /** @return boolean|null */ |
|
40 | 40 | public function areRegisteredUsersAllowedTo($permission_type, GitRepository $repository) { |
41 | 41 | if ($permission_type == Git::SPECIAL_PERM_ADMIN) { |
42 | 42 | return false; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @param Git_RemoteServer_GerritServer $server |
93 | 93 | * @param string $project_name |
94 | - * @return true if the gerrit project exists, else return false |
|
94 | + * @return boolean if the gerrit project exists, else return false |
|
95 | 95 | */ |
96 | 96 | public function doesTheParentProjectExist(Git_RemoteServer_GerritServer $server, $project_name) { |
97 | 97 | return in_array($project_name, $this->listParentProjects($server)); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * @param Git_RemoteServer_GerritServer $server |
102 | 102 | * @param string $project_name |
103 | - * @return true if the gerrit project exists, else return false |
|
103 | + * @return boolean if the gerrit project exists, else return false |
|
104 | 104 | * |
105 | 105 | * @throws Git_Driver_Gerrit_Exception |
106 | 106 | */ |
@@ -163,6 +163,9 @@ discard block |
||
163 | 163 | $this->logger->info("Gerrit: Group $group_name successfully created"); |
164 | 164 | } |
165 | 165 | |
166 | + /** |
|
167 | + * @param string $group_full_name |
|
168 | + */ |
|
166 | 169 | public function getGroupUUID(Git_RemoteServer_GerritServer $server, $group_full_name) { |
167 | 170 | $json_result = $this->getAccountGroupsInfo($server, $group_full_name); |
168 | 171 | if (isset($json_result->columns->group_uuid)) { |
@@ -176,7 +179,7 @@ discard block |
||
176 | 179 | * Can throw Git_Driver_Gerrit_RemoteSSHCommandFailure exception |
177 | 180 | * |
178 | 181 | * @param Git_RemoteServer_GerritServer $server |
179 | - * @param type $group_full_name |
|
182 | + * @param string $group_full_name |
|
180 | 183 | * |
181 | 184 | * @return type |
182 | 185 | */ |
@@ -193,6 +196,9 @@ discard block |
||
193 | 196 | return json_decode(array_shift(explode("\n", $command_result))); |
194 | 197 | } |
195 | 198 | |
199 | + /** |
|
200 | + * @param string $group_name |
|
201 | + */ |
|
196 | 202 | public function doesTheGroupExist(Git_RemoteServer_GerritServer $server, $group_name) { |
197 | 203 | return in_array($group_name, $this->listGroups($server)); |
198 | 204 | } |
@@ -223,15 +229,24 @@ discard block |
||
223 | 229 | return $group_info; |
224 | 230 | } |
225 | 231 | |
232 | + /** |
|
233 | + * @param string $command |
|
234 | + */ |
|
226 | 235 | private function computeException(Git_Driver_Gerrit_RemoteSSHCommandFailure $e, $command) { |
227 | 236 | return $this->isGerritFailure($e) ? $this->gerritDriverException($e, $command) : $e; |
228 | 237 | |
229 | 238 | } |
230 | 239 | |
240 | + /** |
|
241 | + * @param Git_Driver_Gerrit_RemoteSSHCommandFailure $e |
|
242 | + */ |
|
231 | 243 | private function isGerritFailure($e) { |
232 | 244 | return $e->getExitCode() === self::EXIT_CODE; |
233 | 245 | } |
234 | 246 | |
247 | + /** |
|
248 | + * @param Git_Driver_Gerrit_RemoteSSHCommandFailure $e |
|
249 | + */ |
|
235 | 250 | private function gerritDriverException($e, $command) { |
236 | 251 | return new Git_Driver_Gerrit_Exception("Command: $command".PHP_EOL."Error: ".$e->getStdErr()); |
237 | 252 | } |
@@ -254,7 +269,7 @@ discard block |
||
254 | 269 | * Can throw Git_Driver_Gerrit_RemoteSSHCommandFailure exception |
255 | 270 | * |
256 | 271 | * @param Git_RemoteServer_GerritServer $server |
257 | - * @param PFUser $user |
|
272 | + * @param Git_Driver_Gerrit_User $user |
|
258 | 273 | * @param String $group_name |
259 | 274 | */ |
260 | 275 | public function addUserToGroup(Git_RemoteServer_GerritServer $server, Git_Driver_Gerrit_User $user, $group_name) { |
@@ -272,7 +287,7 @@ discard block |
||
272 | 287 | * Can throw Git_Driver_Gerrit_RemoteSSHCommandFailure exception |
273 | 288 | * |
274 | 289 | * @param Git_RemoteServer_GerritServer $server |
275 | - * @param PFUser $user |
|
290 | + * @param Git_Driver_Gerrit_User $user |
|
276 | 291 | * @param String $group_name |
277 | 292 | */ |
278 | 293 | public function removeUserFromGroup(Git_RemoteServer_GerritServer $server, Git_Driver_Gerrit_User $user, $group_name) { |
@@ -310,6 +325,10 @@ discard block |
||
310 | 325 | $this->flushGerritCacheGroupsInclude($server); |
311 | 326 | } |
312 | 327 | |
328 | + /** |
|
329 | + * @param string $group_name |
|
330 | + * @param string $included_group_name |
|
331 | + */ |
|
313 | 332 | private function insertAccountGroupIncludes(Git_RemoteServer_GerritServer $server, $group_name, $included_group_name) { |
314 | 333 | $sql_query = "INSERT INTO account_group_includes (group_id, include_id) SELECT G.group_id, I.group_id FROM account_groups G, account_groups I WHERE G.name='".$group_name."' AND I.name='".$included_group_name."'"; |
315 | 334 | $this->executeQuery($server, $sql_query); |
@@ -333,14 +352,23 @@ discard block |
||
333 | 352 | $this->executeQuery($server, $sql_query); |
334 | 353 | } |
335 | 354 | |
355 | + /** |
|
356 | + * @param Git_RemoteServer_GerritServer $server |
|
357 | + */ |
|
336 | 358 | public function flushGerritCacheAccounts($server) { |
337 | 359 | $this->flushGerritCaches($server, self::CACHE_ACCOUNTS); |
338 | 360 | } |
339 | 361 | |
362 | + /** |
|
363 | + * @param Git_RemoteServer_GerritServer $server |
|
364 | + */ |
|
340 | 365 | private function flushGerritCacheGroupsInclude($server) { |
341 | 366 | $this->flushGerritCaches($server, self::CACHE_GROUPS_INCLUDES); |
342 | 367 | } |
343 | 368 | |
369 | + /** |
|
370 | + * @param string $cache |
|
371 | + */ |
|
344 | 372 | private function flushGerritCaches($server, $cache=null) { |
345 | 373 | $query = self::COMMAND .' flush-caches'; |
346 | 374 | if ($cache) { |
@@ -349,6 +377,9 @@ discard block |
||
349 | 377 | $this->ssh->execute($server, $query); |
350 | 378 | } |
351 | 379 | |
380 | + /** |
|
381 | + * @param string $string |
|
382 | + */ |
|
352 | 383 | private function escapeSQLQuery($string) { |
353 | 384 | $escaped_string = str_replace(' ', '\ ', $string); |
354 | 385 | $escaped_string = str_replace("'", "\\'", $escaped_string); |
@@ -434,6 +465,9 @@ discard block |
||
434 | 465 | return preg_match("/\s$plugin\s+[^\s]+\s+$is_enabled/", $plugins_list); |
435 | 466 | } |
436 | 467 | |
468 | + /** |
|
469 | + * @param string $plugins_list |
|
470 | + */ |
|
437 | 471 | private function isDeletePluginInstalled($plugins_list) { |
438 | 472 | return strstr($plugins_list, self::DELETEPROJECT_PLUGIN_NAME); |
439 | 473 | } |
@@ -476,7 +510,6 @@ discard block |
||
476 | 510 | |
477 | 511 | /** |
478 | 512 | * @param Git_RemoteServer_GerritServer $server |
479 | - * @param PFUser $gerrit_users_to_suspend |
|
480 | 513 | * |
481 | 514 | * @throws Git_Driver_Gerrit_Exception |
482 | 515 | */ |
@@ -191,6 +191,9 @@ discard block |
||
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
194 | + /** |
|
195 | + * @param string $group_full_name |
|
196 | + */ |
|
194 | 197 | public function getGroupUUID(Git_RemoteServer_GerritServer $server, $group_full_name) { |
195 | 198 | $group_info = $this->getGroupInfoFromGerrit($server, $group_full_name); |
196 | 199 | if (! $group_info) { |
@@ -360,6 +363,9 @@ discard block |
||
360 | 363 | } |
361 | 364 | } |
362 | 365 | |
366 | + /** |
|
367 | + * @param Git_RemoteServer_GerritServer $server |
|
368 | + */ |
|
363 | 369 | public function flushGerritCacheAccounts($server) { |
364 | 370 | return; |
365 | 371 | } |
@@ -534,6 +540,9 @@ discard block |
||
534 | 540 | } |
535 | 541 | } |
536 | 542 | |
543 | + /** |
|
544 | + * @param string $group_name |
|
545 | + */ |
|
537 | 546 | private function getAllMembers( |
538 | 547 | Git_RemoteServer_GerritServer $server, |
539 | 548 | $group_name |
@@ -554,6 +563,9 @@ discard block |
||
554 | 563 | } |
555 | 564 | } |
556 | 565 | |
566 | + /** |
|
567 | + * @param string $group_name |
|
568 | + */ |
|
557 | 569 | private function getAllIncludedGroups( |
558 | 570 | Git_RemoteServer_GerritServer $server, |
559 | 571 | $group_name |
@@ -590,6 +602,9 @@ discard block |
||
590 | 602 | } |
591 | 603 | } |
592 | 604 | |
605 | + /** |
|
606 | + * @param string $expected_ssh_key |
|
607 | + */ |
|
593 | 608 | private function getUserSSHKeyId(array $ssh_keys, $expected_ssh_key) { |
594 | 609 | $matching_keys = array(); |
595 | 610 | |
@@ -625,6 +640,9 @@ discard block |
||
625 | 640 | } |
626 | 641 | } |
627 | 642 | |
643 | + /** |
|
644 | + * @param string $ssh_key |
|
645 | + */ |
|
628 | 646 | private function escapeSSHKey($ssh_key) { |
629 | 647 | return str_replace('=', '\u003d', $ssh_key); |
630 | 648 | } |
@@ -635,6 +653,9 @@ discard block |
||
635 | 653 | return $key_parts[1]; |
636 | 654 | } |
637 | 655 | |
656 | + /** |
|
657 | + * @param string $message |
|
658 | + */ |
|
638 | 659 | private function throwGerritException($message) { |
639 | 660 | $this->logger->error($message); |
640 | 661 | throw new Git_Driver_Gerrit_Exception($message); |
@@ -661,6 +682,9 @@ discard block |
||
661 | 682 | return json_decode(substr($gerrit_response, 5), true); |
662 | 683 | } |
663 | 684 | |
685 | + /** |
|
686 | + * @param string $url |
|
687 | + */ |
|
664 | 688 | private function getGerritURL(Git_RemoteServer_GerritServer $server, $url) { |
665 | 689 | $full_url = $server->getBaseUrl().'/a'. $url; |
666 | 690 | |
@@ -688,7 +712,7 @@ discard block |
||
688 | 712 | * @param Git_RemoteServer_GerritServer $server |
689 | 713 | * @param PFUser $user |
690 | 714 | * |
691 | - * @return Guzzle\Http\Message\Response |
|
715 | + * @return boolean|null |
|
692 | 716 | */ |
693 | 717 | public function setUserAccountInactive( |
694 | 718 | Git_RemoteServer_GerritServer $server, |
@@ -38,6 +38,9 @@ |
||
38 | 38 | Git::PERM_WPLUS => ' RW+' |
39 | 39 | ); |
40 | 40 | |
41 | + /** |
|
42 | + * @param string $etc_templates_path |
|
43 | + */ |
|
41 | 44 | public function __construct(Git_Mirror_MirrorDataMapper $data_mapper, $etc_templates_path) { |
42 | 45 | $this->data_mapper = $data_mapper; |
43 | 46 | $template_dirs = array(); |
@@ -43,6 +43,9 @@ discard block |
||
43 | 43 | /** @var ProjectManager */ |
44 | 44 | private $project_manager; |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $gitolite_administration_path |
|
48 | + */ |
|
46 | 49 | public function __construct( |
47 | 50 | Git_Gitolite_ConfigPermissionsSerializer $permissions_serializer, |
48 | 51 | Git_Gitolite_ProjectSerializer $project_serializer, |
@@ -78,6 +81,10 @@ discard block |
||
78 | 81 | return $git_modifications; |
79 | 82 | } |
80 | 83 | |
84 | + /** |
|
85 | + * @param string $old_name |
|
86 | + * @param string $new_name |
|
87 | + */ |
|
81 | 88 | public function renameProject($old_name, $new_name) { |
82 | 89 | $git_modifications = new Git_Gitolite_GitModifications(); |
83 | 90 | $project = $this->project_manager->getProjectByUnixName($new_name); |
@@ -210,11 +217,18 @@ discard block |
||
210 | 217 | return 'conf/'.$hostname; |
211 | 218 | } |
212 | 219 | |
220 | + /** |
|
221 | + * @param string $config_file |
|
222 | + * @param string $config_datas |
|
223 | + */ |
|
213 | 224 | private function writeGitConfig($config_file, $config_datas, Git_Gitolite_GitModifications $git_modifications) { |
214 | 225 | file_put_contents($config_file, $config_datas); |
215 | 226 | $git_modifications->add($config_file); |
216 | 227 | } |
217 | 228 | |
229 | + /** |
|
230 | + * @param string $content |
|
231 | + */ |
|
218 | 232 | private function writeGitoliteConfigurationOnDisk($content, Git_Gitolite_GitModifications $git_modifications) { |
219 | 233 | file_put_contents($this->getGitoliteConfFilePath(), $content); |
220 | 234 | $git_modifications->add(self::GITOLITE_CONF_FILE); |
@@ -250,12 +264,18 @@ discard block |
||
250 | 264 | $git_modifications->add($file_path); |
251 | 265 | } |
252 | 266 | |
267 | + /** |
|
268 | + * @param string $file_path |
|
269 | + */ |
|
253 | 270 | private function proceedRenameInMirrorIncluderConf($hostname, $file_path, $old_name, $new_name) { |
254 | 271 | $orig = file_get_contents($file_path); |
255 | 272 | $dest = str_replace('include "' . $hostname . '/'. $old_name .'.conf"', 'include "'. $hostname .'/'. $new_name .'.conf"', $orig); |
256 | 273 | file_put_contents($file_path, $dest); |
257 | 274 | } |
258 | 275 | |
276 | + /** |
|
277 | + * @param string $file_path |
|
278 | + */ |
|
259 | 279 | private function proceedRenameInIncluderConf($file_path, $old_name, $new_name) { |
260 | 280 | $orig = file_get_contents($file_path); |
261 | 281 | $dest = str_replace('include "projects/'. $old_name .'.conf"', 'include "projects/'. $new_name .'.conf"', $orig); |
@@ -289,6 +309,9 @@ discard block |
||
289 | 309 | $git_modifications->add($original_file); |
290 | 310 | } |
291 | 311 | |
312 | + /** |
|
313 | + * @param string $project_file_path |
|
314 | + */ |
|
292 | 315 | private function proceedToRenameInSpecifiedProjectFile($project_file_path, $old_name, $new_name) { |
293 | 316 | $orig = file_get_contents($project_file_path); |
294 | 317 | |
@@ -317,6 +340,10 @@ discard block |
||
317 | 340 | |
318 | 341 | } |
319 | 342 | |
343 | + /** |
|
344 | + * @param string $old_file |
|
345 | + * @param string $new_file |
|
346 | + */ |
|
320 | 347 | private function proceedToFileMove($old_file, $new_file, Git_Gitolite_GitModifications $git_modifications) { |
321 | 348 | if (is_file($old_file)) { |
322 | 349 | $git_modifications->move($old_file, $new_file); |
@@ -334,6 +361,9 @@ discard block |
||
334 | 361 | $this->proceedToFileMove($old_file, $new_file, $git_modifications); |
335 | 362 | } |
336 | 363 | |
364 | + /** |
|
365 | + * @param string $hostname |
|
366 | + */ |
|
337 | 367 | private function writeGitoliteIncludesInHostnameFile($hostname, Git_Gitolite_GitModifications $git_modifications, array $project_list) { |
338 | 368 | $hostname_config_file = $this->getFullConfigFilePathFromHostname($hostname); |
339 | 369 | |
@@ -370,6 +400,9 @@ discard block |
||
370 | 400 | return $this->readProjectListFromPath($dir_path); |
371 | 401 | } |
372 | 402 | |
403 | + /** |
|
404 | + * @param string $dir_path |
|
405 | + */ |
|
373 | 406 | private function readProjectListFromPath($dir_path) { |
374 | 407 | $project_names = array(); |
375 | 408 |
@@ -37,6 +37,10 @@ |
||
37 | 37 | /** @var BackendService */ |
38 | 38 | private $backend_service; |
39 | 39 | |
40 | + /** |
|
41 | + * @param string $gitolite_var_path |
|
42 | + * @param string $remote_admin_repository |
|
43 | + */ |
|
40 | 44 | public function __construct( |
41 | 45 | SystemEventProcessManager $process_manager, |
42 | 46 | SystemEventProcess $process, |
@@ -42,6 +42,9 @@ |
||
42 | 42 | $this->reference_manager = $reference_manager; |
43 | 43 | } |
44 | 44 | |
45 | + /** |
|
46 | + * @param string $commit_sha1 |
|
47 | + */ |
|
45 | 48 | public function execute(Git_Hook_PushDetails $push_details, $commit_sha1) { |
46 | 49 | $rev_id = $push_details->getRepository()->getFullName().'/'.$commit_sha1; |
47 | 50 | $text = $this->git_exec->catFile($commit_sha1); |
@@ -47,6 +47,9 @@ |
||
47 | 47 | private $user; |
48 | 48 | private $refname; |
49 | 49 | |
50 | + /** |
|
51 | + * @param string $rev_type |
|
52 | + */ |
|
50 | 53 | public function __construct(GitRepository $repository, PFUser $user, $refname, $type, $rev_type, array $revision_list) { |
51 | 54 | $this->repository = $repository; |
52 | 55 | $this->user = $user; |