}
}
+ public function getFeatures() {
+ return !wfIsWindows() ? FileBackend::ATTR_UNICODE_PATHS : 0;
+ }
+
protected function resolveContainerPath( $container, $relStoragePath ) {
// Check that container has a root directory
if ( isset( $this->containerPaths[$container] ) || isset( $this->basePath ) ) {
/** @var FileJournal */
protected $fileJournal;
- /** Flags for supported features */
- const ATTR_HEADERS = 1;
- const ATTR_METADATA = 2;
+ /** Bitfield flags for supported features */
+ const ATTR_HEADERS = 1; // files can be tagged with standard HTTP headers
+ const ATTR_METADATA = 2; // files can be stored with metadata key/values
+ const ATTR_UNICODE_PATHS = 4; // files can have Unicode paths (not just ASCII)
/**
* Create a new backend instance from configuration.
* @since 1.23
*/
public function getFeatures() {
- return 0;
+ return self::ATTR_UNICODE_PATHS;
}
/**
}
public function getFeatures() {
- return ( FileBackend::ATTR_HEADERS | FileBackend::ATTR_METADATA );
+ return ( FileBackend::ATTR_UNICODE_PATHS |
+ FileBackend::ATTR_HEADERS | FileBackend::ATTR_METADATA );
}
protected function resolveContainerPath( $container, $relStoragePath ) {
}
}
+ /**
+ * @return bool Whether non-ASCII path characters are allowed
+ */
+ public function backendSupportsUnicodePaths() {
+ return ( $this->getBackend()->getFeatures() & FileBackend::ATTR_UNICODE_PATHS );
+ }
+
/**
* Get the backend storage path corresponding to a virtual URL.
* Use this function wisely.
return $this->mTitle;
}
- // Windows may be broken with special characters, see bug XXX
- if ( wfIsWindows() && !preg_match( '/^[\x0-\x7f]*$/', $nt->getText() ) ) {
+ // Windows may be broken with special characters, see bug 1780
+ if ( !preg_match( '/^[\x0-\x7f]*$/', $nt->getText() )
+ && !RepoGroup::singleton()->getLocalRepo()->backendSupportsUnicodePaths()
+ ) {
$this->mTitleError = self::WINDOWS_NONASCII_FILENAME;
$this->mTitle = null;
return $this->mTitle;