From be43796499e706952e26a35f70ae7ab1f1950b13 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 13 Sep 2012 16:21:54 +0200 Subject: [PATCH] Comment cleanup Change-Id: Ie41f680782502f2b70c1bdbf18da3ee790d48fe7 --- includes/Article.php | 2 +- includes/Content.php | 19 ++++--------------- includes/ContentHandler.php | 8 +++----- includes/Title.php | 4 ++-- includes/WikiPage.php | 3 +-- includes/api/ApiEditPage.php | 6 ++---- includes/cache/MessageCache.php | 2 +- includes/search/SearchEngine.php | 3 ++- 8 files changed, 16 insertions(+), 31 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index a1d119f273..555849c228 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -424,7 +424,7 @@ class Article extends Page { # Pre-fill content with error message so that if something # fails we'll have something telling us what we intended. - // @todo: this isn't page content but a UI message. horrible. + //XXX: this isn't page content but a UI message. horrible. $this->mContentObject = new MessageContent( 'missing-revision', array( $oldid ), array() ) ; if ( $oldid ) { diff --git a/includes/Content.php b/includes/Content.php index 3bce48e710..da3b8ffc77 100644 --- a/includes/Content.php +++ b/includes/Content.php @@ -458,24 +458,13 @@ interface Content { */ public function matchMagicWord( MagicWord $word ); - # TODO: handle ImagePage and CategoryPage - # TODO: make sure we cover lucene search / wikisearch. - # TODO: make sure ReplaceTemplates still works - # FUTURE: nice&sane integration of GeSHi syntax highlighting + # TODO: ImagePage and CategoryPage interfere with per-content action handlers + # TODO: make sure WikiSearch extension still works + # TODO: make sure ReplaceTemplates extension still works + # TODO: nice&sane integration of GeSHi syntax highlighting # [11:59] Hooks are ugly; make CodeHighlighter interface and a # config to set the class which handles syntax highlighting # [12:00] And default it to a DummyHighlighter - - # TODO: make sure we cover the external editor interface (does anyone actually use that?!) - - # TODO: tie into API to provide contentModel for Revisions - # TODO: tie into API to provide serialized version and contentFormat for Revisions - # TODO: tie into API edit interface - # FUTURE: make EditForm plugin for EditPage - - # FUTURE: special type for redirects?! - # FUTURE: MultipartMultipart < WikipageContent (Main + Links + X) - # FUTURE: LinksContent < LanguageLinksContent, CategoriesContent } diff --git a/includes/ContentHandler.php b/includes/ContentHandler.php index 584a6adc08..bf1349adc8 100644 --- a/includes/ContentHandler.php +++ b/includes/ContentHandler.php @@ -551,9 +551,7 @@ abstract class ContentHandler { * * This default implementation just returns $wgContLang (except for pages in the MediaWiki namespace) * - * Note that a page's language must be permanent and cacheable, that is, it must not depend - * on user preferences, request parameters or session state. The only exception is pages in the - * MediaWiki namespace. + * Note that the pages language is not cacheable, since it may in some cases depend on user settings. * * Also note that the page language may or may not depend on the actual content of the page, * that is, this method may load the content in order to determine the language. @@ -563,7 +561,7 @@ abstract class ContentHandler { * @param Title $title the page to determine the language for. * @param Content|null $content the page's content, if you have it handy, to avoid reloading it. * - * @return Language the page's language code + * @return Language the page's language */ public function getPageLanguage( Title $title, Content $content = null ) { global $wgContLang; @@ -595,7 +593,7 @@ abstract class ContentHandler { * @param Title $title the page to determine the language for. * @param Content|null $content the page's content, if you have it handy, to avoid reloading it. * - * @return Language the page's language code for viewing + * @return Language the page's language for viewing */ public function getPageViewLanguage( Title $title, Content $content = null ) { $pageLang = $this->getPageLanguage( $title, $content ); diff --git a/includes/Title.php b/includes/Title.php index 8caa557be1..e6e45a8354 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4591,7 +4591,7 @@ class Title { return $wgLang; } - //TODO: use the LinkCache to cache this! + //TODO: use the LinkCache to cache this! Note that this may depend on user settings, so the cache should be only per-request. //NOTE: ContentHandler::getPageLanguage() may need to load the content to determine the page language! $contentHandler = ContentHandler::getForTitle( $this ); $pageLang = $contentHandler->getPageLanguage( $this ); @@ -4623,7 +4623,7 @@ class Title { return $wgLang; } - //NOTE: can't be cached, depends on user settings + //NOTE: can't be cached persistently, depends on user settings //NOTE: ContentHandler::getPageViewLanguage() may need to load the content to determine the page language! $contentHandler = ContentHandler::getForTitle( $this ); $pageLang = $contentHandler->getPageViewLanguage( $this ); diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 6c7b335106..38a1cbd961 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1548,7 +1548,6 @@ class WikiPage extends Page implements IDBAccessObject { * Compatibility note: this function previously returned a boolean value indicating success/failure * * @deprecated since 1.WD: use doEditContent() instead. - * @todo: use doEditContent() instead everywhere */ public function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) { wfDeprecated( __METHOD__, '1.WD' ); @@ -1937,7 +1936,7 @@ class WikiPage extends Page implements IDBAccessObject { public function prepareContentForEdit( Content $content, $revid = null, User $user = null, $serialization_format = null ) { global $wgParser, $wgContLang, $wgUser; $user = is_null( $user ) ? $wgUser : $user; - // @TODO fixme: check $user->getId() here??? + //XXX: check $user->getId() here??? if ( $this->mPreparedEdit && $this->mPreparedEdit->newContent diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index dbcf29c19a..506a546531 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -128,10 +128,9 @@ class ApiEditPage extends ApiBase { { $content = $pageObj->getContent(); + // @todo: Add support for appending/prepending to the Content interface + if ( !( $content instanceof TextContent ) ) { - // @todo: ContentHandler should have an isFlat() method or some such - // @todo: XXX: or perhaps there should be Content::append(), Content::prepend() - // @todo: ...and Content::supportsConcatenation() $mode = $contentHandler->getModelID(); $this->dieUsage( "Can't append to pages using content model $mode", 'appendnotsupported' ); } @@ -301,7 +300,6 @@ class ApiEditPage extends ApiBase { $ep = new EditPage( $articleObject ); // allow editing of non-textual content. - //@todo: let the ContentHandler decide whether direct editing is OK $ep->allowNonTextContent = true; $ep->setContextTitle( $titleObj ); diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 41058d3456..3ae26d0a1c 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -776,7 +776,7 @@ class MessageCache { wfDebugLog( 'MessageCache', __METHOD__ . ": failed to load message page text for {$title} ($code)" ); $message = null; // no negative caching } else { - #XXX: is this the reight way to turn a Content object into a mesage? + #XXX: Is this the right way to turn a Content object into a message? $message = $content->getWikitextForTransclusion(); if ( $message === false || $message === null ) { diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index c17f8c2c7a..acff026390 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -805,7 +805,8 @@ class SearchResult { protected function initText() { if ( !isset( $this->mText ) ) { if ( $this->mRevision != null ) { - //TODO: don't use the text, but the content object! + //TODO: if we could plug in some code that knows about special content models *and* about + // special features of the search engine, the search could benefit. $content = $this->mRevision->getContent(); $this->mText = $content->getTextForSearchIndex(); } else { // TODO: can we fetch raw wikitext for commons images? -- 2.20.1