r26175 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26174‎ | r26175 | r26176 >
Date:09:47, 27 September 2007
Author:raymond
Status:old
Tags:
Comment:
* Show relevant deletion log lines when uploading a previously deleted file
(when the desired filename is part of the URL: &wpDestFile=filename.jpg)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)
  • /trunk/phase3/skins/chick/main.css (modified) (history)
  • /trunk/phase3/skins/common/cologneblue.css (modified) (history)
  • /trunk/phase3/skins/common/oldshared.css (modified) (history)
  • /trunk/phase3/skins/monobook/main.css (modified) (history)
  • /trunk/phase3/skins/simple/main.css (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -829,6 +829,7 @@
830830 'destfilename',
831831 'watchthisupload',
832832 'filewasdeleted',
 833+ 'upload-wasdeleted',
833834 'filename-bad-prefix',
834835 'filename-prefix-blacklist',
835836 ),
Index: trunk/phase3/skins/chick/main.css
@@ -466,7 +466,8 @@
467467
468468 .templatesUsed { margin-top: 1.5em; }
469469
470 -/* Recreating-deleted-page warning and log entries */
 470+/* Recreating-deleted-page/reupload file warning and log entries */
 471+div#mw-upload-deleted-warn ul li,
471472 div#mw-recreate-deleted-warn ul li {
472473 font-size: 95%;
473474 }
Index: trunk/phase3/skins/monobook/main.css
@@ -1567,12 +1567,14 @@
15681568 background-color: #FFCCCC;
15691569 }
15701570
1571 -/* Recreating-deleted-page warning and log entries */
 1571+/* Recreating-deleted-page/reupload file warning and log entries */
 1572+div#mw-upload-deleted-warn,
15721573 div#mw-recreate-deleted-warn {
15731574 padding: 3px;
15741575 margin-bottom: 3px;
15751576 border: 2px solid #2F6FAB;
15761577 }
 1578+div#mw-upload-deleted-warn ul li
15771579 div#mw-recreate-deleted-warn ul li {
15781580 font-size: 90%;
15791581 }
@@ -1584,4 +1586,4 @@
15851587 text-align: center;
15861588 vertical-align: middle;
15871589 font-size: 90%;
1588 -}
\ No newline at end of file
 1590+}
Index: trunk/phase3/skins/common/cologneblue.css
@@ -95,13 +95,15 @@
9696 small { font-size: 75%; }
9797 input.mw-searchInput { width: 106px; }
9898
99 -/* Recreating-deleted-page warning and log entries */
 99+/* Recreating-deleted-page/reupload file warning and log entries */
 100+div#mw-upload-deleted-warn,
100101 div#mw-recreate-deleted-warn {
101102 padding: 3px;
102103 margin-top: 3px;
103104 margin-bottom: 3px;
104105 border: 1px solid #6688AA;
105106 }
 107+div#mw-upload-deleted-warn ul li,
106108 div#mw-recreate-deleted-warn ul li {
107109 font-size: 90%;
108110 }
\ No newline at end of file
Index: trunk/phase3/skins/common/oldshared.css
@@ -447,7 +447,8 @@
448448 float: right;
449449 }
450450
451 -/* Recreating-deleted-page warning and log entries */
 451+/* Recreating-deleted-page/reupload file warning and log entries */
 452+div#mw-upload-deleted-warn ul li,
452453 div#mw-recreate-deleted-warn ul li {
453454 font-size: 95%;
454455 }
Index: trunk/phase3/skins/simple/main.css
@@ -438,7 +438,8 @@
439439
440440 .templatesUsed { margin-top: 1.5em; }
441441
442 -/* Recreating-deleted-page warning and log entries */
 442+/* Recreating-deleted-page/reupload file warning and log entries */
 443+div#mw-upload-deleted-warn ul li,
443444 div#mw-recreate-deleted-warn ul li {
444445 font-size: 95%;
445446 }
Index: trunk/phase3/includes/SpecialUpload.php
@@ -795,10 +795,10 @@
796796
797797 $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
798798 $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview;
799 -
 799+
800800 $adc = wfBoolToStr( $useAjaxDestCheck );
801801 $alp = wfBoolToStr( $useAjaxLicensePreview );
802 -
 802+
803803 $wgOut->addScript( "<script type=\"text/javascript\">
804804 wgAjaxUploadDestCheck = {$adc};
805805 wgAjaxLicensePreview = {$alp};
@@ -811,10 +811,11 @@
812812 wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" );
813813 return false;
814814 }
815 -
816 - if( $this->mDesiredDestName && $wgUser->isAllowed( 'deletedhistory' ) ) {
 815+
 816+ if( $this->mDesiredDestName ) {
817817 $title = Title::makeTitleSafe( NS_IMAGE, $this->mDesiredDestName );
818 - if( $title instanceof Title && ( $count = $title->isDeleted() ) > 0 ) {
 818+ // Show a subtitle link to deleted revisions (to sysops et al only)
 819+ if( $title instanceof Title && ( $count = $title->isDeleted() ) > 0 && $wgUser->isAllowed( 'deletedhistory' ) ) {
819820 $link = wfMsgExt(
820821 $wgUser->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted',
821822 array( 'parse', 'replaceafter' ),
@@ -824,7 +825,12 @@
825826 )
826827 );
827828 $wgOut->addHtml( "<div id=\"contentSub2\">{$link}</div>" );
828 - }
 829+ }
 830+
 831+ // Show the relevant lines from deletion log (for still deleted files only)
 832+ if( $title instanceof Title && $title->isDeleted() > 0 && !$title->exists() ) {
 833+ $this->showDeletionLog( $wgOut, $title->getPrefixedText() );
 834+ }
829835 }
830836
831837 $cols = intval($wgUser->getOption( 'cols' ));
@@ -1463,4 +1469,29 @@
14641470 }
14651471 return $pageText;
14661472 }
 1473+
 1474+ /**
 1475+ * If there are rows in the deletion log for this file, show them,
 1476+ * along with a nice little note for the user
 1477+ *
 1478+ * @param OutputPage $out
 1479+ * @param string filename
 1480+ */
 1481+ private function showDeletionLog( $out, $filename ) {
 1482+ $reader = new LogReader(
 1483+ new FauxRequest(
 1484+ array(
 1485+ 'page' => $filename,
 1486+ 'type' => 'delete',
 1487+ )
 1488+ )
 1489+ );
 1490+ if( $reader->hasRows() ) {
 1491+ $out->addHtml( '<div id="mw-upload-deleted-warn">' );
 1492+ $out->addWikiText( wfMsg( 'upload-wasdeleted' ) );
 1493+ $viewer = new LogViewer( $reader );
 1494+ $viewer->showList( $out );
 1495+ $out->addHtml( '</div>' );
 1496+ }
 1497+ }
14671498 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1215,7 +1215,7 @@
12161216 * to ensure that client-side caches don't keep obsolete copies of global
12171217 * styles.
12181218 */
1219 -$wgStyleVersion = '99';
 1219+$wgStyleVersion = '100';
12201220
12211221
12221222 # Server-side caching:
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1428,6 +1428,10 @@
14291429 'destfilename' => 'Destination filename',
14301430 'watchthisupload' => 'Watch this page',
14311431 'filewasdeleted' => 'A file of this name has been previously uploaded and subsequently deleted. You should check the $1 before proceeding to upload it again.',
 1432+'upload-wasdeleted' => "'''Warning: You are uploading a file that was previously deleted.'''
 1433+
 1434+You should consider whether it is appropriate to continue uploading this file.
 1435+The deletion log for this file is provided here for convenience:",
14321436 'filename-bad-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.',
14331437 'filename-prefix-blacklist' => ' #<!-- leave this line exactly as it is --> <pre>
14341438 # Syntax is as follows:
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -1079,6 +1079,10 @@
10801080 'destfilename' => 'Zielname',
10811081 'watchthisupload' => 'Diese Seite beobachten',
10821082 '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.',
 1083+'upload-wasdeleted' => "'''Achtung: Du lädst eine Datei hoch, die bereits früher gelöscht wurde.'''
 1084+
 1085+Bitte prüfe sorgfältig, ob das erneute Hochladen den Richtlinien entspricht.
 1086+Zu Deiner Information folgt das Lösch-Logbuch mit der Begründung für die vorhergehende Löschung:",
10831087 'filename-bad-prefix' => 'Der Dateiname beginnt mit <strong>„$1“</strong>. Dies ist im allgemeinen der von einer Digitalkamera vorgegebener Dateiname und daher nicht sehr aussagekräftig.
10841088 Bitte gebe der Datei einen Namen, der den Inhalt besser beschreibt.',
10851089
Index: trunk/phase3/RELEASE-NOTES
@@ -29,6 +29,7 @@
3030 * (bug 11151) Add descriptive <title> to revision history page
3131 * (bug 5412) Add feed links for the site to all pages
3232 * (bug 11353) Add ability to retrieve raw section content via action=raw
 33+* Show relevant deletion log lines when uploading a previously deleted file
3334
3435 === Bug fixes in 1.12 ===
3536

Follow-up revisions

RevisionCommit summaryAuthorDate
r26222fix for bad CSS selector in r26175brion19:08, 28 September 2007
r26257Merged revisions 26134-26247 via svnmerge from...david19:06, 30 September 2007

Status & tagging log