r25415 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25414‎ | r25415 | r25416 >
Date:21:15, 2 September 2007
Author:david
Status:old
Tags:
Comment:
Merged revisions 25372-25414 via svnmerge from
svn+ssh://david@svn.wikimedia.org/svnroot/mediawiki/trunk/phase3

........
r25374 | aaron | 2007-08-31 12:44:36 -0700 (Fri, 31 Aug 2007) | 1 line

*Don't show the whole edit form if they are not allowed to create pages. Display permission error. (bug 11140)
........
r25375 | aaron | 2007-08-31 13:12:54 -0700 (Fri, 31 Aug 2007) | 1 line

*$groups are links if possible (strings otherwise), so why is this html escaped?
........
r25377 | aaron | 2007-08-31 13:34:41 -0700 (Fri, 31 Aug 2007) | 2 lines

*Use addHTML() on formatPermissionsErrorMessage() generated text, otherwise we get ugly escaped HTML links and such.
*Use wfMsgHtml after all, escapes before replacement ;)
........
r25378 | aaron | 2007-08-31 13:47:04 -0700 (Fri, 31 Aug 2007) | 1 line

*Remove debug line
........
r25379 | aaron | 2007-08-31 14:33:44 -0700 (Fri, 31 Aug 2007) | 2 lines

*Revert r25375, breaks other messages. I didn't realize how messed up this scheme is. Some messages need to be parsed others need not too. All should be parsed. Any that don't must be changed.
*Make getUserPermissionsErrorsInternal() insert wikitext link arguments (e.g. '[[x|y]]', rather than raw links), that way we won't have escaped HTML.
........
r25387 | werdna | 2007-09-01 05:38:54 -0700 (Sat, 01 Sep 2007) | 1 line

Allow an element name to be specified in Xml::namespaceSelector.
........
r25391 | rotem | 2007-09-01 10:35:58 -0700 (Sat, 01 Sep 2007) | 1 line

Don't show contributions link to user subpages in the watchlist editor.
........
r25392 | rotem | 2007-09-01 10:39:28 -0700 (Sat, 01 Sep 2007) | 1 line

Using the function Title::isSubpage instead.
........
r25393 | rotem | 2007-09-01 10:50:25 -0700 (Sat, 01 Sep 2007) | 1 line

Use standard URL for contributions page.
........
r25394 | robchurch | 2007-09-01 10:57:55 -0700 (Sat, 01 Sep 2007) | 1 line

Revert r25349 and offspring; the watchlist editor shows titles, not users - a contributions link is not appropriate here, nor is it useful
........
r25396 | tlaqua | 2007-09-01 17:36:06 -0700 (Sat, 01 Sep 2007) | 1 line

Fixed bug 9456 - added editsummaryheading system message to allow changing the heading level for newly added sections (i.e. section=new)
........
r25397 | rotem | 2007-09-01 18:05:32 -0700 (Sat, 01 Sep 2007) | 1 line

Update.
........
r25398 | tlaqua | 2007-09-01 18:41:56 -0700 (Sat, 01 Sep 2007) | 3 lines

Fixed bug 10836
When a new section is appended to an article, the comment is wrapped with /* ... */ tags to ensure that Recent Changes listings will have a link to the newly created heading.
Changed system message editsummaryheading to newsectionheaderdefaultlevel on rec. from DannyB
........
r25399 | rotem | 2007-09-01 18:47:28 -0700 (Sat, 01 Sep 2007) | 1 line

Another update.
........
r25400 | tlaqua | 2007-09-01 19:50:19 -0700 (Sat, 01 Sep 2007) | 1 line

Backing off fix for bug 10836 - previous attempt was incomplete. Will revisit later.
........
r25407 | tstarling | 2007-09-02 07:00:11 -0700 (Sun, 02 Sep 2007) | 1 line

Fixed typo, fld_len -> fld_size
........
r25408 | robchurch | 2007-09-02 09:40:24 -0700 (Sun, 02 Sep 2007) | 1 line

Bug number
........
r25409 | tstarling | 2007-09-02 10:13:03 -0700 (Sun, 02 Sep 2007) | 1 line

In the diff column headings, Use divs with id attributes instead of <br/>, for easier site/user javascript hacks. Patch by Carl Fürstenberg.
........
r25410 | greg | 2007-09-02 11:03:10 -0700 (Sun, 02 Sep 2007) | 4 lines

Add implicitOrderby() to make sure that SpecialAllpages uses an ORDER BY when needed.
Made this an option rather than forcing the ORDER BY as testing show MySQL is
faster without it for large tables.
........
r25411 | greg | 2007-09-02 11:23:43 -0700 (Sun, 02 Sep 2007) | 2 lines

Correct comments about frequency of pruning.
........
Modified paths:
  • /branches/liquidthreads (modified) (history)
  • /branches/liquidthreads/RELEASE-NOTES (modified) (history)
  • /branches/liquidthreads/includes/Article.php (modified) (history)
  • /branches/liquidthreads/includes/Database.php (modified) (history)
  • /branches/liquidthreads/includes/DatabaseOracle.php (modified) (history)
  • /branches/liquidthreads/includes/DatabasePostgres.php (modified) (history)
  • /branches/liquidthreads/includes/DifferenceEngine.php (modified) (history)
  • /branches/liquidthreads/includes/EditPage.php (modified) (history)
  • /branches/liquidthreads/includes/OutputPage.php (modified) (history)
  • /branches/liquidthreads/includes/SpecialAllpages.php (modified) (history)
  • /branches/liquidthreads/includes/Title.php (modified) (history)
  • /branches/liquidthreads/includes/WatchlistEditor.php (modified) (history)
  • /branches/liquidthreads/includes/Xml.php (modified) (history)
  • /branches/liquidthreads/includes/api/ApiQueryRevisions.php (modified) (history)
  • /branches/liquidthreads/languages/messages/MessagesEn.php (modified) (history)
  • /branches/liquidthreads/maintenance/language/messageTypes.inc (modified) (history)
  • /branches/liquidthreads/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: branches/liquidthreads/maintenance/language/messages.inc
@@ -266,6 +266,7 @@
267267 'feed-rss',
268268 'sitenotice',
269269 'anonnotice',
 270+ 'newsectionheaderdefaultlevel',
270271 ),
271272 'nstab' => array(
272273 'nstab-main',
Index: branches/liquidthreads/maintenance/language/messageTypes.inc
@@ -79,6 +79,7 @@
8080 'loginlanguagelinks',
8181 'markaspatrolledlink',
8282 'newarticletextanon',
 83+ 'newsectionheaderdefaultlevel',
8384 'newtalkseperator',
8485 'noarticletextanon',
8586 'number_of_watching_users_RCview',
Index: branches/liquidthreads/includes/SpecialAllpages.php
@@ -101,7 +101,11 @@
102102 $lines = $wgMemc->get( $key );
103103
104104 if( !is_array( $lines ) ) {
105 - $firstTitle = $dbr->selectField( 'page', 'page_title', $where, $fname, array( 'LIMIT' => 1 ) );
 105+ $options = array( 'LIMIT' => 1 );
 106+ if ( ! $dbr->implicitOrderby() ) {
 107+ $options['ORDER BY'] = 'page_title';
 108+ }
 109+ $firstTitle = $dbr->selectField( 'page', 'page_title', $where, $fname, $options );
106110 $lastTitle = $firstTitle;
107111
108112 # This array is going to hold the page_titles in order.
@@ -293,8 +297,11 @@
294298 } else {
295299 # The previous chunk is not complete, need to link to the very first title
296300 # available in the database
297 - $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title', array( 'page_namespace' => $namespace ), $fname, array( 'LIMIT' => 1) );
298 -
 301+ $options = array( 'LIMIT' => 1 );
 302+ if ( ! $dbr->implicitOrderby() ) {
 303+ $options['ORDER BY'] = 'page_title';
 304+ }
 305+ $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title', array( 'page_namespace' => $namespace ), $fname, $options );
299306 # Show the previous link if it s not the current requested chunk
300307 if( $from != $reallyFirstPage_title ) {
301308 $prevTitle = Title::makeTitle( $namespace, $reallyFirstPage_title );
Index: branches/liquidthreads/includes/DatabaseOracle.php
@@ -128,6 +128,9 @@
129129 function implicitGroupby() {
130130 return false;
131131 }
 132+ function implicitOrderby() {
 133+ return false;
 134+ }
132135 function searchableIPs() {
133136 return true;
134137 }
Index: branches/liquidthreads/includes/Xml.php
@@ -99,7 +99,7 @@
100100 * @param bool $hidden Include hidden namespaces? [WTF? --RC]
101101 * @return string
102102 */
103 - public static function namespaceSelector( $selected = '', $all = null, $hidden = false ) {
 103+ public static function namespaceSelector( $selected = '', $all = null, $hidden = false, $element_name = 'namespace' ) {
104104 global $wgContLang;
105105 $namespaces = $wgContLang->getFormattedNamespaces();
106106 $options = array();
@@ -114,7 +114,7 @@
115115 $options[] = self::option( $name, $index, $index === $selected );
116116 }
117117
118 - return Xml::openElement( 'select', array( 'id' => 'namespace', 'name' => 'namespace',
 118+ return Xml::openElement( 'select', array( 'id' => 'namespace', 'name' => $element_name,
119119 'class' => 'namespaceselector' ) )
120120 . "\n"
121121 . implode( "\n", $options )
Index: branches/liquidthreads/includes/Article.php
@@ -1181,7 +1181,7 @@
11821182
11831183 if( $section == 'new' ) {
11841184 # Inserting a new section
1185 - $subject = $summary ? "== {$summary} ==\n\n" : '';
 1185+ $subject = $summary ? wfMsgForContent('newsectionheaderdefaultlevel',$summary) . "\n\n" : '';
11861186 $text = strlen( trim( $oldtext ) ) > 0
11871187 ? "{$oldtext}\n\n{$subject}{$text}"
11881188 : "{$subject}{$text}";
@@ -1207,7 +1207,7 @@
12081208
12091209 # If this is a comment, add the summary as headline
12101210 if ( $comment && $summary != "" ) {
1211 - $text = "== {$summary} ==\n\n".$text;
 1211+ $text = wfMsgForContent('newsectionheaderdefaultlevel',$summary) . "\n\n".$text;
12121212 }
12131213
12141214 $this->doEdit( $text, $summary, $flags );
@@ -2375,7 +2375,7 @@
23762376 /**
23772377 * Do standard deferred updates after page edit.
23782378 * Update links tables, site stats, search index and message cache.
2379 - * Every 1000th edit, prune the recent changes table.
 2379+ * Every 100th edit, prune the recent changes table.
23802380 *
23812381 * @private
23822382 * @param $text New text of the article
Index: branches/liquidthreads/includes/WatchlistEditor.php
@@ -411,12 +411,8 @@
412412 if( $redirect )
413413 $link = '<span class="watchlistredir">' . $link . '</span>';
414414 $tools[] = $skin->makeLinkObj( $title->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) );
415 - if( $title->exists() ) {
 415+ if( $title->exists() )
416416 $tools[] = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'history_short' ), 'action=history' );
417 - }
418 - if( $title->getNamespace() == NS_USER ) {
419 - $tools[] = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions' ), wfMsgHtml( 'contributions' ), 'target=' . $title->getPartialUrl() );
420 - }
421417 return '<li>'
422418 . Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) )
423419 . $link . ' (' . implode( ' | ', $tools ) . ')' . '</li>';
Index: branches/liquidthreads/includes/EditPage.php
@@ -325,6 +325,8 @@
326326 }
327327
328328 $permErrors = $this->mArticle->getTitle()->getUserPermissionsErrors( 'edit', $wgUser);
 329+ if( !$this->mTitle->exists() )
 330+ $permErrors += $this->mTitle->getUserPermissionsErrors( 'create', $wgUser);
329331
330332 # Ignore some permissions errors.
331333 $remove = array();
@@ -349,7 +351,7 @@
350352 # array_diff returns elements in $permErrors that are not in $remove.
351353 $permErrors = array_diff( $permErrors, $remove );
352354
353 - if ($permErrors != array())
 355+ if ( !empty($permErrors) )
354356 {
355357 wfDebug( "$fname: User can't edit\n" );
356358 $wgOut->readOnlyPage( $this->getContent(), true, $permErrors );
Index: branches/liquidthreads/includes/OutputPage.php
@@ -850,7 +850,7 @@
851851 $this->enableClientCache( false );
852852 $this->mRedirect = '';
853853 $this->mBodytext = '';
854 - $this->addWikitext( $this->formatPermissionsErrorMessage( $errors ) );
 854+ $this->addWikiText( $this->formatPermissionsErrorMessage( $errors ) );
855855 }
856856
857857 /** @deprecated */
@@ -998,6 +998,8 @@
999999 * @todo document
10001000 * @param bool $protected Is the reason the page can't be reached because it's protected?
10011001 * @param mixed $source
 1002+ * @param bool $protected, page is protected?
 1003+ * @param array $reason, array of arrays( msg, args )
10021004 */
10031005 public function readOnlyPage( $source = null, $protected = false, $reasons = array() ) {
10041006 global $wgUser, $wgReadOnlyFile, $wgReadOnly, $wgTitle;
@@ -1005,8 +1007,8 @@
10061008
10071009 $this->setRobotpolicy( 'noindex,nofollow' );
10081010 $this->setArticleRelated( false );
1009 -
1010 - if ($reasons != array()) {
 1011+
 1012+ if ( !empty($reasons) ) {
10111013 $this->setPageTitle( wfMsg( 'viewsource' ) );
10121014 $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
10131015
Index: branches/liquidthreads/includes/api/ApiQueryRevisions.php
@@ -236,7 +236,7 @@
237237 $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->rev_timestamp);
238238 }
239239
240 - if ($this->fld_len && !is_null($row->rev_len)) {
 240+ if ($this->fld_size && !is_null($row->rev_len)) {
241241 $vals['size'] = intval($row->rev_len);
242242 }
243243
Index: branches/liquidthreads/includes/DifferenceEngine.php
@@ -215,14 +215,14 @@
216216 wfMsg( 'minoreditletter') ) . ' ';
217217 }
218218
219 - $oldHeader = "<strong>{$this->mOldtitle}</strong><br />" .
220 - $sk->revUserTools( $this->mOldRev ) . "<br />" .
221 - $oldminor . $sk->revComment( $this->mOldRev, !$diffOnly ) . "<br />" .
222 - $prevlink;
223 - $newHeader = "<strong>{$this->mNewtitle}</strong><br />" .
224 - $sk->revUserTools( $this->mNewRev ) . " $rollback<br />" .
225 - $newminor . $sk->revComment( $this->mNewRev, !$diffOnly ) . "<br />" .
226 - $nextlink . $patrol;
 219+ $oldHeader = '<div id="mw-diff-otitle1"><strong>' . $this->mOldtitle . '</strong></div>' .
 220+ '<div id="mw-diff-otitle2">' . $sk->revUserTools( $this->mOldRev ) . "</div>" .
 221+ '<div id="mw-diff-otitle3">' . $oldminor . $sk->revComment( $this->mOldRev, !$diffOnly ) . "</div>" .
 222+ '<div id="mw-diff-otitle4">' . $prevlink . '</div>';
 223+ $newHeader = '<div id="mw-diff-ntitle1"><strong>' .$this->mNewtitle . '</strong></div>' .
 224+ '<div id="mw-diff-ntitle2">' . $sk->revUserTools( $this->mNewRev ) . " $rollback</div>" .
 225+ '<div id="mw-diff-ntitle3">' . $newminor . $sk->revComment( $this->mNewRev, !$diffOnly ) . "</div>" .
 226+ '<div id="mw-diff-ntitle4">' . $nextlink . $patrol . '</div>';
227227
228228 $this->showDiff( $oldHeader, $newHeader );
229229
@@ -1869,3 +1869,4 @@
18701870 }
18711871
18721872
 1873+
Index: branches/liquidthreads/includes/Title.php
@@ -1178,12 +1178,11 @@
11791179 ( !$this->isTalkPage() && !$user->isAllowed( 'createpage' ) ) ) {
11801180 $errors[] = $user->isAnon() ? array ('nocreatetext') : array ('nocreate-loggedin');
11811181 }
1182 - } elseif( $action == 'move' &&
1183 - !( $this->isMovable() && $user->isAllowed( 'move' ) ) ) {
 1182+ } elseif( $action == 'move' && !( $this->isMovable() && $user->isAllowed( 'move' ) ) ) {
11841183 $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed');
1185 - } else if ( !$user->isAllowed( $action ) ) {
 1184+ } else if ( !$user->isAllowed( $action ) ) {
11861185 $return = null;
1187 - $groups = array();
 1186+ $groups = array();
11881187 global $wgGroupPermissions;
11891188 foreach( $wgGroupPermissions as $key => $value ) {
11901189 if( isset( $value[$action] ) && $value[$action] == true ) {
@@ -1191,7 +1190,7 @@
11921191 $groupPage = User::getGroupPage( $key );
11931192 if( $groupPage ) {
11941193 $skin = $user->getSkin();
1195 - $groups[] = $skin->makeLinkObj( $groupPage, $groupName );
 1194+ $groups[] = '[['.$groupPage->getPrefixedText().'|'.$groupName.']]';
11961195 } else {
11971196 $groups[] = $groupName;
11981197 }
Index: branches/liquidthreads/includes/DatabasePostgres.php
@@ -102,6 +102,9 @@
103103 function implicitGroupby() {
104104 return false;
105105 }
 106+ function implicitOrderby() {
 107+ return false;
 108+ }
106109 function searchableIPs() {
107110 return true;
108111 }
Index: branches/liquidthreads/includes/Database.php
@@ -441,6 +441,14 @@
442442 }
443443
444444 /**
 445+ * Returns true if this database does an implicit order by when the column has an index
 446+ * For example: SELECT page_title FROM page LIMIT 1
 447+ */
 448+ function implicitOrderby() {
 449+ return true;
 450+ }
 451+
 452+ /**
445453 * Returns true if this database can do a native search on IP columns
446454 * e.g. this works as expected: .. WHERE rc_ip = '127.42.12.102/32';
447455 */
Index: branches/liquidthreads/languages/messages/MessagesEn.php
@@ -713,6 +713,7 @@
714714 'feed-rss' => 'RSS', # only translate this message to other languages if you have to change it
715715 'sitenotice' => '-', # the equivalent to wgSiteNotice; don't translate or duplicate this message to other languages
716716 'anonnotice' => '-', # don't translate or duplicate this message to other languages
 717+'newsectionheaderdefaultlevel' => '== $1 ==', # don't translate or duplicate this message to other languages
717718
718719 # Short words for each namespace, by default used in the 'article' tab in monobook
719720 'nstab-main' => 'Article',
Index: branches/liquidthreads/RELEASE-NOTES
@@ -194,8 +194,9 @@
195195 text for a non-existent page
196196 * (bug 11022) Use a more accurate page title for Special:Whatlinkshere and
197197 Special:Recentchangeslinked
198 -* Add link to user contributions in normal watchlist edit mode
199 -
 198+* (bug 9426) Add 'newsectionheaderdefaultlevel' message to allow modification
 199+ of the heading formatting for new sections when section=new argument is supplied
 200+
200201 == Bugfixes since 1.10 ==
201202
202203 * (bug 9712) Use Arabic comma in date/time formats for Arabic and Farsi
@@ -428,8 +429,9 @@
429430 * (bug 8393) <sup> and <sub> need to be preserved (without attributes) for
430431 entries in the table of contents
431432 * (bug 11114) Fix regression in read-only mode error display during editing
 433+* Force non-MySQL databases to use an ORDER BY in SpecialAllpages to ensure
 434+ that the first page_title is truly the first page title.
432435
433 -
434436 == API changes since 1.10 ==
435437
436438 Full API documentation is available at http://www.mediawiki.org/wiki/API
Property changes on: branches/liquidthreads
___________________________________________________________________
Modified: svnmerge-integrated
437439 - /trunk/phase3:1-25371
438440 + /trunk/phase3:1-25414

Follow-up revisions

RevisionCommit summaryAuthorDate
r25445Fixed bug 10836...tlaqua17:46, 3 September 2007
r25454Merged revisions 25415-25453 via svnmerge from...david19:27, 3 September 2007
r25573Refining fix for bug 10836 - taking care of unintended behavior....tlaqua04:11, 6 September 2007
r25607Merged revisions 25530-25606 via svnmerge from...david06:11, 7 September 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r25349* Add link to user contributions in normal watchlist edit moderaymond11:10, 31 August 2007
r25374*Don't show the whole edit form if they are not allowed to create pages. Disp...aaron19:44, 31 August 2007
r25375*$groups are links if possible (strings otherwise), so why is this html escaped?aaron20:12, 31 August 2007
r25377*Use addHTML() on formatPermissionsErrorMessage() generated text, otherwise w...aaron20:34, 31 August 2007
r25378*Remove debug lineaaron20:47, 31 August 2007
r25379*Revert r25375, breaks other messages. I didn't realize how messed up this sc...aaron21:33, 31 August 2007
r25387Allow an element name to be specified in Xml::namespaceSelector.werdna12:38, 1 September 2007
r25391Don't show contributions link to user subpages in the watchlist editor.rotem17:35, 1 September 2007
r25392Using the function Title::isSubpage instead.rotem17:39, 1 September 2007
r25393Use standard URL for contributions page.rotem17:50, 1 September 2007
r25394Revert r25349 and offspring; the watchlist editor shows titles, not users - a...robchurch17:57, 1 September 2007
r25396Fixed bug 9456 - added editsummaryheading system message to allow changing th...tlaqua00:36, 2 September 2007
r25397Update.rotem01:05, 2 September 2007
r25398Fixed bug 10836...tlaqua01:41, 2 September 2007
r25399Another update.rotem01:47, 2 September 2007
r25400Backing off fix for bug 10836 - previous attempt was incomplete. Will revisi...tlaqua02:50, 2 September 2007
r25407Fixed typo, fld_len -> fld_sizetstarling14:00, 2 September 2007
r25408Bug numberrobchurch16:40, 2 September 2007
r25409In the diff column headings, Use divs with id attributes instead of <br/>, fo...tstarling17:13, 2 September 2007
r25410Add implicitOrderby() to make sure that SpecialAllpages uses an ORDER BY when...greg18:03, 2 September 2007
r25411Correct comments about frequency of pruning.greg18:23, 2 September 2007

Status & tagging log