Adjust UTF-8 generator for correctness. (Upper private use area, probably affects...
[mediawiki.git] / includes / killthread.php
blob625bad7a8c0739b183e3b5bdea9a811887b07aa2
1 <?php
3 # Script to kill a MySQL thread after a specified timeout
5 $wgCommandLineMode = true;
7 unset( $IP );
8 ini_set( 'allow_url_fopen', 0 ); # For security...
9 require_once( './LocalSettings.php' );
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" );
15 require_once( 'Setup.php' );
17 $wgTitle = Title::newFromText( wfMsg( 'badtitle' ) );
18 $wgArticle = new Article($wgTitle);
20 if ( !$argv[1] || !$argv[2] ) {
21 exit();
24 $tid = (int)$argv[2];
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 );
32 # Kill DB thread
33 $conn = Database::newFromParams( $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname );
34 $conn->query( 'KILL '.$tid );