@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | /** |
116 | 116 | * |
117 | - * @param GitRepository $respository |
|
117 | + * @param GitRepository $repository |
|
118 | 118 | * @return bool |
119 | 119 | */ |
120 | 120 | public function isCreated(GitRepository $repository) { |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param Statistics_Formatter $formatter instance of statistics formatter class |
321 | 321 | * @param String $type backend type |
322 | 322 | * @param Array $typeIndex backend type index |
323 | - * @param Array $typeArray backend type array |
|
323 | + * @param string[] $typeArray backend type array |
|
324 | 324 | * @param Boolean $keepedAlive keep only reposirtories that still active |
325 | 325 | * |
326 | 326 | * @return Void |
@@ -69,6 +69,9 @@ discard block |
||
69 | 69 | $this->tableName = $tableName; |
70 | 70 | } |
71 | 71 | |
72 | + /** |
|
73 | + * @param string $id |
|
74 | + */ |
|
72 | 75 | public function exists($id) { |
73 | 76 | if ( empty($id) ) { |
74 | 77 | return false; |
@@ -213,6 +216,9 @@ discard block |
||
213 | 216 | return false; |
214 | 217 | } |
215 | 218 | |
219 | + /** |
|
220 | + * @param string $newName |
|
221 | + */ |
|
216 | 222 | public function renameProject(Project $project, $newName) { |
217 | 223 | $oldPath = $this->da->quoteSmart($project->getUnixName().'/'); |
218 | 224 | $newPath = $this->da->quoteSmart($newName.'/'); |
@@ -284,6 +290,7 @@ discard block |
||
284 | 290 | /** |
285 | 291 | * Return the list of users that owns repositories in the project $projectId |
286 | 292 | * |
293 | + * @param integer $projectId |
|
287 | 294 | * @return DataAccessResult |
288 | 295 | */ |
289 | 296 | public function getProjectRepositoriesOwners($projectId) { |
@@ -298,6 +305,9 @@ discard block |
||
298 | 305 | return $this->retrieve($sql); |
299 | 306 | } |
300 | 307 | |
308 | + /** |
|
309 | + * @param integer $projectId |
|
310 | + */ |
|
301 | 311 | public function getAllGitoliteRespositories($projectId) { |
302 | 312 | $projectId = $this->da->escapeInt($projectId); |
303 | 313 | $type_gitolite = $this->da->quoteSmart(self::BACKEND_GITOLITE); |
@@ -359,6 +369,9 @@ discard block |
||
359 | 369 | return $this->retrieve($query); |
360 | 370 | } |
361 | 371 | |
372 | + /** |
|
373 | + * @param GitRepository $repository |
|
374 | + */ |
|
362 | 375 | public function hasChild($repository) { |
363 | 376 | $repoId = $this->da->escapeInt( $repository->getId() ); |
364 | 377 | if ( empty($repoId) ) { |
@@ -382,9 +395,12 @@ discard block |
||
382 | 395 | * This function log a Git Push in the database |
383 | 396 | * |
384 | 397 | * @param Integer $repoId Id of the git repository |
385 | - * @param Integer $UserId Id of the user that performed the push |
|
398 | + * @param Integer $userId Id of the user that performed the push |
|
386 | 399 | * @param Integer $pushTimestamp Date of the push |
387 | 400 | * @param Integer $commitsNumber Number of commits |
401 | + * @param string $refname |
|
402 | + * @param string $operation_type |
|
403 | + * @param string $refname_type |
|
388 | 404 | * |
389 | 405 | * @return Boolean |
390 | 406 | */ |
@@ -416,6 +432,9 @@ discard block |
||
416 | 432 | return $this->update($query); |
417 | 433 | } |
418 | 434 | |
435 | + /** |
|
436 | + * @param GitRepository $repository |
|
437 | + */ |
|
419 | 438 | public function getProjectRepositoryById($repository) { |
420 | 439 | $id = (int)$repository->getId(); |
421 | 440 | if ( empty($id) ) { |
@@ -449,6 +468,9 @@ discard block |
||
449 | 468 | return $this->retrieve($query); |
450 | 469 | } |
451 | 470 | |
471 | + /** |
|
472 | + * @param integer $id |
|
473 | + */ |
|
452 | 474 | public function searchDeletedRepositoryById($id) { |
453 | 475 | $id = $this->da->escapeInt($id); |
454 | 476 | $query = 'SELECT * '. |
@@ -540,6 +562,10 @@ discard block |
||
540 | 562 | return $this->retrieve($query); |
541 | 563 | } |
542 | 564 | |
565 | + /** |
|
566 | + * @param integer $project_id |
|
567 | + * @param string $path |
|
568 | + */ |
|
543 | 569 | public function isRepositoryExisting($project_id, $path) { |
544 | 570 | $project_id = $this->da->escapeInt($project_id); |
545 | 571 | $path = $this->da->quoteSmart($path); |
@@ -602,6 +628,10 @@ discard block |
||
602 | 628 | return count($this->retrieve($sql)) > 0; |
603 | 629 | } |
604 | 630 | |
631 | + /** |
|
632 | + * @param integer $project_id |
|
633 | + * @param integer[] $ugroup_ids |
|
634 | + */ |
|
605 | 635 | public function searchGerritRepositoriesWithPermissionsForUGroupAndProject($project_id, $ugroup_ids) { |
606 | 636 | $project_id = $this->da->escapeInt($project_id); |
607 | 637 | $ugroup_ids = $this->da->escapeIntImplode($ugroup_ids); |
@@ -621,6 +651,9 @@ discard block |
||
621 | 651 | |
622 | 652 | } |
623 | 653 | |
654 | + /** |
|
655 | + * @param integer $project_id |
|
656 | + */ |
|
624 | 657 | public function searchAllGerritRepositoriesOfProject($project_id) { |
625 | 658 | $project_id = $this->da->escapeInt($project_id); |
626 | 659 | $sql = "SELECT * |
@@ -690,7 +723,7 @@ discard block |
||
690 | 723 | * |
691 | 724 | * @param Int $repository_id |
692 | 725 | * |
693 | - * @return GitDaoException | true |
|
726 | + * @return boolean | true |
|
694 | 727 | */ |
695 | 728 | public function activate($repository_id) { |
696 | 729 | $id = $this->da->escapeInt($repository_id); |
@@ -701,6 +734,9 @@ discard block |
||
701 | 734 | return $this->update($query); |
702 | 735 | } |
703 | 736 | |
737 | + /** |
|
738 | + * @param integer $project_id |
|
739 | + */ |
|
704 | 740 | public function getPaginatedOpenRepositories($project_id, $limit, $offset) { |
705 | 741 | $project_id = $this->da->escapeInt($project_id); |
706 | 742 | $limit = $this->da->escapeInt($limit); |
@@ -34,6 +34,10 @@ discard block |
||
34 | 34 | public function __construct() { |
35 | 35 | } |
36 | 36 | |
37 | + /** |
|
38 | + * @param string $cmd |
|
39 | + * @param string $action_name |
|
40 | + */ |
|
37 | 41 | protected function execGitAction($cmd, $action_name) { |
38 | 42 | $out = array(); |
39 | 43 | $ret = -1; |
@@ -55,7 +59,7 @@ discard block |
||
55 | 59 | * Make a clone of a source repository |
56 | 60 | * @param <String> $source source directory |
57 | 61 | * @param <String> $destination destination directory |
58 | - * @param <String> $option String of options. |
|
62 | + * @param string $option String of options. |
|
59 | 63 | * @return <boolean> |
60 | 64 | */ |
61 | 65 | private function cloneRepo($source, $destination, $option) { |
@@ -67,6 +71,10 @@ discard block |
||
67 | 71 | return $this->execGitAction($cmd, "clone"); |
68 | 72 | } |
69 | 73 | |
74 | + /** |
|
75 | + * @param string $source |
|
76 | + * @param string $destination |
|
77 | + */ |
|
70 | 78 | public function fork($source, $destination) { |
71 | 79 | $this->checkFileExist($source); |
72 | 80 | |
@@ -75,12 +83,22 @@ discard block |
||
75 | 83 | return $this->setUpFreshRepository($destination); |
76 | 84 | } |
77 | 85 | |
86 | + /** |
|
87 | + * @param string $source |
|
88 | + * @param string $destination |
|
89 | + * @param string $branch |
|
90 | + */ |
|
78 | 91 | public function cloneAtSpecifiqBranch($source, $destination, $branch) { |
79 | 92 | $this->checkFileExist($source); |
80 | 93 | |
81 | 94 | return $this->cloneRepo($source, $destination, '--branch '.$branch); |
82 | 95 | } |
83 | 96 | |
97 | + /** |
|
98 | + * @param string $repositoryPath |
|
99 | + * @param string $email |
|
100 | + * @param string $name |
|
101 | + */ |
|
84 | 102 | public function changeGitUserInfo($repositoryPath, $email, $name) { |
85 | 103 | $this->checkFileExist($repositoryPath); |
86 | 104 | $cmdEmail = 'cd '. escapeshellarg($repositoryPath).' && git config --local user.email '.escapeshellarg($email).' 2>&1'; |
@@ -89,6 +107,10 @@ discard block |
||
89 | 107 | return $this->execGitAction($cmdEmail, 'change user email').' '.$this->execGitAction($cmdName, 'change user name'); |
90 | 108 | } |
91 | 109 | |
110 | + /** |
|
111 | + * @param string $repositoryPath |
|
112 | + * @param string $filePathFromRepository |
|
113 | + */ |
|
92 | 114 | public function add($repositoryPath, $filePathFromRepository) { |
93 | 115 | $this->checkFileExist($repositoryPath); |
94 | 116 | $cmd = 'cd '.escapeshellarg($repositoryPath).' && git add '.escapeshellarg($filePathFromRepository).' 2>&1'; |
@@ -96,6 +118,10 @@ discard block |
||
96 | 118 | return $this->execGitAction($cmd, 'add'); |
97 | 119 | } |
98 | 120 | |
121 | + /** |
|
122 | + * @param string $repositoryPath |
|
123 | + * @param string $message |
|
124 | + */ |
|
99 | 125 | public function commit($repositoryPath, $message) { |
100 | 126 | $this->checkFileExist($repositoryPath); |
101 | 127 | $cmd = 'cd '.escapeshellarg($repositoryPath).' && git commit --allow-empty -m '.escapeshellarg($message).' 2>&1'; |
@@ -103,6 +129,10 @@ discard block |
||
103 | 129 | return $this->execGitAction($cmd, 'commit'); |
104 | 130 | } |
105 | 131 | |
132 | + /** |
|
133 | + * @param string $repositoryPath |
|
134 | + * @param string $bareURL |
|
135 | + */ |
|
106 | 136 | public function mergeAndPush($repositoryPath, $bareURL) { |
107 | 137 | $this->checkFileExist($repositoryPath); |
108 | 138 | $cmd = 'cd '.escapeshellarg($repositoryPath).' && git pull --quiet --rebase && git push '. $bareURL .' 2>&1'; |
@@ -117,6 +147,9 @@ discard block |
||
117 | 147 | return $this->execGitAction($cmd, 'get informations'); |
118 | 148 | } |
119 | 149 | |
150 | + /** |
|
151 | + * @param string $repositoryPath |
|
152 | + */ |
|
120 | 153 | public function removeRepository($repositoryPath) { |
121 | 154 | $this->checkFileExist($repositoryPath); |
122 | 155 | $cmd = 'rm --recursive --dir --force '.escapeshellarg($repositoryPath).' 2>&1'; |
@@ -124,6 +157,9 @@ discard block |
||
124 | 157 | return $this->execGitAction($cmd, 'rm'); |
125 | 158 | } |
126 | 159 | |
160 | + /** |
|
161 | + * @return string |
|
162 | + */ |
|
127 | 163 | public function getGitVersion() { |
128 | 164 | $cmd = 'git --version'; |
129 | 165 | $cmd_result = $this->execGitAction($cmd, 'version'); |
@@ -187,6 +223,9 @@ discard block |
||
187 | 223 | return $this->setPermissions($path); |
188 | 224 | } |
189 | 225 | |
226 | + /** |
|
227 | + * @param string $path |
|
228 | + */ |
|
190 | 229 | public function delete($path) { |
191 | 230 | if ( empty($path) || !is_writable($path) ) { |
192 | 231 | throw new GitDriverErrorException('Empty path or permission denied '.$path); |
@@ -199,6 +238,10 @@ discard block |
||
199 | 238 | return true; |
200 | 239 | } |
201 | 240 | |
241 | + /** |
|
242 | + * @param string $hookName |
|
243 | + * @param string $repoPath |
|
244 | + */ |
|
202 | 245 | public function activateHook($hookName, $repoPath, $uid=false, $gid=false) { |
203 | 246 | //newer version of git |
204 | 247 | $hook = $repoPath.'/hooks/'.$hookName; |
@@ -225,6 +268,9 @@ discard block |
||
225 | 268 | return true; |
226 | 269 | } |
227 | 270 | |
271 | + /** |
|
272 | + * @param string $repoPath |
|
273 | + */ |
|
228 | 274 | public function masterExists($repoPath) { |
229 | 275 | if ( file_exists($repoPath.'/refs/heads/master') ) { |
230 | 276 | return true; |
@@ -241,6 +287,10 @@ discard block |
||
241 | 287 | return is_dir($repoPath.'/refs/heads'); |
242 | 288 | } |
243 | 289 | |
290 | + /** |
|
291 | + * @param string $repoPath |
|
292 | + * @param string $description |
|
293 | + */ |
|
244 | 294 | public function setDescription($repoPath, $description) { |
245 | 295 | if( ! file_put_contents($repoPath.'/description', $description) ) { |
246 | 296 | throw new GitDriverErrorException('Unable to set description'); |
@@ -248,6 +298,9 @@ discard block |
||
248 | 298 | return true; |
249 | 299 | } |
250 | 300 | |
301 | + /** |
|
302 | + * @param string $repoPath |
|
303 | + */ |
|
251 | 304 | public function getDescription($repoPath) { |
252 | 305 | return file_get_contents($repoPath.'/description'); |
253 | 306 | } |
@@ -70,10 +70,16 @@ |
||
70 | 70 | return permission_db_authorized_ugroups(Git::PERM_ADMIN, $project->getID()); |
71 | 71 | } |
72 | 72 | |
73 | + /** |
|
74 | + * @return integer |
|
75 | + */ |
|
73 | 76 | private function getDefaultGitAdminPermissions() { |
74 | 77 | return permission_db_get_defaults(Git::PERM_ADMIN); |
75 | 78 | } |
76 | 79 | |
80 | + /** |
|
81 | + * @param integer $project_id |
|
82 | + */ |
|
77 | 83 | public function getCurrentGitAdminUgroups($project_id) { |
78 | 84 | return $this->permissions_manager->getAuthorizedUgroupIds($project_id, Git::PERM_ADMIN); |
79 | 85 | } |
@@ -46,6 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | const SERVICE_SHORTNAME = 'plugin_git'; |
48 | 48 | |
49 | + /** |
|
50 | + * @param integer $id |
|
51 | + */ |
|
49 | 52 | public function __construct($id) { |
50 | 53 | parent::__construct($id); |
51 | 54 | $this->setScope(Plugin::SCOPE_PROJECT); |
@@ -593,7 +596,6 @@ discard block |
||
593 | 596 | |
594 | 597 | /** |
595 | 598 | * |
596 | - * @param PFUser $user |
|
597 | 599 | * @return Git_UserAccountManager |
598 | 600 | */ |
599 | 601 | private function getUserAccountManager() { |
@@ -689,6 +691,9 @@ discard block |
||
689 | 691 | $this->getLogger()->info('Successfully pushed ssh keys for user: '.$user->getUnixName()); |
690 | 692 | } |
691 | 693 | |
694 | + /** |
|
695 | + * @return PFUser |
|
696 | + */ |
|
692 | 697 | private function getUserFromParameters($params) { |
693 | 698 | if (! isset($params['user']) || ! $params['user'] instanceof PFUser) { |
694 | 699 | $this->getLogger()->error('Invalid user passed in params: ' . print_r($params, true)); |
@@ -1083,6 +1088,9 @@ discard block |
||
1083 | 1088 | } |
1084 | 1089 | |
1085 | 1090 | |
1091 | + /** |
|
1092 | + * @return ProjectUGroup |
|
1093 | + */ |
|
1086 | 1094 | private function getUGroupFromParams(array $params) { |
1087 | 1095 | if (isset($params['ugroup'])) { |
1088 | 1096 | return $params['ugroup']; |
@@ -26,6 +26,9 @@ |
||
26 | 26 | */ |
27 | 27 | class GitPluginInfo extends PluginFileInfo { |
28 | 28 | |
29 | + /** |
|
30 | + * @param GitPlugin $plugin |
|
31 | + */ |
|
29 | 32 | public function __construct( $plugin ) { |
30 | 33 | parent::__construct($plugin, 'config'); |
31 | 34 | $this->setPluginDescriptor( new GitPluginDescriptor() ); |
@@ -426,6 +426,9 @@ discard block |
||
426 | 426 | return $this->creationDate; |
427 | 427 | } |
428 | 428 | |
429 | + /** |
|
430 | + * @param PFUser $user |
|
431 | + */ |
|
429 | 432 | public function setCreator($user) { |
430 | 433 | $this->creator = $user; |
431 | 434 | } |
@@ -695,6 +698,7 @@ discard block |
||
695 | 698 | |
696 | 699 | /** |
697 | 700 | * Rename project |
701 | + * @param string $newName |
|
698 | 702 | */ |
699 | 703 | public function renameProject(Project $project, $newName) { |
700 | 704 | $newName = strtolower($newName); |
@@ -780,6 +784,9 @@ discard block |
||
780 | 784 | return $this->getBackend()->userCanRead($user, $this); |
781 | 785 | } |
782 | 786 | |
787 | + /** |
|
788 | + * @param PFUser $user |
|
789 | + */ |
|
783 | 790 | public function userCanEditOnline($user) { |
784 | 791 | return $user->hasPermission(Git::PERM_WRITE, $this->getId(), $this->getProjectId()) && $this->use_online_edit; |
785 | 792 | } |
@@ -839,7 +846,7 @@ discard block |
||
839 | 846 | * |
840 | 847 | * @param PFUser $user the user |
841 | 848 | * |
842 | - * @return true if the repo is a personnal rep and if it is created by $user |
|
849 | + * @return boolean if the repo is a personnal rep and if it is created by $user |
|
843 | 850 | */ |
844 | 851 | public function belongsTo(PFUser $user) { |
845 | 852 | return $this->getScope() == self::REPO_SCOPE_INDIVIDUAL && $this->getCreatorId() == $user->getId(); |
@@ -854,6 +861,9 @@ discard block |
||
854 | 861 | $this->remote_server_id = $id; |
855 | 862 | } |
856 | 863 | |
864 | + /** |
|
865 | + * @return integer |
|
866 | + */ |
|
857 | 867 | public function getRemoteServerId() { |
858 | 868 | return $this->remote_server_id; |
859 | 869 | } |
@@ -53,6 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * Get a project repository by its id |
55 | 55 | * |
56 | + * @param integer $id |
|
56 | 57 | * @return GitRepository the repository or null if not found |
57 | 58 | */ |
58 | 59 | public function getRepositoryByIdUserCanSee(PFUser $user, $id) { |
@@ -139,7 +140,6 @@ discard block |
||
139 | 140 | /** |
140 | 141 | * Get a project repository by its id |
141 | 142 | * |
142 | - * @param int $id The id of the repository to load |
|
143 | 143 | * |
144 | 144 | * @return GitRepository the repository or null if not found |
145 | 145 | */ |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | /** |
235 | 235 | * Attempt to get repository if path match given base directory |
236 | 236 | * |
237 | - * @param type $base_dir A top level directory that can contains repo |
|
238 | - * @param type $path Full repository path |
|
237 | + * @param string $base_dir A top level directory that can contains repo |
|
238 | + * @param string $path Full repository path |
|
239 | 239 | * |
240 | 240 | * @return GitRepository |
241 | 241 | */ |
@@ -309,6 +309,7 @@ discard block |
||
309 | 309 | * Get the list of all repositories for a given project |
310 | 310 | * |
311 | 311 | * @param Int $project_id |
312 | + * @param integer $retention_period |
|
312 | 313 | * |
313 | 314 | * @return GitRepository[] |
314 | 315 | */ |
@@ -96,6 +96,9 @@ discard block |
||
96 | 96 | $this->git_system_event_manager->queueRepositoryUpdate($repository); |
97 | 97 | } |
98 | 98 | |
99 | + /** |
|
100 | + * @param string $bundle_path |
|
101 | + */ |
|
99 | 102 | public function createFromBundle(GitRepository $repository, GitRepositoryCreator $creator, $bundle_path) { |
100 | 103 | if (!$creator->isNameValid($repository->getName())) { |
101 | 104 | throw new Exception($GLOBALS['Language']->getText('plugin_git', 'actions_input_format_error', array($creator->getAllowedCharsInNamePattern(), GitDao::REPO_NAME_MAX_LENGTH))); |
@@ -173,6 +176,9 @@ discard block |
||
173 | 176 | throw new Exception($GLOBALS['Language']->getText('plugin_git', 'actions_no_repository_forked')); |
174 | 177 | } |
175 | 178 | |
179 | + /** |
|
180 | + * @param string $namespace |
|
181 | + */ |
|
176 | 182 | private function isNamespaceValid(GitRepository $repository, $namespace) { |
177 | 183 | if ($namespace) { |
178 | 184 | $ns_chunk = explode('/', $namespace); |
@@ -186,6 +192,10 @@ discard block |
||
186 | 192 | return true; |
187 | 193 | } |
188 | 194 | |
195 | + /** |
|
196 | + * @param string $namespace |
|
197 | + * @param string $scope |
|
198 | + */ |
|
189 | 199 | private function forkAllRepositories(array $repos, PFUser $user, $namespace, $scope, Project $project, array $forkPermissions) { |
190 | 200 | $forked = false; |
191 | 201 | foreach ($repos as $repo) { |
@@ -206,10 +216,8 @@ discard block |
||
206 | 216 | /** |
207 | 217 | * Return true if proposed name already exists as a repository path |
208 | 218 | * |
209 | - * @param Project $project |
|
210 | - * @param String $name |
|
211 | 219 | * |
212 | - * @return Boolean |
|
220 | + * @return boolean|null |
|
213 | 221 | */ |
214 | 222 | public function isRepositoryNameAlreadyUsed(GitRepository $new_repository) { |
215 | 223 | $repositories = $this->repository_factory->getAllRepositories($new_repository->getProject()); |
@@ -228,6 +236,9 @@ discard block |
||
228 | 236 | } |
229 | 237 | } |
230 | 238 | |
239 | + /** |
|
240 | + * @param string $new_path |
|
241 | + */ |
|
231 | 242 | private function nameIsSubPathOfExistingRepository($repository_path, $new_path) { |
232 | 243 | $repo_path_without_dot_git = $this->stripFinalDotGit($repository_path); |
233 | 244 | if (strpos($new_path, "$repo_path_without_dot_git/") === 0) { |
@@ -236,6 +247,9 @@ discard block |
||
236 | 247 | return false; |
237 | 248 | } |
238 | 249 | |
250 | + /** |
|
251 | + * @param string $new_path |
|
252 | + */ |
|
239 | 253 | private function nameAlreadyExistsAsPath($repository_path, $new_path) { |
240 | 254 | $new_path = $this->stripFinalDotGit($new_path); |
241 | 255 | if (strpos($repository_path, "$new_path/") === 0) { |