Wrap Database::setTimer() in a check for existence of mysql_thread_id()
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 6 Aug 2004 19:07:55 +0000 (19:07 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 6 Aug 2004 19:07:55 +0000 (19:07 +0000)
function which was added in 4.3.0. If it's not available, don't set up
the thread killer.

includes/Database.php

index b76b2f2..1680761 100644 (file)
@@ -650,9 +650,11 @@ class Database {
        function startTimer( $timeout )
        {
                global $IP;
-
-               $tid = mysql_thread_id( $this->mConn );
-               exec( "php $IP/killthread.php $timeout $tid &>/dev/null &" );
+               if( function_exists( "mysql_thread_id" ) ) {
+                       # This will kill the query if it's still running after $timeout seconds.
+                       $tid = mysql_thread_id( $this->mConn );
+                       exec( "php $IP/killthread.php $timeout $tid &>/dev/null &" );
+               }
        }
 
        function stopTimer()