Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

killthread.php

Go to the documentation of this file.
00001 <?php 00002 00003 # Script to kill a MySQL thread after a specified timeout 00004 00005 $wgCommandLineMode = true; 00006 00007 unset( $IP ); 00008 ini_set( "allow_url_fopen", 0 ); # For security... 00009 require_once( "./LocalSettings.php" ); 00010 00011 # Windows requires ';' as separator, ':' for Unix 00012 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; 00013 ini_set( "include_path", "$IP$sep$include_path" ); 00014 00015 require_once( "Setup.php" ); 00016 00017 $wgTitle = Title::newFromText( wfMsg( "badtitle" ) ); 00018 $wgArticle = new Article($wgTitle); 00019 00020 if ( !$argv[1] || !$argv[2] ) { 00021 exit(); 00022 } 00023 00024 $tid = (int)$argv[2]; 00025 00026 # Wait for timeout (this process may be killed during this time) 00027 $us = floor( $argv[1] * 1000000 ) % 1000000; 00028 $s = floor( $argv[1] ); 00029 usleep( $us ); 00030 sleep( $s ); 00031 00032 # Kill DB thread 00033 $conn = Database::newFromParams( $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname ); 00034 $conn->query( "KILL $tid" ); 00035 00036 ?>

Generated on Tue Jun 29 23:40:03 2004 for Mediawiki by doxygen 1.3.7