DumpOutput.php 2.8 KB

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