MediaWiki  master
DumpFilter.php
Go to the documentation of this file.
1 <?php
31 class DumpFilter {
37  public $sink;
38 
42  protected $sendingThisPage;
43 
47  public function __construct( &$sink ) {
48  $this->sink =& $sink;
49  }
50 
54  public function writeOpenStream( $string ) {
55  $this->sink->writeOpenStream( $string );
56  }
57 
61  public function writeCloseStream( $string ) {
62  $this->sink->writeCloseStream( $string );
63  }
64 
69  public function writeOpenPage( $page, $string ) {
70  $this->sendingThisPage = $this->pass( $page );
71  if ( $this->sendingThisPage ) {
72  $this->sink->writeOpenPage( $page, $string );
73  }
74  }
75 
79  public function writeClosePage( $string ) {
80  if ( $this->sendingThisPage ) {
81  $this->sink->writeClosePage( $string );
82  $this->sendingThisPage = false;
83  }
84  }
85 
90  public function writeRevision( $rev, $string ) {
91  if ( $this->sendingThisPage ) {
92  $this->sink->writeRevision( $rev, $string );
93  }
94  }
95 
100  public function writeLogItem( $rev, $string ) {
101  $this->sink->writeRevision( $rev, $string );
102  }
103 
108  public function closeRenameAndReopen( $newname ) {
109  $this->sink->closeRenameAndReopen( $newname );
110  }
111 
117  public function closeAndRename( $newname, $open = false ) {
118  $this->sink->closeAndRename( $newname, $open );
119  }
120 
124  public function getFilenames() {
125  return $this->sink->getFilenames() ?? [];
126  }
127 
133  protected function pass( $page ) {
134  return true;
135  }
136 }
writeCloseStream( $string)
Definition: DumpFilter.php:61
writeLogItem( $rev, $string)
Definition: DumpFilter.php:100
bool $sendingThisPage
Definition: DumpFilter.php:42
__construct(&$sink)
Definition: DumpFilter.php:47
closeAndRename( $newname, $open=false)
Definition: DumpFilter.php:117
writeOpenPage( $page, $string)
Definition: DumpFilter.php:69
DumpOutput $sink
FIXME will need to be made protected whenever legacy code is updated.
Definition: DumpFilter.php:37
writeRevision( $rev, $string)
Definition: DumpFilter.php:90
closeRenameAndReopen( $newname)
Definition: DumpFilter.php:108
pass( $page)
Override for page-based filter types.
Definition: DumpFilter.php:133
writeClosePage( $string)
Definition: DumpFilter.php:79
writeOpenStream( $string)
Definition: DumpFilter.php:54