AuthManager: Break AuthPlugin::addUser more explicitly
[mediawiki.git] / includes / export / DumpMultiWriter.php
blob92118fe41d39e9a541fbfd42ad0aa96ebd45de2e
1 <?php
2 /**
3 * Base class for output stream; prints to stdout or buffer or wherever.
5 * Copyright © 2003, 2005, 2006 Brion Vibber <brion@pobox.com>
6 * https://www.mediawiki.org/
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
23 * @file
26 /**
27 * @ingroup Dump
29 class DumpMultiWriter {
31 /**
32 * @param array $sinks
34 function __construct( $sinks ) {
35 $this->sinks = $sinks;
36 $this->count = count( $sinks );
39 /**
40 * @param string $string
42 function writeOpenStream( $string ) {
43 for ( $i = 0; $i < $this->count; $i++ ) {
44 $this->sinks[$i]->writeOpenStream( $string );
48 /**
49 * @param string $string
51 function writeCloseStream( $string ) {
52 for ( $i = 0; $i < $this->count; $i++ ) {
53 $this->sinks[$i]->writeCloseStream( $string );
57 /**
58 * @param object $page
59 * @param string $string
61 function writeOpenPage( $page, $string ) {
62 for ( $i = 0; $i < $this->count; $i++ ) {
63 $this->sinks[$i]->writeOpenPage( $page, $string );
67 /**
68 * @param string $string
70 function writeClosePage( $string ) {
71 for ( $i = 0; $i < $this->count; $i++ ) {
72 $this->sinks[$i]->writeClosePage( $string );
76 /**
77 * @param object $rev
78 * @param string $string
80 function writeRevision( $rev, $string ) {
81 for ( $i = 0; $i < $this->count; $i++ ) {
82 $this->sinks[$i]->writeRevision( $rev, $string );
86 /**
87 * @param array $newnames
89 function closeRenameAndReopen( $newnames ) {
90 $this->closeAndRename( $newnames, true );
93 /**
94 * @param array $newnames
95 * @param bool $open
97 function closeAndRename( $newnames, $open = false ) {
98 for ( $i = 0; $i < $this->count; $i++ ) {
99 $this->sinks[$i]->closeAndRename( $newnames[$i], $open );
104 * @return array
106 function getFilenames() {
107 $filenames = [];
108 for ( $i = 0; $i < $this->count; $i++ ) {
109 $filenames[] = $this->sinks[$i]->getFilenames();
111 return $filenames;