r94838 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94837‎ | r94838 | r94839 >
Date:22:42, 17 August 2011
Author:reedy
Status:ok
Tags:
Comment:
More wikia upstreaming
Modified paths:
  • /trunk/phase3/includes/ImageGallery.php (modified) (history)
  • /trunk/phase3/includes/XmlTypeCheck.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/XmlTypeCheck.php
@@ -6,7 +6,7 @@
77 * well-formed XML. Note that this doesn't check schema validity.
88 */
99 public $wellFormed = false;
10 -
 10+
1111 /**
1212 * Will be set to true if the optional element filter returned
1313 * a match at some point.
@@ -31,7 +31,7 @@
3232 $this->filterCallback = $filterCallback;
3333 $this->run( $file );
3434 }
35 -
 35+
3636 /**
3737 * Get the root element. Simple accessor to $rootElement
3838 *
@@ -52,21 +52,26 @@
5353
5454 xml_set_element_handler( $parser, array( $this, 'rootElementOpen' ), false );
5555
56 - $file = fopen( $fname, "rb" );
57 - do {
58 - $chunk = fread( $file, 32768 );
59 - $ret = xml_parse( $parser, $chunk, feof( $file ) );
60 - if( $ret == 0 ) {
61 - // XML isn't well-formed!
 56+ if ( file_exists( $fname ) ) {
 57+ $file = fopen( $fname, "rb" );
 58+ if ( $file ) {
 59+ do {
 60+ $chunk = fread( $file, 32768 );
 61+ $ret = xml_parse( $parser, $chunk, feof( $file ) );
 62+ if( $ret == 0 ) {
 63+ // XML isn't well-formed!
 64+ fclose( $file );
 65+ xml_parser_free( $parser );
 66+ return;
 67+ }
 68+ } while( !feof( $file ) );
 69+
6270 fclose( $file );
63 - xml_parser_free( $parser );
64 - return;
6571 }
66 - } while( !feof( $file ) );
 72+ }
6773
6874 $this->wellFormed = true;
6975
70 - fclose( $file );
7176 xml_parser_free( $parser );
7277 }
7378
@@ -77,7 +82,7 @@
7883 */
7984 private function rootElementOpen( $parser, $name, $attribs ) {
8085 $this->rootElement = $name;
81 -
 86+
8287 if( is_callable( $this->filterCallback ) ) {
8388 xml_set_element_handler( $parser, array( $this, 'elementOpen' ), false );
8489 $this->elementOpen( $parser, $name, $attribs );
Index: trunk/phase3/includes/ImageGallery.php
@@ -28,9 +28,9 @@
2929 * Contextual title, used when images are being screened
3030 * against the bad image list
3131 */
32 - private $contextTitle = false;
 32+ protected $contextTitle = false;
3333
34 - private $mAttribs = array();
 34+ protected $mAttribs = array();
3535
3636 /**
3737 * Fixed margins

Sign-offs

UserFlagDate
Bawolffinspected22:46, 17 August 2011

Status & tagging log