r88868 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88867‎ | r88868 | r88869 >
Date:23:55, 25 May 2011
Author:reedy
Status:deferred (Comments)
Tags:
Comment:
* (bug 29144) Move action=dublincore and action=creativecommons to extensions

Moved dublincore out to extension
Modified paths:
  • /trunk/extensions/DublinCoreRdf (added) (history)
  • /trunk/extensions/DublinCoreRdf/DublinCore.php (added) (history)
  • /trunk/extensions/DublinCoreRdf/DublinCoreRdf_body.php (added) (history)
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Metadata.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -2489,7 +2489,6 @@
24902490 'group-bureaucrat.js',
24912491 ),
24922492 'metadata_cc' => array(
2493 - 'nodublincore',
24942493 'nocreativecommons',
24952494 'notacceptable',
24962495 ),
Index: trunk/phase3/includes/OutputPage.php
@@ -2703,7 +2703,7 @@
27042704 global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
27052705 $wgSitename, $wgVersion, $wgHtml5, $wgMimeType,
27062706 $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
2707 - $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf,
 2707+ $wgEnableCreativeCommonsRdf,
27082708 $wgDisableLangConversion, $wgCanonicalLanguageLinks, $wgContLang,
27092709 $wgRightsPage, $wgRightsUrl;
27102710
@@ -2844,15 +2844,6 @@
28452845 'href' => $this->getTitle()->getLocalURL( 'action=creativecommons' ) )
28462846 );
28472847 }
2848 -
2849 - if ( $wgEnableDublinCoreRdf ) {
2850 - $tags[] = Html::element( 'link', array(
2851 - 'rel' => $this->getMetadataAttribute(),
2852 - 'title' => 'Dublin Core',
2853 - 'type' => 'application/rdf+xml',
2854 - 'href' => $this->getTitle()->getLocalURL( 'action=dublincore' ) )
2855 - );
2856 - }
28572848 }
28582849
28592850 # Language variants
Index: trunk/phase3/includes/AutoLoader.php
@@ -53,7 +53,6 @@
5454 'DiffHistoryBlob' => 'includes/HistoryBlob.php',
5555 'DjVuImage' => 'includes/DjVuImage.php',
5656 'DoubleReplacer' => 'includes/StringUtils.php',
57 - 'DublinCoreRdf' => 'includes/Metadata.php',
5857 'DummyLinker' => 'includes/Linker.php',
5958 'Dump7ZipOutput' => 'includes/Export.php',
6059 'DumpBZip2Output' => 'includes/Export.php',
Index: trunk/phase3/includes/Wiki.php
@@ -407,7 +407,7 @@
408408 */
409409 private function performAction( $article ) {
410410 global $wgSquidMaxage, $wgUseExternalEditor,
411 - $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
 411+ $wgEnableCreativeCommonsRdf;
412412
413413 wfProfileIn( __METHOD__ );
414414
@@ -450,14 +450,6 @@
451451 case 'deletetrackback':
452452 $article->$act();
453453 break;
454 - case 'dublincore':
455 - if ( !$wgEnableDublinCoreRdf ) {
456 - wfHttpError( 403, 'Forbidden', wfMsg( 'nodublincore' ) );
457 - } else {
458 - $rdf = new DublinCoreRdf( $article );
459 - $rdf->show();
460 - }
461 - break;
462454 case 'creativecommons':
463455 if ( !$wgEnableCreativeCommonsRdf ) {
464456 wfHttpError( 403, 'Forbidden', wfMsg( 'nocreativecommons' ) );
Index: trunk/phase3/includes/DefaultSettings.php
@@ -4407,7 +4407,6 @@
44084408 */
44094409
44104410 /** RDF metadata toggles */
4411 -$wgEnableDublinCoreRdf = false;
44124411 $wgEnableCreativeCommonsRdf = false;
44134412
44144413 /** Override for copyright metadata.
@@ -5040,7 +5039,7 @@
50415040 );
50425041
50435042 /**
5044 - * Array of disabled article actions, e.g. view, edit, dublincore, delete, etc.
 5043+ * Array of disabled article actions, e.g. view, edit, delete, etc.
50455044 * @deprecated since 1.18; just set $wgActions['action'] = false instead
50465045 */
50475046 $wgDisabledActions = array();
Index: trunk/phase3/includes/Metadata.php
@@ -1,6 +1,6 @@
22 <?php
33 /**
4 - * Provides DublinCore and CreativeCommons metadata
 4+ * Provides CreativeCommons metadata
55 *
66 * Copyright 2004, Evan Prodromou <evan@wikitravel.org>.
77 *
@@ -198,42 +198,6 @@
199199 }
200200 }
201201
202 -class DublinCoreRdf extends RdfMetaData {
203 -
204 - public function show(){
205 - if( $this->setup() ){
206 - $this->prologue();
207 - $this->basics();
208 - $this->epilogue();
209 - }
210 - }
211 -
212 - /**
213 - * begin of the page
214 - */
215 - protected function prologue() {
216 - $url = htmlspecialchars( $this->reallyFullUrl() );
217 - print <<<PROLOGUE
218 -<?xml version="1.0" encoding="UTF-8" ?>
219 -<!DOCTYPE rdf:RDF PUBLIC "-//DUBLIN CORE//DCMES DTD 2002/07/31//EN" "http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.dtd">
220 -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
221 - xmlns:dc="http://purl.org/dc/elements/1.1/">
222 - <rdf:Description rdf:about="{$url}">
223 -
224 -PROLOGUE;
225 - }
226 -
227 - /**
228 - * end of the page
229 - */
230 - protected function epilogue() {
231 - print <<<EPILOGUE
232 - </rdf:Description>
233 -</rdf:RDF>
234 -EPILOGUE;
235 - }
236 -}
237 -
238202 class CreativeCommonsRdf extends RdfMetaData {
239203
240204 public function show(){
Index: trunk/extensions/DublinCoreRdf/DublinCoreRdf_body.php
@@ -0,0 +1,59 @@
 2+<?php
 3+/**
 4+ * Provides DublinCore metadata
 5+ *
 6+ * Copyright 2004, Evan Prodromou <evan@wikitravel.org>.
 7+ *
 8+ * This program is free software; you can redistribute it and/or modify
 9+ * it under the terms of the GNU General Public License as published by
 10+ * the Free Software Foundation; either version 2 of the License, or
 11+ * (at your option) any later version.
 12+ *
 13+ * This program is distributed in the hope that it will be useful,
 14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 16+ * GNU General Public License for more details.
 17+ *
 18+ * You should have received a copy of the GNU General Public License
 19+ * along with this program; if not, write to the Free Software
 20+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 21+ *
 22+ * @author Evan Prodromou <evan@wikitravel.org>
 23+ * @file
 24+ */
 25+
 26+class DublinCoreRdf extends RdfMetaData {
 27+
 28+ public function show(){
 29+ if( $this->setup() ){
 30+ $this->prologue();
 31+ $this->basics();
 32+ $this->epilogue();
 33+ }
 34+ }
 35+
 36+ /**
 37+ * begin of the page
 38+ */
 39+ protected function prologue() {
 40+ $url = htmlspecialchars( $this->reallyFullUrl() );
 41+ print <<<PROLOGUE
 42+<?xml version="1.0" encoding="UTF-8" ?>
 43+<!DOCTYPE rdf:RDF PUBLIC "-//DUBLIN CORE//DCMES DTD 2002/07/31//EN" "http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.dtd">
 44+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 45+ xmlns:dc="http://purl.org/dc/elements/1.1/">
 46+ <rdf:Description rdf:about="{$url}">
 47+
 48+PROLOGUE;
 49+ }
 50+
 51+ /**
 52+ * end of the page
 53+ */
 54+ protected function epilogue() {
 55+ print <<<EPILOGUE
 56+ </rdf:Description>
 57+</rdf:RDF>
 58+EPILOGUE;
 59+ }
 60+}
\ No newline at end of file
Property changes on: trunk/extensions/DublinCoreRdf/DublinCoreRdf_body.php
___________________________________________________________________
Added: svn:keywords
161 + Author Date Id Revision
Added: svn:eol-style
262 + native
Index: trunk/extensions/DublinCoreRdf/DublinCore.php
@@ -0,0 +1,25 @@
 2+<?php
 3+
 4+$wgExtensionCredits['other'][] = array(
 5+ 'path' => __FILE__,
 6+ 'name' => 'DublinCore',
 7+ 'url' => '',
 8+ 'author' => 'Evan Prodromou',
 9+);
 10+
 11+$wgHooks['MediaWikiPerformAction'][] = 'efDublinCorePreformAction';
 12+
 13+ $rdf = new DublinCoreRdf( $article );
 14+ $rdf->show();
 15+
 16+$wgAutoloadClasses['DublinCoreRdf'] = $dir . 'DublinCoreRdf_body.php';
 17+
 18+function efDublinCorePreformAction( $output, $article, $title, $user, $request, $mediaWiki ) {
 19+ if ( $mediaWiki->getAction() !== 'dublincore' ) {
 20+ return true;
 21+ }
 22+
 23+ $rdf = new DublinCoreRdf( $article );
 24+ $rdf->show();
 25+ return false;
 26+}
\ No newline at end of file
Property changes on: trunk/extensions/DublinCoreRdf/DublinCore.php
___________________________________________________________________
Added: svn:eol-style
127 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r88872Followup r88868, name file same as directory for installer nicenessreedy00:01, 26 May 2011
r88873* (bug 29144) Move action=dublincore and action=creativecommons to extensions...reedy00:08, 26 May 2011
r88876* (bug 29144) Move action=dublincore and action=creativecommons to extensions...reedy00:57, 26 May 2011

Comments

#Comment by Raymond (talk | contribs)   08:07, 27 May 2011

Any reason why the English messages are still in MessagesEn.php? Shouldn't they be moved to DublinCoreRdf.i18n.php, should they? Same questtion for r88873.

If you move, pls do English only. Treanslatewiki will care about all translations.

#Comment by Reedy (talk | contribs)   09:28, 27 May 2011

I presumed removing from messages.inc would've removed them from the en ones too.. Which seems to have happened in r88933

As for moving the messages

'nodublincore'      => 'Dublin Core RDF metadata disabled for this server.',
'nocreativecommons' => 'Creative Commons RDF metadata disabled for this server.',

I don't see any reason to do so. Having them in an extension, and then optionally enabling/disabling them seems stupid to me, hence, these messages are now useless

#Comment by Raymond (talk | contribs)   09:32, 27 May 2011

My fault. You are right. Sorry.

Status & tagging log