MediaWiki master
DumpMultiWriter.php
Go to the documentation of this file.
1<?php
12namespace MediaWiki\Export;
13
19 private $sinks;
21 private $count;
22
26 public function __construct( $sinks ) {
27 $this->sinks = $sinks;
28 $this->count = count( $sinks );
29 }
30
34 public function writeOpenStream( $string ) {
35 for ( $i = 0; $i < $this->count; $i++ ) {
36 $this->sinks[$i]->writeOpenStream( $string );
37 }
38 }
39
43 public function writeCloseStream( $string ) {
44 for ( $i = 0; $i < $this->count; $i++ ) {
45 $this->sinks[$i]->writeCloseStream( $string );
46 }
47 }
48
53 public function writeOpenPage( $page, $string ) {
54 for ( $i = 0; $i < $this->count; $i++ ) {
55 $this->sinks[$i]->writeOpenPage( $page, $string );
56 }
57 }
58
62 public function writeClosePage( $string ) {
63 for ( $i = 0; $i < $this->count; $i++ ) {
64 $this->sinks[$i]->writeClosePage( $string );
65 }
66 }
67
72 public function writeRevision( $rev, $string ) {
73 for ( $i = 0; $i < $this->count; $i++ ) {
74 $this->sinks[$i]->writeRevision( $rev, $string );
75 }
76 }
77
81 public function closeRenameAndReopen( $newnames ) {
82 $this->closeAndRename( $newnames, true );
83 }
84
89 public function closeAndRename( $newnames, $open = false ) {
90 for ( $i = 0; $i < $this->count; $i++ ) {
91 $this->sinks[$i]->closeAndRename( $newnames[$i], $open );
92 }
93 }
94
98 public function getFilenames() {
99 $filenames = [];
100 for ( $i = 0; $i < $this->count; $i++ ) {
101 $filenames[] = $this->sinks[$i]->getFilenames();
102 }
103 return $filenames;
104 }
105}
106
108class_alias( DumpMultiWriter::class, 'DumpMultiWriter' );
closeAndRename( $newnames, $open=false)