[Fusionforge-commits] r8818 - in trunk/gforge: cronjobs plugins/scmsvn/common
Roland Mas
lolando at libremir.placard.fr.eu.org
Fri Feb 12 16:51:06 CET 2010
Author: lolando
Date: 2010-02-12 16:51:06 +0100 (Fri, 12 Feb 2010)
New Revision: 8818
Modified:
trunk/gforge/cronjobs/gather_scm_stats.php
trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
Log:
Implemented a way to gather all SCM statistics from the beginning (not incremental)
Modified: trunk/gforge/cronjobs/gather_scm_stats.php
===================================================================
--- trunk/gforge/cronjobs/gather_scm_stats.php 2010-02-12 15:49:36 UTC (rev 8817)
+++ trunk/gforge/cronjobs/gather_scm_stats.php 2010-02-12 15:51:06 UTC (rev 8818)
@@ -43,13 +43,36 @@
return false;
}
+$mode = 'day' ; // Override to 'all' to parse the whole history
+
while ($data = db_fetch_array ($res)) {
- $hook_params = array ('group_id' => $data['group_id'],
- 'mode' => 'day',
- 'year' => date ('Y', time () - 86400),
- 'month' => date ('n', time () - 86400),
- 'day' => date ('j', time () - 86400)) ;
- plugin_hook ('scm_gather_stats', $hook_params) ;
+ if ($mode == 'day') {
+ $time = time () - 86400 ;
+ $hook_params = array ('group_id' => $data['group_id'],
+ 'mode' => 'day',
+ 'year' => date ('Y', $time),
+ 'month' => date ('n', $time),
+ 'day' => date ('j', $time)) ;
+ plugin_hook ('scm_gather_stats', $hook_params) ;
+ } elseif ($mode == 'all') {
+ $last_seen_day = '' ;
+ $time = 0 ;
+ $now = time () ;
+ while ($time < $now) {
+ $day = date ('Y-m-d', $time) ;
+ print "processing $day\n" ;
+ if ($day != $last_seen_day) {
+ $hook_params = array ('group_id' => $data['group_id'],
+ 'mode' => 'day',
+ 'year' => date ('Y', $time),
+ 'month' => date ('n', $time),
+ 'day' => date ('j', $time)) ;
+ plugin_hook ('scm_gather_stats', $hook_params) ;
+ $last_seen_day = $day ;
+ }
+ $time = $time + 80000 ;
+ }
+ }
}
// Local Variables:
Modified: trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php 2010-02-12 15:49:36 UTC (rev 8817)
+++ trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php 2010-02-12 15:51:06 UTC (rev 8818)
@@ -272,6 +272,8 @@
global $last_user, $last_time, $last_tag, $time_ok, $start_time, $end_time,
$adds, $deletes, $updates, $commits, $date_key,
$usr_adds, $usr_deletes, $usr_updates;
+
+ $time_ok = true ;
$project = $this->checkParams ($params) ;
if (!$project) {
More information about the Fusionforge-commits
mailing list