Patch to only load $msgAllMessages instead of replacing the language object.
[mediawiki.git] / includes / killthread.php
blob819c91fb57b50b9150cea2b8450956abc905372f
1 <?php
2 /**
3 * Script to kill a MySQL thread after a specified timeout
4 * @package MediaWiki
5 */
7 /**
9 */
10 $wgCommandLineMode = true;
12 unset( $IP );
13 ini_set( 'allow_url_fopen', 0 ); # For security...
14 require_once( './LocalSettings.php' );
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" );
20 require_once( 'Setup.php' );
22 $wgTitle = Title::newFromText( wfMsg( 'badtitle' ) );
23 $wgArticle = new Article($wgTitle);
25 if ( !$argv[1] || !$argv[2] ) {
26 exit();
29 $tid = (int)$argv[2];
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 );
37 # Kill DB thread
38 $conn = Database::newFromParams( $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname );
39 $conn->query( 'KILL '.$tid );