3 * FusionForge Git plugin
5 * Copyright 2009, Roland Mas
6 * Copyright 2009, Mehdi Dogguy <mehdi@debian.org>
7 * Copyright 2012, Franck Villaume - TrivialDev
9 * Thorsten Glaser <t.glaser@tarent.de>
11 * This file is part of FusionForge.
13 * FusionForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published
15 * by the Free Software Foundation; either version 2 of the License,
16 * or (at your option) any later version.
18 * FusionForge is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 forge_define_config_item('default_server', 'scmgit', forge_get_config ('web_host')) ;
29 forge_define_config_item('repos_path', 'scmgit', forge_get_config('chroot').'/scmrepos/git') ;
31 class GitPlugin extends SCMPlugin {
32 function GitPlugin() {
34 $this->name = 'scmgit';
36 $this->_addHook('scm_browser_page');
37 $this->_addHook('scm_update_repolist');
38 $this->_addHook('scm_generate_snapshots');
39 $this->_addHook('scm_gather_stats');
40 $this->_addHook('widget_instance', 'myPageBox', false);
41 $this->_addHook('widgets', 'widgets', false);
45 function getDefaultServer() {
46 return forge_get_config('default_server', 'scmgit') ;
49 function printShortStats ($params) {
50 $project = $this->checkParams($params);
55 if ($project->usesPlugin($this->name)) {
56 $result = db_query_params('SELECT sum(commits) AS commits, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
57 array ($project->getID())) ;
58 $commit_num = db_result($result,0,'commits');
59 $add_num = db_result($result,0,'adds');
66 echo ' (Git: '.sprintf(_('<strong>%1$s</strong> commits, <strong>%2$s</strong> adds'), number_format($commit_num, 0), number_format($add_num, 0)).")";
71 return '<p>' . _('Documentation for Git is available at <a href="http://git-scm.com/">http://git-scm.com/</a>.') . '</p>';
74 function getInstructionsForAnon($project) {
75 $b = '<h2>' . _('Anonymous Git Access') . '</h2>';
77 $b .= _('This project\'s Git repository can be checked out through anonymous access with the following command.');
81 $b .= '<tt>git clone '.util_make_url ('/anonscm/git/'.$project->getUnixName().'/'.$project->getUnixName().'.git').'</tt><br />';
84 $result = db_query_params('SELECT u.user_id, u.user_name, u.realname FROM plugin_scmgit_personal_repos p, users u WHERE p.group_id=$1 AND u.user_id=p.user_id AND u.unix_status=$2',
85 array ($project->getID(),
87 $rows = db_numrows($result);
91 $b .= _('Developer\'s repository');
94 $b .= ngettext('One of this project\'s members also has a personal Git repository that can be checked out anonymously.',
95 'Some of this project\'s members also have personal Git repositories that can be checked out anonymously.',
99 for ($i=0; $i<$rows; $i++) {
100 $user_id = db_result($result,$i,'user_id');
101 $user_name = db_result($result,$i,'user_name');
102 $real_name = db_result($result,$i,'realname');
103 $b .= '<tt>git clone '.util_make_url('/anonscm/git/'.$project->getUnixName().'/users/'.$user_name.'.git').'</tt> ('.util_make_link_u ($user_name, $user_id, $real_name).')<br />';
111 function getInstructionsForRW($project) {
113 if (session_loggedin()) {
114 $u = user_get_object(user_getid());
115 $d = $u->getUnixName();
116 if (forge_get_config('use_ssh', 'scmgit')) {
118 $b .= _('Developer Git Access via SSH');
121 $b .= _('Only project developers can access the Git tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
123 $b .= '<p><tt>git clone git+ssh://'.$d.'@' . $this->getBoxForProject($project) . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
124 } elseif (forge_get_config('use_dav', 'scmgit')) {
125 $protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
127 $b .= _('Developer Git Access via HTTP');
130 $b .= _('Only project developers can access the Git tree via this method. Enter your site password when prompted.');
132 $b .= '<p><tt>git clone '.$protocol.'://'.$d.'@' . $this->getBoxForProject($project) . '/'. forge_get_config('scm_root', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
134 $b = '<p class="warning">'._('Missing configuration for access in scmgit.ini : use_ssh and use_dav disabled').'</p>';
137 if (forge_get_config('use_ssh', 'scmgit')) {
139 $b .= _('Developer Git Access via SSH');
142 $b .= _('Only project developers can access the Git tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.');
144 $b .= '<p><tt>git clone git+ssh://<i>'._('developername').'</i>@' . $this->getBoxForProject($project) . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
145 } elseif (forge_get_config('use_dav', 'scmgit')) {
146 $protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
148 $b .= _('Developer Git Access via HTTP');
151 $b .= _('Only project developers can access the Git tree via this method. Enter your site password when prompted.');
153 $b .= '<p><tt>git clone '.$protocol.'://<i>'._('developername').'</i>@' . $this->getBoxForProject($project) . '/'. forge_get_config('scm_root', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
157 if (session_loggedin()) {
158 $u =& user_get_object(user_getid()) ;
159 if ($u->getUnixStatus() == 'A') {
160 $result = db_query_params('SELECT * FROM plugin_scmgit_personal_repos p WHERE p.group_id=$1 AND p.user_id=$2',
161 array ($project->getID(),
163 if ($result && db_numrows ($result) > 0) {
165 $b .= _('Access to your personal repository');
168 $b .= _('You have a personal repository for this project, accessible through SSH with the following method. Enter your site password when prompted.');
170 $b .= '<p><tt>git clone git+ssh://'.$u->getUnixName().'@' . $this->getBoxForProject($project) . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/users/'. $u->getUnixName() .'.git</tt></p>' ;
172 $glist = $u->getGroups();
173 foreach ($glist as $g) {
174 if ($g->getID() == $project->getID()) {
176 $b .= _('Request a personal repository');
179 $b .= _('You can clone the project repository into a personal one into which you alone will be able to write. Other members of the project will only have read access. Access for non-members will follow the same rules as for the project\'s main repository. Note that the personal repository may take some time before it is created (less than an hour in most situations).');
182 $b .= sprintf (_('<a href="%s">Request a personal repository</a>.'),
183 util_make_url ('/plugins/scmgit/index.php?func=request-personal-repo&group_id='.$project->getID()));
193 function getSnapshotPara($project) {
196 $filename = $project->getUnixName().'-scm-latest.tar'.util_get_compressed_file_extension();
197 if (file_exists(forge_get_config('scm_snapshots_path').'/'.$filename)) {
199 $b .= util_make_link("/snapshots.php?group_id=".$project->getID(),
200 _('Download the nightly snapshot')
207 function printBrowserPage($params) {
208 $project = $this->checkParams($params);
213 if ($project->usesPlugin($this->name)) {
214 if ($this->browserDisplayable($project)) {
215 print '<iframe src="'.util_make_url("/plugins/scmgit/cgi-bin/gitweb.cgi?p=".$project->getUnixName().'/'.$project->getUnixName().'.git').'" frameborder="0" width=100% height=700></iframe>' ;
220 function getBrowserLinkBlock($project) {
222 $b = $HTML->boxMiddle(_('Git Repository Browser'));
224 $b .= _('Browsing the Git tree gives you a view into the current status of this project\'s code. You may also view the complete histories of any file in the repository.');
227 $b .= util_make_link ("/scm/browser.php?group_id=".$project->getID(),
228 _('Browse Git Repository')
234 function getStatsBlock ($project) {
238 $result = db_query_params('SELECT u.realname, u.user_name, u.user_id, sum(commits) as commits, sum(adds) as adds, sum(adds+commits) as combined FROM stats_cvs_user s, users u WHERE group_id=$1 AND s.user_id=u.user_id AND (commits>0 OR adds >0) GROUP BY u.user_id, realname, user_name, u.user_id ORDER BY combined DESC, realname',
239 array ($project->getID()));
241 if (db_numrows($result) > 0) {
242 // $b .= $HTML->boxMiddle(_('Repository Statistics'));
244 $tableHeaders = array(
249 $b .= $HTML->listTableTop($tableHeaders, false, '', 'repo-history');
252 $total = array('adds' => 0, 'commits' => 0);
254 while($data = db_fetch_array($result)) {
255 $b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
256 $b .= '<td class="halfwidth">' ;
257 $b .= util_make_link_u ($data['user_name'], $data['user_id'], $data['realname']) ;
258 $b .= '</td><td class="onequarterwidth align-right">'.$data['adds']. '</td>'.
259 '<td class="onequarterwidth align-right">'.$data['commits'].'</td></tr>';
260 $total['adds'] += $data['adds'];
261 $total['commits'] += $data['commits'];
264 $b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
265 $b .= '<td class="halfwidth"><strong>'._('Total').':</strong></td>'.
266 '<td class="onequarterwidth align-right"><strong>'.$total['adds']. '</strong></td>'.
267 '<td class="onequarterwidth align-right"><strong>'.$total['commits'].'</strong></td>';
269 $b .= $HTML->listTableBottom();
275 static function createUserRepo($params) {
276 $project = $params['project'];
277 $project_name = $project->getUnixName();
278 $user_name = $params['user_name'];
279 $unix_group = $params['unix_group'];
280 $main_repo = $params['main_repo'];
281 $root = $params['root'];
283 $repodir = $root . '/users/' . $user_name . '.git' ;
284 chgrp($repodir, $unix_group);
285 if ($project->enableAnonSCM()) {
286 chmod ($repodir, 02755);
288 chmod ($repodir, 02750);
290 if (!is_file ("$repodir/HEAD") && !is_dir("$repodir/objects") && !is_dir("$repodir/refs")) {
291 system ("git clone --bare $main_repo $repodir") ;
292 system ("GIT_DIR=\"$repodir\" git update-server-info") ;
293 if (is_file ("$repodir/hooks/post-update.sample")) {
294 rename ("$repodir/hooks/post-update.sample",
295 "$repodir/hooks/post-update") ;
297 if (!is_file ("$repodir/hooks/post-update")) {
298 $f = fopen ("$repodir/hooks/post-update","x+") ;
299 fwrite ($f, "exec git-update-server-info\n") ;
302 if (is_file ("$repodir/hooks/post-update")) {
303 system ("chmod +x $repodir/hooks/post-update") ;
305 system("echo \"Git repository for user $user_name in project $project_name\" > $repodir/description");
309 function createOrUpdateRepo($params) {
310 $project = $this->checkParams ($params) ;
315 if (! $project->usesPlugin ($this->name)) {
319 $project_name = $project->getUnixName();
320 $root = forge_get_config('repos_path', 'scmgit') . '/' . $project_name ;
321 system ("mkdir -p $root");
324 if (forge_get_config('use_ssh','scmgit')) {
325 $unix_group = 'scm_' . $project_name ;
327 $unix_group = forge_get_config('apache_group');
329 system ("chgrp $unix_group $root") ;
331 $main_repo = $root . '/' . $project_name . '.git' ;
332 if (!is_dir($main_repo) || (!is_file("$main_repo/HEAD") &&
333 !is_dir("$main_repo/objects") && !is_dir("$main_repo/refs"))) {
334 $tmp_repo = util_mkdtemp('.git', $project_name);
335 if ($tmp_repo == false) {
338 $result = system ("GIT_DIR=\"$tmp_repo\" git init --bare --shared=group") ;
339 $output .= join("<br />", array($result));
340 $result = system ("GIT_DIR=\"$tmp_repo\" git update-server-info") ;
341 $output .= join("<br />", array($result));
342 if (is_file ("$tmp_repo/hooks/post-update.sample")) {
343 rename ("$tmp_repo/hooks/post-update.sample",
344 "$tmp_repo/hooks/post-update") ;
346 if (!is_file ("$tmp_repo/hooks/post-update")) {
347 $f = fopen ("$tmp_repo/hooks/post-update") ;
348 fwrite ($f, "exec git-update-server-info\n") ;
351 if (is_file ("$tmp_repo/hooks/post-update")) {
352 system ("chmod +x $tmp_repo/hooks/post-update") ;
354 system ("echo \"Git repository for $project_name\" > $tmp_repo/description") ;
355 system ("find $tmp_repo -type d | xargs chmod g+s") ;
356 system ("chgrp -R $unix_group $tmp_repo") ;
357 system ("chmod -R g+wX,o+rX-w $tmp_repo") ;
358 if ($project->enableAnonSCM()) {
359 system ("chmod g+wX,o+rX-w $root") ;
361 system ("chmod g+wX,o-rwx $root") ;
362 system ("chmod g+wX,o-rwx $tmp_repo") ;
366 * $main_repo can already exist, for example if it’s
367 * not a directory or doesn’t contain a HEAD file or
368 * an objects or refs subdirectory… move it out of
369 * the way in these cases
371 system("if test -e $main_repo || test -h $main_repo; then d=\$(mktemp -d $main_repo.scmgit-moved.XXXXXXXXXX) && mv -f $main_repo \$d/; fi");
372 /* here’s still a TOCTOU but we check $ret below */
373 system("mv $tmp_repo $main_repo", $ret);
378 if (forge_get_config('use_ssh','scmgit')) {
379 if ($project->enableAnonSCM()) {
380 system ("chmod g+wX,o+rX-w $root") ;
381 system ("chmod g+rwX,o+rX-w $main_repo") ;
383 system ("chmod g+wX,o-rwx $root") ;
384 system ("chmod g+rwX,o-rwx $main_repo") ;
387 $unix_user = forge_get_config('apache_user');
388 system ("chown $unix_user:$unix_group $main_repo") ;
389 system ("chmod g-rwx,o-rwx $main_repo") ;
392 $result = db_query_params ('SELECT u.user_name FROM plugin_scmgit_personal_repos p, users u WHERE p.group_id=$1 AND u.user_id=p.user_id AND u.unix_status=$2',
393 array ($project->getID(),
395 $rows = db_numrows ($result) ;
396 for ($i=0; $i<$rows; $i++) {
397 system ("mkdir -p $root/users") ;
398 $user_name = db_result($result,$i,'user_name');
399 $repodir = $root . '/users/' . $user_name . '.git' ;
401 if (!is_dir($repodir) && mkdir ($repodir, 0700)) {
402 chown ($repodir, $user_name) ;
405 $params['project'] = $project;
406 $params['user_name'] = $user_name;
407 $params['unix_group'] = $unix_group;
408 $params['root'] = $root;
409 $params['main_repo'] = $main_repo;
411 util_sudo_effective_user($user_name,
412 array("GitPlugin","createUserRepo"),
416 if (is_dir ("$root/users")) {
417 if ($project->enableAnonSCM()) {
418 system ("chmod g+rX-w,o+rX-w $root/users") ;
420 system ("chmod g+rX-w,o-rwx $root/users") ;
423 $params['output'] = $output;
426 function updateRepositoryList($params) {
427 $groups = $this->getGroups();
429 foreach ($groups as $project) {
430 if ($this->browserDisplayable($project)) {
435 $config_dir = forge_get_config('config_path').'/plugins/scmgit';
436 if (!is_dir($config_dir)) {
437 mkdir($config_dir, 0755, true);
439 $fname = $config_dir . '/gitweb.conf' ;
440 $config_f = fopen($fname.'.new', 'w') ;
441 $rootdir = forge_get_config('repos_path', 'scmgit');
442 fwrite($config_f, "\$projectroot = '$rootdir';\n");
443 fwrite($config_f, "\$projects_list = '$config_dir/gitweb.list';\n");
444 fwrite($config_f, "@git_base_url_list = ('". util_make_url('/anonscm/git') . "');\n");
445 fwrite($config_f, "\$logo = '". util_make_url('/plugins/scmgit/git-logo.png') . "';\n");
446 fwrite($config_f, "\$favicon = '". util_make_url('/plugins/scmgit/git-favicon.png')."';\n");
447 fwrite($config_f, "\$stylesheet = '". util_make_url('/plugins/scmgit/gitweb.css')."';\n");
448 fwrite($config_f, "\$javascript = '". util_make_url('/plugins/scmgit/gitweb.js')."';\n");
449 fwrite($config_f, "\$prevent_xss = 'true';\n");
450 fwrite($config_f, "\$feature{'actions'}{'default'} = [('project home', '" .
451 util_make_url('/plugins/scmgit/?func=grouppage/%n') .
452 "', 'summary')];\n");
454 chmod ($fname.'.new', 0644) ;
455 rename ($fname.'.new', $fname) ;
457 $fname = $config_dir . '/gitweb.list' ;
459 $f = fopen ($fname.'.new', 'w');
460 foreach ($list as $project) {
461 $repos = $this->getRepositories($rootdir . "/" . $project->getUnixName());
462 foreach ($repos as $repo) {
463 $reldir = substr($repo, strlen($rootdir) + 1);
464 fwrite($f, $reldir . "\n");
468 chmod($fname.'.new', 0644);
469 rename($fname.'.new', $fname);
472 function getRepositories($path) {
473 if (! is_dir($path)) {
477 $entries = scandir($path);
478 foreach ($entries as $entry) {
479 $fullname = $path . "/" . $entry;
480 if (($entry == ".") or ($entry == ".."))
482 if (is_dir($fullname)) {
483 if (is_link($fullname))
485 $result = $this->getRepositories($fullname);
486 $list = array_merge($list, $result);
487 } else if ($entry == "HEAD") {
494 function gatherStats ($params) {
495 $project = $this->checkParams ($params) ;
500 if (! $project->usesPlugin ($this->name)) {
504 if ($params['mode'] == 'day') {
505 $year = $params ['year'] ;
506 $month = $params ['month'] ;
507 $day = $params ['day'] ;
508 $month_string = sprintf( "%04d%02d", $year, $month );
509 $start_time = gmmktime( 0, 0, 0, $month, $day, $year);
510 $end_time = $start_time + 86400;
512 $usr_adds = array () ;
513 $usr_updates = array () ;
514 $usr_deletes = array () ;
519 $repo = forge_get_config('repos_path', 'scmgit') . '/' . $project->getUnixName() . '/' . $project->getUnixName() . '.git';
520 if (!is_dir ($repo) || !is_dir ("$repo/refs")) {
521 // echo "No repository $repo\n" ;
525 $pipe = popen ("GIT_DIR=\"$repo\" git log --since=@$start_time --until=@$end_time --all --pretty='format:%n%an <%ae>' --name-status 2>/dev/null", 'r' ) ;
529 // cleaning stats_cvs_* table for the current day
530 $res = db_query_params ('DELETE FROM stats_cvs_group WHERE month=$1 AND day=$2 AND group_id=$3',
531 array ($month_string,
533 $project->getID())) ;
535 echo "Error while cleaning stats_cvs_group\n" ;
541 while (!feof($pipe) && $data = fgets ($pipe)) {
543 if (strlen($line) > 0) {
544 $result = preg_match("/^(?P<name>.+) <(?P<mail>.+)>/", $line, $matches);
547 $last_user = $matches['name'];
548 $user2email[$last_user] = strtolower($matches['mail']);
550 // Short-commit stats line
551 $result = preg_match("/^(?P<mode>[AMD])\s+(?P<file>.+)$/", $line, $matches);
552 if (!$result) continue;
553 if ($last_user == "") continue;
554 if (!isset ($usr_adds[$last_user])) $usr_adds[$last_user] = 0;
555 if (!isset ($usr_updates[$last_user])) $usr_updates[$last_user] = 0;
556 if (!isset ($usr_deletes[$last_user])) $usr_deletes[$last_user] = 0;
557 if ($matches['mode'] == 'A') {
558 $usr_adds[$last_user]++;
560 } elseif ($matches['mode'] == 'M') {
561 $usr_updates[$last_user]++;
563 } elseif ($matches['mode'] == 'D') {
564 $usr_deletes[$last_user]++;
570 // inserting group results in stats_cvs_groups
571 if ($updates > 0 || $adds > 0) {
572 if (!db_query_params ('INSERT INTO stats_cvs_group (month,day,group_id,checkouts,commits,adds) VALUES ($1,$2,$3,$4,$5,$6)',
573 array ($month_string,
579 echo "Error while inserting into stats_cvs_group\n" ;
585 // building the user list
586 $user_list = array_unique( array_merge( array_keys( $usr_adds ), array_keys( $usr_updates ) ) );
588 foreach ( $user_list as $user ) {
589 // Trying to get user id from user name or email
590 $u = &user_get_object_by_name ($user) ;
592 $user_id = $u->getID();
594 $res=db_query_params('SELECT user_id FROM users WHERE lower(realname)=$1 OR email=$2',
595 array (strtolower($user), $user2email[$user]));
596 if ($res && db_numrows($res) > 0) {
597 $user_id = db_result($res,0,'user_id');
603 $uu = isset ($usr_updates[$user]) ? $usr_updates[$user] : 0 ;
604 $ua = isset ($usr_adds[$user]) ? $usr_adds[$user] : 0 ;
605 if ($uu > 0 || $ua > 0) {
606 if (!db_query_params ('INSERT INTO stats_cvs_user (month,day,group_id,user_id,commits,adds) VALUES ($1,$2,$3,$4,$5,$6)',
607 array ($month_string,
613 echo "Error while inserting into stats_cvs_user\n" ;
623 function generateSnapshots ($params) {
625 $project = $this->checkParams ($params) ;
630 $group_name = $project->getUnixName() ;
632 $snapshot = forge_get_config('scm_snapshots_path').'/'.$group_name.'-scm-latest.tar'.util_get_compressed_file_extension();
633 $tarball = forge_get_config('scm_tarballs_path').'/'.$group_name.'-scmroot.tar'.util_get_compressed_file_extension();
635 if (! $project->usesPlugin ($this->name)) {
639 if (! $project->enableAnonSCM()) {
640 if (is_file($snapshot)) {
643 if (is_file($tarball)) {
649 // TODO: ideally we generate one snapshot per git repository
650 $toprepo = forge_get_config('repos_path', 'scmgit') ;
651 $repo = $toprepo . '/' . $project->getUnixName() . '/' . $project->getUnixName() . '.git' ;
653 if (!is_dir ($repo)) {
654 if (is_file($snapshot)) {
657 if (is_file($tarball)) {
663 // Skip empty repo (no HEAD present in repository)
664 $ref = trim(`GIT_DIR=$repo git symbolic-ref HEAD`);
665 if (!file_exists($repo.'/'.$ref)) {
669 $tmp = trim (`mktemp -d`) ;
673 $today = date ('Y-m-d') ;
674 system ("GIT_DIR=\"$repo\" git archive --format=tar --prefix=$group_name-scm-$today/ HEAD |".forge_get_config('compression_method')." > $tmp/snapshot");
675 chmod ("$tmp/snapshot", 0644) ;
676 copy ("$tmp/snapshot", $snapshot) ;
677 unlink ("$tmp/snapshot") ;
679 system ("tar cCf $toprepo - ".$project->getUnixName() ."|".forge_get_config('compression_method')."> $tmp/tarball") ;
680 chmod ("$tmp/tarball", 0644) ;
681 copy ("$tmp/tarball", $tarball) ;
682 unlink ("$tmp/tarball") ;
683 system ("rm -rf $tmp") ;
687 * widgets - 'widgets' hook handler
688 * @param array $params
691 function widgets($params) {
692 require_once('common/widget/WidgetLayoutManager.class.php');
693 if ($params['owner_type'] == WidgetLayoutManager::OWNER_TYPE_GROUP) {
694 $params['fusionforge_widgets'][] = 'plugin_scmgit_project_latestcommits';
696 if ($params['owner_type'] == WidgetLayoutManager::OWNER_TYPE_USER) {
697 $params['fusionforge_widgets'][] = 'plugin_scmgit_user_myrepositories';
703 * Process the 'widget_instance' hook to create instances of the widgets
704 * @param array $params
706 function myPageBox($params) {
708 $user = UserManager::instance()->getCurrentUser();
709 require_once('common/widget/WidgetLayoutManager.class.php');
710 if ($params['widget'] == 'plugin_scmgit_user_myrepositories') {
711 require_once $gfplugins.$this->name.'/common/scmgit_Widget_MyRepositories.class.php';
712 $params['instance'] = new scmgit_Widget_MyRepositories(WidgetLayoutManager::OWNER_TYPE_USER, $user->getId());
719 // c-file-style: "bsd"