[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/cronjobs/cvs-cron history_parse.php, 1.6, 1.7
From: |
gsmet |
Subject: |
[Gforge-commits] gforge/cronjobs/cvs-cron history_parse.php, 1.6, 1.7 |
Date: |
Fri, 06 Aug 2004 11:21:18 -0500 |
Update of /cvsroot/gforge/gforge/cronjobs/cvs-cron
In directory db.perdue.net:/tmp/cvs-serv935/cronjobs/cvs-cron
Modified Files:
history_parse.php
Log Message:
cleaner transaction management
Index: history_parse.php
===================================================================
RCS file: /cvsroot/gforge/gforge/cronjobs/cvs-cron/history_parse.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- history_parse.php 13 Apr 2004 20:26:56 -0000 1.6
+++ history_parse.php 6 Aug 2004 16:21:15 -0000 1.7
@@ -62,6 +62,8 @@
db_begin();
+$rollback = false;
+
$root_dir =& opendir( $cvsroot );
while ( $group = readdir( $root_dir ) ) {
if ( $group == '.' || $group == '..' )
@@ -91,10 +93,15 @@
$usr_commit = array();
$usr_add = array();
- $hist_file =& fopen( "$cvsroot/$group/CVSROOT/history", 'r' );
+
+ $hist_file_path = $cvsroot.'/'.$group.'/CVSROOT/history';
+ if( !file_exists($hist_file_path) || !is_readable($hist_file_path) ||
filesize($hist_file_path) == 0) {
+ continue;
+ }
+ $hist_file =& fopen( $hist_file_path, 'r' );
if ( ! $hist_file )
continue;
- $hist_cont = fread( $hist_file, filesize(
"$cvsroot/$group/CVSROOT/history" ) );
+ $hist_cont = fread( $hist_file, filesize( $hist_file_path ) );
fclose( $hist_file );
$hist_lines = explode( "\n", $hist_cont );
@@ -158,8 +165,11 @@
if ( $verbose )
$err .= "$sql\n";
- db_query( $sql );
- $err .= db_error();
+ if ( !db_query( $sql ) ) {
+ $err .= db_error();
+ $rollback = true;
+ break;
+ }
$user_list = array_unique( array_merge( array_keys( $usr_add ),
array_keys( $usr_commit ) ) );
@@ -187,15 +197,23 @@
if ( $verbose ) {
$err .= "$sql\n";
}
- db_query( $sql );
- $err .= db_error();
+ if ( !db_query( $sql )) {
+ $err .= db_error();
+ $rollback = true;
+ break 2;
+ }
}
}
-db_commit();
+if ( $rollback ) {
+ db_rollback();
+} else {
+ db_commit();
+}
+
cron_entry(14,$err);
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/cronjobs/cvs-cron history_parse.php, 1.6, 1.7,
gsmet <=
- Prev by Date:
[Gforge-commits] gforge/www/include/languages French.tab, 1.103, 1.104
- Next by Date:
[Gforge-commits] gforge/cronjobs README, 1.5, 1.6 README.root, 1.3, 1.4
- Previous by thread:
[Gforge-commits] gforge/www/include/languages French.tab, 1.103, 1.104
- Next by thread:
[Gforge-commits] gforge/cronjobs README, 1.5, 1.6 README.root, 1.3, 1.4
- Index(es):