| 1 | <?php |
| 2 | /** |
| 3 | * Base class for output stream; prints to stdout or buffer or wherever. |
| 4 | * |
| 5 | * Copyright © 2003, 2005, 2006 Brooke Vibber <[email protected]> |
| 6 | * https://www.mediawiki.org/ |
| 7 | * |
| 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. |
| 12 | * |
| 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. |
| 17 | * |
| 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 |
| 22 | * |
| 23 | * @file |
| 24 | */ |
| 25 | |
| 26 | /** |
| 27 | * @ingroup Dump |
| 28 | */ |
| 29 | class DumpOutput { |
| 30 | |
| 31 | /** |
| 32 | * @param string $string |
| 33 | */ |
| 34 | public function writeOpenStream( $string ) { |
| 35 | $this->write( $string ); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * @param string $string |
| 40 | */ |
| 41 | public function writeCloseStream( $string ) { |
| 42 | $this->write( $string ); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @param stdClass|null $page |
| 47 | * @param string $string |
| 48 | */ |
| 49 | public function writeOpenPage( $page, $string ) { |
| 50 | $this->write( $string ); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @param string $string |
| 55 | */ |
| 56 | public function writeClosePage( $string ) { |
| 57 | $this->write( $string ); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @param stdClass|null $rev |
| 62 | * @param string $string |
| 63 | */ |
| 64 | public function writeRevision( $rev, $string ) { |
| 65 | $this->write( $string ); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @param stdClass $rev |
| 70 | * @param string $string |
| 71 | */ |
| 72 | public function writeLogItem( $rev, $string ) { |
| 73 | $this->write( $string ); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Override to write to a different stream type. |
| 78 | * @param string $string |
| 79 | */ |
| 80 | public function write( $string ) { |
| 81 | print $string; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Close the old file, move it to a specified name, |
| 86 | * and reopen new file with the old name. Use this |
| 87 | * for writing out a file in multiple pieces |
| 88 | * at specified checkpoints (e.g. every n hours). |
| 89 | * @param string|string[] $newname File name. May be a string or an array with one element |
| 90 | */ |
| 91 | public function closeRenameAndReopen( $newname ) { |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Close the old file, and move it to a specified name. |
| 96 | * Use this for the last piece of a file written out |
| 97 | * at specified checkpoints (e.g. every n hours). |
| 98 | * @param string|string[] $newname File name. May be a string or an array with one element |
| 99 | * @param bool $open If true, a new file with the old filename will be opened |
| 100 | * again for writing (default: false) |
| 101 | */ |
| 102 | public function closeAndRename( $newname, $open = false ) { |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Returns the name of the file or files which are |
| 107 | * being written to, if there are any. |
| 108 | * @return null |
| 109 | */ |
| 110 | public function getFilenames() { |
| 111 | return null; |
| 112 | } |
| 113 | } |