Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 10
CRAP
0.00% covered (danger)
0.00%
0 / 1
DumpOutput
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 10
110
0.00% covered (danger)
0.00%
0 / 1
 writeOpenStream
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 writeCloseStream
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 writeOpenPage
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 writeClosePage
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 writeRevision
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 writeLogItem
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 write
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 closeRenameAndReopen
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 closeAndRename
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getFilenames
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Base class for output stream; prints to stdout or buffer or wherever.
4 *
5 * Copyright © 2003, 2005, 2006 Brooke Vibber <bvibber@wikimedia.org>
6 * https://www.mediawiki.org/
7 *
8 * @license GPL-2.0-or-later
9 * @file
10 */
11
12namespace MediaWiki\Export;
13
14/**
15 * @ingroup Dump
16 */
17class DumpOutput {
18
19    /**
20     * @param string $string
21     */
22    public function writeOpenStream( $string ) {
23        $this->write( $string );
24    }
25
26    /**
27     * @param string $string
28     */
29    public function writeCloseStream( $string ) {
30        $this->write( $string );
31    }
32
33    /**
34     * @param \stdClass|null $page
35     * @param string $string
36     */
37    public function writeOpenPage( $page, $string ) {
38        $this->write( $string );
39    }
40
41    /**
42     * @param string $string
43     */
44    public function writeClosePage( $string ) {
45        $this->write( $string );
46    }
47
48    /**
49     * @param \stdClass|null $rev
50     * @param string $string
51     */
52    public function writeRevision( $rev, $string ) {
53        $this->write( $string );
54    }
55
56    /**
57     * @param \stdClass $rev
58     * @param string $string
59     */
60    public function writeLogItem( $rev, $string ) {
61        $this->write( $string );
62    }
63
64    /**
65     * Override to write to a different stream type.
66     * @param string $string
67     */
68    public function write( $string ) {
69        print $string;
70    }
71
72    /**
73     * Close the old file, move it to a specified name,
74     * and reopen new file with the old name. Use this
75     * for writing out a file in multiple pieces
76     * at specified checkpoints (e.g. every n hours).
77     * @param string|string[] $newname File name. May be a string or an array with one element
78     */
79    public function closeRenameAndReopen( $newname ) {
80    }
81
82    /**
83     * Close the old file, and move it to a specified name.
84     * Use this for the last piece of a file written out
85     * at specified checkpoints (e.g. every n hours).
86     * @param string|string[] $newname File name. May be a string or an array with one element
87     * @param bool $open If true, a new file with the old filename will be opened
88     *   again for writing (default: false)
89     */
90    public function closeAndRename( $newname, $open = false ) {
91    }
92
93    /**
94     * Returns the name of the file or files which are
95     * being written to, if there are any.
96     * @return null
97     */
98    public function getFilenames() {
99        return null;
100    }
101}
102
103/** @deprecated class alias since 1.46 */
104class_alias( DumpOutput::class, 'DumpOutput' );