diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2007-09-14 13:18:58 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2007-09-14 13:18:58 +0200 |
commit | 8f416baead93a48e5799e44b8bd2e2c4859f4e04 (patch) | |
tree | cd47ac55eb80a39e3225e8b4f3161b88ea16c2cf /maintenance/nextJobDB.php | |
parent | d7d08bd1a17618c7d77a6b9b2989e9f7293d6ed6 (diff) |
auf Version 1.11 aktualisiert; Login-Bug behoben
Diffstat (limited to 'maintenance/nextJobDB.php')
-rw-r--r-- | maintenance/nextJobDB.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/maintenance/nextJobDB.php b/maintenance/nextJobDB.php index 7aa05a27..dfa8d028 100644 --- a/maintenance/nextJobDB.php +++ b/maintenance/nextJobDB.php @@ -4,9 +4,19 @@ * Pick a database that has pending jobs */ +$options = array( 'type' ); + require_once( 'commandLine.inc' ); -$pendingDBs = $wgMemc->get( 'jobqueue:dbs' ); +$type = isset($options['type']) + ? $options['type'] + : false; + +$mckey = $type === false + ? "jobqueue:dbs" + : "jobqueue:dbs:$type"; + +$pendingDBs = $wgMemc->get( $mckey ); if ( !$pendingDBs ) { $pendingDBs = array(); # Cross-reference DBs by master DB server @@ -22,6 +32,7 @@ if ( !$pendingDBs ) { foreach ( $dbsByMaster as $master => $dbs ) { $dbConn = new Database( $master, $wgDBuser, $wgDBpassword ); + $stype = $dbConn->addQuotes($type); # Padding row for MySQL bug $sql = "(SELECT '-------------------------------------------')"; @@ -29,7 +40,10 @@ if ( !$pendingDBs ) { if ( $sql != '' ) { $sql .= ' UNION '; } - $sql .= "(SELECT '$dbName' FROM `$dbName`.job LIMIT 1)"; + if ($type === false) + $sql .= "(SELECT '$dbName' FROM `$dbName`.job LIMIT 1)"; + else + $sql .= "(SELECT '$dbName' FROM `$dbName`.job WHERE job_cmd=$stype LIMIT 1)"; } $res = $dbConn->query( $sql, 'nextJobDB.php' ); $row = $dbConn->fetchRow( $res ); // discard padding row @@ -38,11 +52,11 @@ if ( !$pendingDBs ) { } } - $wgMemc->set( 'jobqueue:dbs', $pendingDBs, 300 ); + $wgMemc->set( $mckey, $pendingDBs, 300 ); } if ( $pendingDBs ) { echo $pendingDBs[mt_rand(0, count( $pendingDBs ) - 1)]; } -?> + |