fix a problem by not inserting __MWTEMPLATESECTION for section titles that don't...
[lhc/web/wiklou.git] / includes / killthread.php
1 <?php
2 /**
3 * Script to kill a MySQL thread after a specified timeout
4 * @package MediaWiki
5 */
6
7 /**
8 *
9 */
10 $wgCommandLineMode = true;
11
12 unset( $IP );
13 ini_set( 'allow_url_fopen', 0 ); # For security...
14 require_once( './LocalSettings.php' );
15
16 # Windows requires ';' as separator, ':' for Unix
17 $sep = strchr( $include_path = ini_get( 'include_path' ), ';' ) ? ';' : ':';
18 ini_set( 'include_path', "$IP$sep$include_path" );
19
20 require_once( 'Setup.php' );
21
22 $wgTitle = Title::newFromText( wfMsg( 'badtitle' ) );
23 $wgArticle = new Article($wgTitle);
24
25 if ( !$argv[1] || !$argv[2] ) {
26 exit();
27 }
28
29 $tid = (int)$argv[2];
30
31 # Wait for timeout (this process may be killed during this time)
32 $us = floor( $argv[1] * 1000000 ) % 1000000;
33 $s = floor( $argv[1] );
34 usleep( $us );
35 sleep( $s );
36
37 # Kill DB thread
38 $conn = Database::newFromParams( $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname );
39 $conn->query( 'KILL '.$tid );
40
41 ?>