[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 #!/usr/local/bin/php -q 2 <?php 3 # Mantis - a php based bugtracking system 4 5 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 6 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net 7 8 # Mantis is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation, either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # Mantis is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with Mantis. If not, see <http://www.gnu.org/licenses/>. 20 # See the README and LICENSE files for details 21 22 # -------------------------------------------------------- 23 # $Id: checkin.php,v 1.5.2.1 2007-10-13 22:35:16 giallu Exp $ 24 # -------------------------------------------------------- 25 26 global $g_bypass_headers; 27 $g_bypass_headers = 1; 28 require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); 29 30 # Make sure this script doesn't run via the webserver 31 # @@@ This is a hack to detect php-cgi, there must be a better way. 32 if ( isset( $_SERVER['SERVER_PORT'] ) ) { 33 echo "checkin.php is not allowed to run through the webserver.\n"; 34 exit( 1 ); 35 } 36 37 # Check that the username is set and exists 38 $t_username = config_get( 'source_control_account' ); 39 if ( is_blank( $t_username ) || ( user_get_id_by_name( $t_username ) === false ) ) { 40 echo "Invalid source control account ('$t_username').\n"; 41 exit( 1 ); 42 } 43 44 if ( !defined( "STDIN" ) ) { 45 define("STDIN", fopen('php://stdin','r')); 46 } 47 48 # Detect references to issues + concat all lines to have the comment log. 49 $t_commit_regexp = config_get( 'source_control_regexp' ); 50 $t_commit_fixed_regexp = config_get( 'source_control_fixed_regexp' ); 51 52 $t_comment = ''; 53 $t_issues = array(); 54 $t_fixed_issues = array(); 55 while ( ( $t_line = fgets( STDIN, 1024 ) ) ) { 56 $t_comment .= $t_line; 57 if ( preg_match_all( $t_commit_regexp, $t_line, $t_matches ) ) { 58 for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) { 59 $t_issues[] = $t_matches[1][$i]; 60 } 61 } 62 63 if ( preg_match_all( $t_commit_fixed_regexp, $t_line, $t_matches) ) { 64 for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) { 65 $t_fixed_issues[] = $t_matches[1][$i]; 66 } 67 } 68 } 69 70 # If no issues found, then no work to do. 71 if ( ( count( $t_issues ) == 0 ) && ( count( $t_fixed_issues ) == 0 ) ) { 72 echo "Comment does not reference any issues.\n"; 73 exit(0); 74 } 75 76 # Login as source control user 77 if ( !auth_attempt_script_login( $t_username ) ) { 78 echo "Unable to login\n"; 79 exit( 1 ); 80 } 81 82 # history parameters are reserved for future use. 83 $t_history_old_value = ''; 84 $t_history_new_value = ''; 85 86 # add note to each bug only once 87 $t_issues = array_unique( $t_issues ); 88 $t_fixed_issues = array_unique( $t_fixed_issues ); 89 90 # Call the custom function to register the checkin on each issue. 91 92 foreach ( $t_issues as $t_issue_id ) { 93 if ( !in_array( $t_issue_id, $t_fixed_issues ) ) { 94 helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, false ) ); 95 } 96 } 97 98 foreach ( $t_fixed_issues as $t_issue_id ) { 99 helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, true ) ); 100 } 101 102 exit( 0 ); 103 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |