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