Those wishing to use the latest code instead of a branch release can obtain
it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
-=== Configuration changes since 1.11 ===
+=== Configuration changes in 1.12 ===
=== New features in 1.12 ===
+* Add a warning for non-descriptive filenames at Special:Upload
=== Bug fixes in 1.12 ===
== Upgrading ==
-1.12 has several database changes since 1.10, and will not work without schema
+1.12 has several database changes since 1.11, and will not work without schema
updates.
If upgrading from before 1.7, you may want to run refreshLinks.php to ensure
substr( $partname , 0, strpos( $partname , '-' ) +1 ) ) . '</li>';
}
}
+
+ $filenamePrefix = self::getFilenamePrefix();
+ if ( count( $filenamePrefix ) ) {
+ # Do the match
+ foreach( $filenamePrefix as $prefix ) {
+ if ( substr( $partname, 0, strlen( $prefix ) ) == $prefix ) {
+ $warning .= '<li>' . wfMsgExt( 'filename-prefix', 'parseinline', $prefix ) . '</li>';
+ break;
+ }
+ }
+ }
+
if ( $file->wasDeleted() ) {
# If the file existed before and was deleted, warn the user of this
# Don't bother doing so if the image exists now, however
return $warning;
}
+ /**
+ * Get a list of warnings
+ *
+ * @param string local filename, e.g. 'file exists', 'non-descriptive filename'
+ * @return array list of warning messages
+ */
static function ajaxGetExistsWarning( $filename ) {
$file = wfFindFile( $filename );
if( !$file ) {
return $output->getText();
}
+ /**
+ * Get a list of filename prefixes from [[MediaWiki:filename-prefix-list]]
+ *
+ * @return array list of prefixes
+ */
+ public static function getFilenamePrefix() {
+ $message = wfMsgForContent( 'filename-prefix-list' );
+ if( $message && !( wfEmptyMsg( 'filename-prefix-list', $message ) || $message == '-' ) ) {
+ $lines = explode( "\n", $message );
+ foreach( $lines as $line ) {
+ // Remove comment lines
+ $comment = substr( trim( $line ), 0, 1 );
+ if ( $comment == '#' || $comment == '' ) {
+ continue;
+ }
+ // Remove additional comments after a prefix
+ $comment = strpos( $line, '#' );
+ if ( $comment > 0 ) {
+ $line = substr( $line, 0, $comment-1 );
+ }
+ $filenamePrefix[] = trim( $line );
+ }
+ } else {
+ $filenamePrefix = array();
+ }
+ return $filenamePrefix;
+ }
+
/**
* Stash a file in a temporary directory for later processing
* after the user has confirmed it.
'destfilename' => 'Zielname',
'watchthisupload' => 'Diese Seite beobachten',
'filewasdeleted' => 'Eine Datei mit diesem Namen wurde schon einmal hochgeladen und zwischenzeitlich wieder gelöscht. Bitte prüfe zuerst den Eintrag im $1, bevor du die Datei wirklich speicherst.',
+'filename-prefix' => 'Der Dateiname beginnt mit <strong>„$1“</strong>. Dies ist im allgemeinen der von einer Digitalkamera vorgegebener Dateiname und daher nicht sehr aussagekräftig.
+Bitte gebe der Datei einen Namen, der den Inhalt besser beschreibt.',
'upload-proto-error' => 'Falsches Protokoll',
'upload-proto-error-text' => 'Die URL muss mit <code>http://</code> oder <code>ftp://</code> beginnen.',
'destfilename' => 'Destination filename',
'watchthisupload' => 'Watch this page',
'filewasdeleted' => 'A file of this name has been previously uploaded and subsequently deleted. You should check the $1 before proceeding to upload it again.',
+'filename-prefix' => 'The name of the file you are uploading begins with <strong>"$1"</strong>, which is a non-descriptive name typically assigned automatically by digital cameras. Please choose a more descriptive name for your file.',
+'filename-prefix-list' => ' #<!-- leave this line exactly as it is --> <pre>
+# Syntax is as follows:
+# * Everything from a "#" character to the end of the line is a comment
+# * Every non-blank line is a prefix for typical file names assigned automatically by digital cameras
+CIMG # Casio
+DSC_ # Nikon
+DSCF # Fuji
+DSCN # Nikon
+DUW # some mobil phones
+IMG # generic
+JD # Jenoptik
+MGP # Pentax
+PICT # misc.
+ #</pre> <!-- leave this line exactly as it is -->', # only translate this message to other languages if you have to change it
'upload-proto-error' => 'Incorrect protocol',
'upload-proto-error-text' => 'Remote upload requires URLs beginning with <code>http://</code> or <code>ftp://</code>.',
'filerevert-backlink',
'filedelete-backlink',
'pagetitle',
+ 'filename-prefix-list',
);
/** EXIF messages, which may be set as optional in several checks, but are generally mandatory */
'destfilename',
'watchthisupload',
'filewasdeleted',
+ 'filename-prefix',
+ 'filename-prefix-list',
),
'upload-errors' => array(
'upload-proto-error',