return $b;
}
- function set_timeout($timeout) {
+ /**
+ * Override database's default connection timeout.
+ * May be useful for very long batch queries such as
+ * full-wiki dumps, where a single query reads out
+ * over hours or days.
+ * @param int $timeout in seconds
+ */
+ public function setTimeout( $timeout ) {
$this->query( "SET net_read_timeout=$timeout" );
$this->query( "SET net_write_timeout=$timeout" );
}
return array( $startOpts, $useIndex, $tailOpts );
}
- function set_timeout($timeout) {
+ public function setTimeout( $timeout ) {
+ /// @fixme no-op
}
function ping() {
$this->initProgress( $history );
- $db =& $this->backupDb();
+ $db = $this->backupDb();
$exporter = new WikiExporter( $db, $history, WikiExporter::STREAM, $text );
$wrapper = new ExportProgressFilter( $this->sink, $this );
$this->startTime = wfTime();
}
- function &backupDb() {
+ function backupDb() {
global $wgDBadminuser, $wgDBadminpassword;
global $wgDBname, $wgDebugDumpSql, $wgDBtype;
$flags = ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT; // god-damn hack
$class = 'Database' . ucfirst($wgDBtype);
$db = new $class( $this->backupServer(), $wgDBadminuser, $wgDBadminpassword, $wgDBname, false, $flags );
- $timeout = 3600 * 24;
- $db->set_timeout($timeout);
+
+ // Discourage the server from disconnecting us if it takes a long time
+ // to read out the big ol' batch query.
+ $db->setTimeout( 3600 * 24 );
+
return $db;
}
$this->initProgress( $this->history );
- $this->db =& $this->backupDb();
+ $this->db = $this->backupDb();
$this->egress = new ExportProgressFilter( $this->sink, $this );