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