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
32 * @param string $string
34 function writeOpenStream( $string ) {
35 $this->write( $string );
39 * @param string $string
41 function writeCloseStream( $string ) {
42 $this->write( $string );
47 * @param string $string
49 function writeOpenPage( $page, $string ) {
50 $this->write( $string );
54 * @param string $string
56 function writeClosePage( $string ) {
57 $this->write( $string );
62 * @param string $string
64 function writeRevision( $rev, $string ) {
65 $this->write( $string );
70 * @param string $string
72 function writeLogItem( $rev, $string ) {
73 $this->write( $string );
77 * Override to write to a different stream type.
78 * @param string $string
81 function write( $string ) {
86 * Close the old file, move it to a specified name,
87 * and reopen new file with the old name. Use this
88 * for writing out a file in multiple pieces
89 * at specified checkpoints (e.g. every n hours).
90 * @param string|array $newname File name. May be a string or an array with one element
92 function closeRenameAndReopen( $newname ) {
96 * Close the old file, and move it to a specified name.
97 * Use this for the last piece of a file written out
98 * at specified checkpoints (e.g. every n hours).
99 * @param string|array $newname File name. May be a string or an array with one element
100 * @param bool $open If true, a new file with the old filename will be opened
101 * again for writing (default: false)
103 function closeAndRename( $newname, $open = false ) {
107 * Returns the name of the file or files which are
108 * being written to, if there are any.
111 function getFilenames() {