global $wgDirectoryMode;
if ( FileBackend::isStoragePath( $dir ) ) { // sanity
- throw new MWException( __FUNCTION__ . " given storage path `$dir`.");
+ throw new MWException( __FUNCTION__ . " given storage path '$dir'." );
}
if ( !is_null( $caller ) ) {
* Stream a file to the browser, adding all the headings and fun stuff.
* Headers sent include: Content-type, Content-Length, Last-Modified,
* and Content-Disposition.
- *
+ *
* @param $fname string Full name and path of the file to stream
* @param $headers array Any additional headers to send
* @param $sendErrors bool Send error messages if errors occur (like 404)
public static function stream( $fname, $headers = array(), $sendErrors = true ) {
wfProfileIn( __METHOD__ );
+ if ( FileBackend::isStoragePath( $fname ) ) { // sanity
+ throw new MWException( __FUNCTION__ . " given storage path '$fname'." );
+ }
+
wfSuppressWarnings();
$stat = stat( $fname );
wfRestoreWarnings();
/**
* Determine the file type of a file based on the path
- *
+ *
* @param $filename string Storage path or file system path
* @param $safe bool Whether to do retroactive upload blacklist checks
* @return null|string