* @subpackage Database
[lhc/web/wiklou.git] / includes / killthread.php
index 2598c6f..b12eccb 100644 (file)
@@ -1,20 +1,31 @@
 <?php
+/**
+ * Script to kill a MySQL thread after a specified timeout
+ * @package MediaWiki
+ * @subpackage Database
+ */
+
+/**
+ *
+ */
+if( php_sapi_name() != 'cli' ) {
+       die('');
+}
 
-# Script to kill a MySQL thread after a specified timeout
-
+define( 'MEDIAWIKI', 1 );
 $wgCommandLineMode = true;
 
 unset( $IP );
-ini_set( "allow_url_fopen", 0 ); # For security...
-require_once( "./LocalSettings.php" );
+ini_set( 'allow_url_fopen', 0 ); # For security...
+require_once( '../LocalSettings.php' );
 
-# Windows requires ';' as separator, ':' for Unix
-$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
-ini_set( "include_path", "$IP$sep$include_path" );
+if( !$wgAllowSysopQueries ) {
+       die( "Queries disabled.\n" );
+}
 
-require_once( "Setup.php" );
+require_once( 'Setup.php' );
 
-$wgTitle = Title::newFromText( wfMsg( "badtitle" ) );
+$wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
 $wgArticle = new Article($wgTitle);
 
 if ( !$argv[1] || !$argv[2] ) {
@@ -31,6 +42,6 @@ sleep( $s );
 
 # Kill DB thread
 $conn = Database::newFromParams( $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname );
-$conn->query( "KILL $tid" );
+$conn->query( 'KILL '.$tid );
 
 ?>