r110124 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110123‎ | r110124 | r110125 >
Date:14:29, 27 January 2012
Author:demon
Status:reverted (Comments)
Tags:filebackend 
Comment:
Copy FilesystemIterator constants so we can still pretend to support 5.2
Modified paths:
  • /trunk/phase3/includes/filerepo/backend/FSFileBackend.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/FSFileBackend.php
@@ -22,6 +22,14 @@
2323 * @since 1.19
2424 */
2525 class FSFileBackend extends FileBackend {
 26+
 27+ /**
 28+ * These constants are the same as the ones in FilesystemIterator, but
 29+ * that's only 5.3+ so copy them here. When we drop 5.2 we can remove this
 30+ */
 31+ const CURRENT_AS_FILEINFO = 0;
 32+ const SKIP_DOTS = 4096;
 33+
2634 protected $basePath; // string; directory holding the container directories
2735 /** @var Array Map of container names to root paths */
2836 protected $containerPaths = array(); // for custom container paths
@@ -548,7 +556,7 @@
549557 $dir = realpath( $dir ); // normalize
550558 $this->suffixStart = strlen( $dir ) + 1; // size of "path/to/dir/"
551559 try {
552 - $flags = FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS;
 560+ $flags = self::CURRENT_AS_FILEINFO | self::SKIP_DOTS;
553561 $this->iter = new RecursiveIteratorIterator(
554562 new RecursiveDirectoryIterator( $dir, $flags ) );
555563 } catch ( UnexpectedValueException $e ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r110126Self-revert r110124, needs more than that to support 5.2 since $flags don't e...demon14:33, 27 January 2012

Comments

#Comment by Dantman (talk | contribs)   14:33, 27 January 2012

The constants aren't the only things that are 5.3+. The setFlags and the $flags argument are also 5.3+.

It sounds like this will just make things inconsistent. The $flags will be ignored in 5.2 and things like . and .. will start showing up in the iterator when MW is installed in 5.2 and things will break inconsistently.

Status & tagging log