diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-28 09:50:25 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-28 09:50:25 -0500 |
commit | 5744df39e15f85c6cc8a9faf8924d77e76d2b216 (patch) | |
tree | a8c8dd40a94d1fa0d5377566aa5548ae55a163da /includes/filerepo/file/File.php | |
parent | 4bb2aeca1d198391ca856aa16c40b8559c68daec (diff) | |
parent | 224b22a051051f6c2e494c3a2fb4adb42898e2d1 (diff) |
Merge branch 'archwiki'
Conflicts:
extensions/FluxBBAuthPlugin.php
extensions/SyntaxHighlight_GeSHi/README
extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php
extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.i18n.php
extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
extensions/SyntaxHighlight_GeSHi/geshi/docs/CHANGES
extensions/SyntaxHighlight_GeSHi/geshi/docs/THANKS
extensions/SyntaxHighlight_GeSHi/geshi/docs/TODO
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractClass.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractClass_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractMethod.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateClass.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateClass_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateMethod.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Class.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Class_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Constant.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Constructor.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Destructor.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Function.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Global.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/I.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Index.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Interface.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Interface_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/L.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Lminus.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Lplus.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Method.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Page.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Page_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateClass.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateClass_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateMethod.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateVariable.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/StaticMethod.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/StaticVariable.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/T.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Tminus.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Tplus.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Variable.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/blank.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/class_folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/file.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/function_folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/next_button.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/next_button_disabled.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/package.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/package_folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/previous_button.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/previous_button_disabled.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/private_class_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/tutorial.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/tutorial_folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/up_button.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html
extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt
extensions/SyntaxHighlight_GeSHi/geshi/geshi.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/4cs.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502acme.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502kickass.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502tasm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/68000devpac.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/abap.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/actionscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/actionscript3.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ada.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/algol68.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/apache.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/applescript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/apt_sources.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/asm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/asp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/autoconf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/autohotkey.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/autoit.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/avisynth.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/awk.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bascomavr.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bash.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/basic4gl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bibtex.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/blitzbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bnf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/boo.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/c.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/c_loadrunner.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/c_mac.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/caddcl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cadlisp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cfdg.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cfm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/chaiscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cil.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/clojure.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cmake.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cobol.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/coffeescript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cpp-qt.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cpp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/csharp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/css.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cuesheet.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/d.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/dcs.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/delphi.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/diff.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/div.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/dos.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/dot.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/e.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ecmascript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/eiffel.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/email.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/epc.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/erlang.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/euphoria.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/f1.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/falcon.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/fo.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/fortran.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/freebasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/fsharp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gambas.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gdb.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/genero.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/genie.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gettext.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/glsl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gnuplot.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/go.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/groovy.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gwbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/haskell.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/hicest.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/hq9plus.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/html4strict.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/html5.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/icon.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/idl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ini.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/inno.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/intercal.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/io.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/j.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/java.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/java5.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/javascript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/jquery.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/kixtart.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/klonec.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/klonecpp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/latex.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lb.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lisp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/llvm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/locobasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/logtalk.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lolcode.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lotusformulas.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lotusscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lsl2.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lua.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/m68k.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/magiksf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/make.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mapbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/matlab.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mirc.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mmix.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/modula2.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/modula3.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mpasm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mxml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mysql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/newlisp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/nsis.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oberon2.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/objc.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/objeck.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ocaml-brief.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ocaml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oobas.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oracle11.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oracle8.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oxygene.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oz.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pascal.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pcre.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/per.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/perl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/perl6.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pic16.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pike.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pixelbender.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pli.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/plsql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/postgresql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/povray.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/powerbuilder.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/powershell.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/proftpd.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/progress.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/prolog.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/properties.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/providex.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/purebasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pycon.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/python.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/q.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/qbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/rails.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/rebol.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/reg.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/robots.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/rpmspec.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/rsplus.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ruby.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/sas.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/scala.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/scheme.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/scilab.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/sdlbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/smalltalk.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/smarty.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/sql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/systemverilog.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/tcl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/teraterm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/text.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/thinbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/tsql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/typoscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/unicon.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/uscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vala.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vb.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vbnet.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/verilog.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vhdl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vim.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/visualfoxpro.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/visualprolog.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/whitespace.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/whois.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/winbatch.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/xbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/xml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/xorg_conf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/xpp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/yaml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/z80.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/zxbasic.php
Diffstat (limited to 'includes/filerepo/file/File.php')
-rw-r--r-- | includes/filerepo/file/File.php | 239 |
1 files changed, 154 insertions, 85 deletions
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 557609d4..ec5f927b 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -40,7 +40,7 @@ * never name a file class explictly outside of the repo class. Instead use the * repo's factory functions to generate file objects, for example: * - * RepoGroup::singleton()->getLocalRepo()->newFile($title); + * RepoGroup::singleton()->getLocalRepo()->newFile( $title ); * * The convenience functions wfLocalFile() and wfFindFile() should be sufficient * in most cases. @@ -48,13 +48,14 @@ * @ingroup FileAbstraction */ abstract class File { + // Bitfield values akin to the Revision deletion constants const DELETED_FILE = 1; const DELETED_COMMENT = 2; const DELETED_USER = 4; const DELETED_RESTRICTED = 8; /** Force rendering in the current process */ - const RENDER_NOW = 1; + const RENDER_NOW = 1; /** * Force rendering even if thumbnail already exist and using RENDER_NOW * I.e. you have to pass both flags: File::RENDER_NOW | File::RENDER_FORCE @@ -152,7 +153,7 @@ abstract class File { * valid Title object with namespace NS_FILE or null * * @param $title Title|string - * @param $exception string|bool Use 'exception' to throw an error on bad titles + * @param string|bool $exception Use 'exception' to throw an error on bad titles * @throws MWException * @return Title|null */ @@ -190,7 +191,7 @@ abstract class File { * Normalize a file extension to the common form, and ensure it's clean. * Extensions with non-alphanumeric characters will be discarded. * - * @param $ext string (without the .) + * @param string $ext (without the .) * @return string */ static function normalizeExtension( $ext ) { @@ -201,9 +202,9 @@ abstract class File { 'mpeg' => 'mpg', 'tiff' => 'tif', 'ogv' => 'ogg' ); - if( isset( $squish[$lower] ) ) { + if ( isset( $squish[$lower] ) ) { return $squish[$lower]; - } elseif( preg_match( '/^[0-9a-z]+$/', $lower ) ) { + } elseif ( preg_match( '/^[0-9a-z]+$/', $lower ) ) { return $lower; } else { return ''; @@ -214,7 +215,7 @@ abstract class File { * Checks if file extensions are compatible * * @param $old File Old file - * @param $new string New name + * @param string $new New name * * @return bool|null */ @@ -241,7 +242,7 @@ abstract class File { * @return array ("text", "html") etc */ public static function splitMime( $mime ) { - if( strpos( $mime, '/' ) !== false ) { + if ( strpos( $mime, '/' ) !== false ) { return explode( '/', $mime, 2 ); } else { return array( $mime, 'unknown' ); @@ -316,7 +317,8 @@ abstract class File { public function getUrl() { if ( !isset( $this->url ) ) { $this->assertRepoDefined(); - $this->url = $this->repo->getZoneUrl( 'public' ) . '/' . $this->getUrlRel(); + $ext = $this->getExtension(); + $this->url = $this->repo->getZoneUrl( 'public', $ext ) . '/' . $this->getUrlRel(); } return $this->url; } @@ -347,7 +349,7 @@ abstract class File { if ( $this->canRender() ) { return $this->createThumb( $this->getWidth() ); } else { - wfDebug( __METHOD__.': supposed to render ' . $this->getName() . + wfDebug( __METHOD__ . ': supposed to render ' . $this->getName() . ' (' . $this->getMimeType() . "), but can't!\n" ); return $this->getURL(); #hm... return NULL? } @@ -368,7 +370,7 @@ abstract class File { * returns false. * * @return string|bool ForeignAPIFile::getPath can return false - */ + */ public function getPath() { if ( !isset( $this->path ) ) { $this->assertRepoDefined(); @@ -431,7 +433,7 @@ abstract class File { * Returns ID or name of user who uploaded the file * STUB * - * @param $type string 'text' or 'id' + * @param string $type 'text' or 'id' * * @return string|int */ @@ -511,13 +513,13 @@ abstract class File { } /** - * get versioned metadata - * - * @param $metadata Mixed Array or String of (serialized) metadata - * @param $version integer version number. - * @return Array containing metadata, or what was passed to it on fail (unserializing if not array) - */ - public function convertMetadataVersion($metadata, $version) { + * get versioned metadata + * + * @param $metadata Mixed Array or String of (serialized) metadata + * @param $version integer version number. + * @return Array containing metadata, or what was passed to it on fail (unserializing if not array) + */ + public function convertMetadataVersion( $metadata, $version ) { $handler = $this->getHandler(); if ( !is_array( $metadata ) ) { // Just to make the return type consistent @@ -662,13 +664,13 @@ abstract class File { if ( $this->allowInlineDisplay() ) { return true; } - if ($this->isTrustedFile()) { + if ( $this->isTrustedFile() ) { return true; } $type = $this->getMediaType(); $mime = $this->getMimeType(); - #wfDebug("LocalFile::isSafeFile: type= $type, mime= $mime\n"); + #wfDebug( "LocalFile::isSafeFile: type= $type, mime= $mime\n" ); if ( !$type || $type === MEDIATYPE_UNKNOWN ) { return false; #unknown type, not trusted @@ -680,7 +682,7 @@ abstract class File { if ( $mime === "unknown/unknown" ) { return false; #unknown type, not trusted } - if ( in_array( $mime, $wgTrustedMediaFormats) ) { + if ( in_array( $mime, $wgTrustedMediaFormats ) ) { return true; } @@ -736,7 +738,7 @@ abstract class File { if ( $this->repo ) { $script = $this->repo->getThumbScriptUrl(); if ( $script ) { - $this->transformScript = "$script?f=" . urlencode( $this->getName() ); + $this->transformScript = wfAppendQuery( $script, array( 'f' => $this->getName() ) ); } } } @@ -766,7 +768,7 @@ abstract class File { * Use File::THUMB_FULL_NAME to always get a name like "<params>-<source>". * Otherwise, the format may be "<params>-<source>" or "<params>-thumbnail.<ext>". * - * @param $params Array: handler-specific parameters + * @param array $params handler-specific parameters * @param $flags integer Bitfield that supports THUMB_* constants * @return string */ @@ -831,8 +833,8 @@ abstract class File { /** * Return either a MediaTransformError or placeholder thumbnail (if $wgIgnoreImageErrors) * - * @param $thumbPath string Thumbnail storage path - * @param $thumbUrl string Thumbnail URL + * @param string $thumbPath Thumbnail storage path + * @param string $thumbUrl Thumbnail URL * @param $params Array * @param $flags integer * @return MediaTransformOutput @@ -840,8 +842,9 @@ abstract class File { protected function transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags ) { global $wgIgnoreImageErrors; - if ( $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) { - return $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); + $handler = $this->getHandler(); + if ( $handler && $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) { + return $handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); } else { return new MediaTransformError( 'thumbnail_error', $params['width'], 0, wfMessage( 'thumbnail-dest-create' )->text() ); @@ -851,7 +854,7 @@ abstract class File { /** * Transform a media file * - * @param $params Array: an associative array of handler-specific parameters. + * @param array $params an associative array of handler-specific parameters. * Typical keys are width, height and page. * @param $flags Integer: a bitfield, may contain self::RENDER_NOW to force rendering * @return MediaTransformOutput|bool False on failure @@ -872,17 +875,18 @@ abstract class File { $params['descriptionUrl'] = wfExpandUrl( $descriptionUrl, PROTO_CANONICAL ); } + $handler = $this->getHandler(); $script = $this->getTransformScript(); if ( $script && !( $flags & self::RENDER_NOW ) ) { // Use a script to transform on client request, if possible - $thumb = $this->handler->getScriptedTransform( $this, $script, $params ); + $thumb = $handler->getScriptedTransform( $this, $script, $params ); if ( $thumb ) { break; } } $normalisedParams = $params; - $this->handler->normaliseParams( $this, $normalisedParams ); + $handler->normaliseParams( $this, $normalisedParams ); $thumbName = $this->thumbName( $normalisedParams ); $thumbUrl = $this->getThumbUrl( $thumbName ); @@ -895,20 +899,20 @@ abstract class File { // XXX: Pass in the storage path even though we are not rendering anything // and the path is supposed to be an FS path. This is due to getScalerType() // getting called on the path and clobbering $thumb->getUrl() if it's false. - $thumb = $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); + $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); break; } // Clean up broken thumbnails as needed $this->migrateThumbFile( $thumbName ); // Check if an up-to-date thumbnail already exists... - wfDebug( __METHOD__.": Doing stat for $thumbPath\n" ); - if ( $this->repo->fileExists( $thumbPath ) && !( $flags & self::RENDER_FORCE ) ) { + wfDebug( __METHOD__ . ": Doing stat for $thumbPath\n" ); + if ( !( $flags & self::RENDER_FORCE ) && $this->repo->fileExists( $thumbPath ) ) { $timestamp = $this->repo->getFileTimestamp( $thumbPath ); if ( $timestamp !== false && $timestamp >= $wgThumbnailEpoch ) { // XXX: Pass in the storage path even though we are not rendering anything // and the path is supposed to be an FS path. This is due to getScalerType() // getting called on the path and clobbering $thumb->getUrl() if it's false. - $thumb = $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); + $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); $thumb->setStoragePath( $thumbPath ); break; } @@ -935,7 +939,7 @@ abstract class File { // Actually render the thumbnail... wfProfileIn( __METHOD__ . '-doTransform' ); - $thumb = $this->handler->doTransform( $this, $tmpThumbPath, $thumbUrl, $params ); + $thumb = $handler->doTransform( $this, $tmpThumbPath, $thumbUrl, $params ); wfProfileOut( __METHOD__ . '-doTransform' ); $tmpFile->bind( $thumb ); // keep alive with $thumb @@ -945,7 +949,7 @@ abstract class File { $this->lastError = $thumb->toText(); // Ignore errors if requested if ( $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) { - $thumb = $this->handler->getTransform( $this, $tmpThumbPath, $thumbUrl, $params ); + $thumb = $handler->getTransform( $this, $tmpThumbPath, $thumbUrl, $params ); } } elseif ( $this->repo && $thumb->hasFile() && !$thumb->fileIsSource() ) { // Copy the thumbnail from the file system into storage... @@ -975,7 +979,7 @@ abstract class File { } /** - * @param $thumbName string Thumbnail name + * @param string $thumbName Thumbnail name * @return string Content-Disposition header value */ function getThumbDisposition( $thumbName ) { @@ -997,7 +1001,7 @@ abstract class File { /** * Get a MediaHandler instance for this file * - * @return MediaHandler + * @return MediaHandler|boolean Registered MediaHandler for file's mime type or false if none found */ function getHandler() { if ( !isset( $this->handler ) ) { @@ -1048,7 +1052,7 @@ abstract class File { * Purge shared caches such as thumbnails and DB data caching * STUB * Overridden by LocalFile - * @param $options Array Options, which include: + * @param array $options Options, which include: * 'forThumbRefresh' : The purging is only to refresh thumbnails */ function purgeCache( $options = array() ) {} @@ -1088,13 +1092,13 @@ abstract class File { * * STUB * @param $limit integer Limit of rows to return - * @param $start string timestamp Only revisions older than $start will be returned - * @param $end string timestamp Only revisions newer than $end will be returned - * @param $inc bool Include the endpoints of the time range + * @param string $start timestamp Only revisions older than $start will be returned + * @param string $end timestamp Only revisions newer than $end will be returned + * @param bool $inc Include the endpoints of the time range * * @return array */ - function getHistory( $limit = null, $start = null, $end = null, $inc=true ) { + function getHistory( $limit = null, $start = null, $end = null, $inc = true ) { return array(); } @@ -1147,7 +1151,7 @@ abstract class File { /** * Get the path of an archived file relative to the public zone root * - * @param $suffix bool|string if not false, the name of an archived thumbnail file + * @param bool|string $suffix if not false, the name of an archived thumbnail file * * @return string */ @@ -1165,7 +1169,7 @@ abstract class File { * Get the path, relative to the thumbnail zone root, of the * thumbnail directory or a particular file if $suffix is specified * - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param bool|string $suffix if not false, the name of a thumbnail file * * @return string */ @@ -1191,8 +1195,8 @@ abstract class File { * Get the path, relative to the thumbnail zone root, for an archived file's thumbs directory * or a specific thumb if the $suffix is given. * - * @param $archiveName string the timestamped name of an archived image - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param string $archiveName the timestamped name of an archived image + * @param bool|string $suffix if not false, the name of a thumbnail file * * @return string */ @@ -1209,7 +1213,7 @@ abstract class File { /** * Get the path of the archived file. * - * @param $suffix bool|string if not false, the name of an archived file. + * @param bool|string $suffix if not false, the name of an archived file. * * @return string */ @@ -1221,8 +1225,8 @@ abstract class File { /** * Get the path of an archived file's thumbs, or a particular thumb if $suffix is specified * - * @param $archiveName string the timestamped name of an archived image - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param string $archiveName the timestamped name of an archived image + * @param bool|string $suffix if not false, the name of a thumbnail file * * @return string */ @@ -1235,7 +1239,7 @@ abstract class File { /** * Get the path of the thumbnail directory, or a particular file if $suffix is specified * - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param bool|string $suffix if not false, the name of a thumbnail file * * @return string */ @@ -1245,15 +1249,28 @@ abstract class File { } /** + * Get the path of the transcoded directory, or a particular file if $suffix is specified + * + * @param bool|string $suffix if not false, the name of a media file + * + * @return string + */ + function getTranscodedPath( $suffix = false ) { + $this->assertRepoDefined(); + return $this->repo->getZonePath( 'transcoded' ) . '/' . $this->getThumbRel( $suffix ); + } + + /** * Get the URL of the archive directory, or a particular file if $suffix is specified * - * @param $suffix bool|string if not false, the name of an archived file + * @param bool|string $suffix if not false, the name of an archived file * * @return string */ function getArchiveUrl( $suffix = false ) { $this->assertRepoDefined(); - $path = $this->repo->getZoneUrl( 'public' ) . '/archive/' . $this->getHashPath(); + $ext = $this->getExtension(); + $path = $this->repo->getZoneUrl( 'public', $ext ) . '/archive/' . $this->getHashPath(); if ( $suffix === false ) { $path = substr( $path, 0, -1 ); } else { @@ -1265,14 +1282,15 @@ abstract class File { /** * Get the URL of the archived file's thumbs, or a particular thumb if $suffix is specified * - * @param $archiveName string the timestamped name of an archived image - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param string $archiveName the timestamped name of an archived image + * @param bool|string $suffix if not false, the name of a thumbnail file * * @return string */ function getArchiveThumbUrl( $archiveName, $suffix = false ) { $this->assertRepoDefined(); - $path = $this->repo->getZoneUrl( 'thumb' ) . '/archive/' . + $ext = $this->getExtension(); + $path = $this->repo->getZoneUrl( 'thumb', $ext ) . '/archive/' . $this->getHashPath() . rawurlencode( $archiveName ) . "/"; if ( $suffix === false ) { $path = substr( $path, 0, -1 ); @@ -1283,15 +1301,17 @@ abstract class File { } /** - * Get the URL of the thumbnail directory, or a particular file if $suffix is specified + * Get the URL of the zone directory, or a particular file if $suffix is specified * - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param string $zone name of requested zone + * @param bool|string $suffix if not false, the name of a file in zone * * @return string path */ - function getThumbUrl( $suffix = false ) { + function getZoneUrl( $zone, $suffix = false ) { $this->assertRepoDefined(); - $path = $this->repo->getZoneUrl( 'thumb' ) . '/' . $this->getUrlRel(); + $ext = $this->getExtension(); + $path = $this->repo->getZoneUrl( $zone, $ext ) . '/' . $this->getUrlRel(); if ( $suffix !== false ) { $path .= '/' . rawurlencode( $suffix ); } @@ -1299,9 +1319,31 @@ abstract class File { } /** + * Get the URL of the thumbnail directory, or a particular file if $suffix is specified + * + * @param bool|string $suffix if not false, the name of a thumbnail file + * + * @return string path + */ + function getThumbUrl( $suffix = false ) { + return $this->getZoneUrl( 'thumb', $suffix ); + } + + /** + * Get the URL of the transcoded directory, or a particular file if $suffix is specified + * + * @param bool|string $suffix if not false, the name of a media file + * + * @return string path + */ + function getTranscodedUrl( $suffix = false ) { + return $this->getZoneUrl( 'transcoded', $suffix ); + } + + /** * Get the public zone virtual URL for a current version source file * - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param bool|string $suffix if not false, the name of a thumbnail file * * @return string */ @@ -1317,7 +1359,7 @@ abstract class File { /** * Get the public zone virtual URL for an archived version source file * - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param bool|string $suffix if not false, the name of a thumbnail file * * @return string */ @@ -1335,7 +1377,7 @@ abstract class File { /** * Get the virtual URL for a thumbnail file or directory * - * @param $suffix bool|string if not false, the name of a thumbnail file + * @param bool|string $suffix if not false, the name of a thumbnail file * * @return string */ @@ -1360,7 +1402,7 @@ abstract class File { * @throws MWException */ function readOnlyError() { - throw new MWException( get_class($this) . ': write operations are not supported' ); + throw new MWException( get_class( $this ) . ': write operations are not supported' ); } /** @@ -1373,8 +1415,12 @@ abstract class File { * @param $copyStatus string * @param $source string * @param $watch bool + * @param $timestamp string|bool + * @param $user User object or null to use $wgUser + * @return bool + * @throws MWException */ - function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '', $watch = false ) { + function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '', $watch = false, $timestamp = false, User $user = null ) { $this->readOnlyError(); } @@ -1386,17 +1432,21 @@ abstract class File { * The archive name should be passed through to recordUpload for database * registration. * - * @param $srcPath String: local filesystem path to the source image + * Options to $options include: + * - headers : name/value map of HTTP headers to use in response to GET/HEAD requests + * + * @param string $srcPath local filesystem path to the source image * @param $flags Integer: a bitwise combination of: * File::DELETE_SOURCE Delete the source file, i.e. move * rather than copy + * @param array $options Optional additional parameters * @return FileRepoStatus object. On success, the value member contains the * archive name, or an empty string if it was a new file. * * STUB * Overridden by LocalFile */ - function publish( $srcPath, $flags = 0 ) { + function publish( $srcPath, $flags = 0, array $options = array() ) { $this->readOnlyError(); } @@ -1451,7 +1501,7 @@ abstract class File { * Is this file a "deleted" file in a private archive? * STUB * - * @param $field + * @param integer $field one of DELETED_* bitfield constants * * @return bool */ @@ -1490,9 +1540,9 @@ abstract class File { * @param $target Title New file name * @return FileRepoStatus object. */ - function move( $target ) { + function move( $target ) { $this->readOnlyError(); - } + } /** * Delete all versions of the file. @@ -1518,9 +1568,9 @@ abstract class File { * * May throw database exceptions on error. * - * @param $versions array set of record ids of deleted items to restore, + * @param array $versions set of record ids of deleted items to restore, * or empty to restore all revisions. - * @param $unsuppress bool remove restrictions on content upon restoration? + * @param bool $unsuppress remove restrictions on content upon restoration? * @return int|bool the number of file revisions restored if successful, * or false on failure * STUB @@ -1580,7 +1630,7 @@ abstract class File { * Get an image size array like that returned by getImageSize(), or false if it * can't be determined. * - * @param $fileName String: The filename + * @param string $fileName The filename * @return Array */ function getImageSize( $fileName ) { @@ -1607,25 +1657,29 @@ abstract class File { /** * Get the HTML text of the description page, if available * + * @param $lang Language Optional language to fetch description in * @return string */ - function getDescriptionText() { + function getDescriptionText( $lang = false ) { global $wgMemc, $wgLang; if ( !$this->repo || !$this->repo->fetchDescription ) { return false; } - $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName(), $wgLang->getCode() ); + if ( !$lang ) { + $lang = $wgLang; + } + $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName(), $lang->getCode() ); if ( $renderUrl ) { if ( $this->repo->descriptionCacheExpiry > 0 ) { - wfDebug("Attempting to get the description from cache..."); - $key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', 'url', $wgLang->getCode(), + wfDebug( "Attempting to get the description from cache..." ); + $key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', 'url', $lang->getCode(), $this->getName() ); - $obj = $wgMemc->get($key); - if ($obj) { - wfDebug("success!\n"); + $obj = $wgMemc->get( $key ); + if ( $obj ) { + wfDebug( "success!\n" ); return $obj; } - wfDebug("miss\n"); + wfDebug( "miss\n" ); } wfDebug( "Fetching shared description from $renderUrl\n" ); $res = Http::get( $renderUrl ); @@ -1704,14 +1758,15 @@ abstract class File { /** * Get an associative array containing information about a file in the local filesystem. * - * @param $path String: absolute local filesystem path + * @param string $path absolute local filesystem path * @param $ext Mixed: the file extension, or true to extract it from the filename. * Set it to false to ignore the extension. * * @return array + * @deprecated since 1.19 */ static function getPropsFromPath( $path, $ext = true ) { - wfDebug( __METHOD__.": Getting file info for $path\n" ); + wfDebug( __METHOD__ . ": Getting file info for $path\n" ); wfDeprecated( __METHOD__, '1.19' ); $fsFile = new FSFile( $path ); @@ -1728,6 +1783,7 @@ abstract class File { * @param $path string * * @return bool|string False on failure + * @deprecated since 1.19 */ static function sha1Base36( $path ) { wfDeprecated( __METHOD__, '1.19' ); @@ -1737,6 +1793,18 @@ abstract class File { } /** + * @return Array HTTP header name/value map to use for HEAD/GET request responses + */ + function getStreamHeaders() { + $handler = $this->getHandler(); + if ( $handler ) { + return $handler->getStreamHeaders( $this->getMetadata() ); + } else { + return array(); + } + } + + /** * @return string */ function getLongDesc() { @@ -1780,7 +1848,7 @@ abstract class File { } /** - * @return Title + * @return Title|null */ function getRedirectedTitle() { if ( $this->redirected ) { @@ -1789,6 +1857,7 @@ abstract class File { } return $this->redirectTitle; } + return null; } /** |