r79720 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79719‎ | r79720 | r79721 >
Date:14:48, 6 January 2011
Author:catrope
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/REL1_17/extensions/Farmer/MediaWikiFarmer_Wiki.php (modified) (history)
  • /branches/REL1_17/extensions/LabeledSectionTransclusion/lst.php (modified) (history)
  • /branches/REL1_17/extensions/Wikidata/Database+scripts/Convenience/Create+wikidata.php (modified) (history)
  • /branches/REL1_17/extensions/Wikidata/Database+scripts/Incremental/ReadPatch.php (modified) (history)
  • /branches/REL1_17/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_17/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/REL1_17/phase3/includes/LinksUpdate.php (modified) (history)
  • /branches/REL1_17/phase3/includes/Skin.php (modified) (history)
  • /branches/REL1_17/phase3/includes/Title.php (modified) (history)
  • /branches/REL1_17/phase3/includes/api/ApiOpenSearch.php (modified) (history)
  • /branches/REL1_17/phase3/includes/extauth/MediaWiki.php (modified) (history)
  • /branches/REL1_17/phase3/includes/filerepo/ForeignDBRepo.php (modified) (history)
  • /branches/REL1_17/phase3/includes/specials/SpecialVersion.php (modified) (history)
  • /branches/REL1_17/phase3/includes/upload/UploadBase.php (modified) (history)
  • /branches/REL1_17/phase3/languages/LanguageConverter.php (modified) (history)
  • /branches/REL1_17/phase3/maintenance/archives/patch-categorylinks-better-collation.sql (modified) (history)
  • /branches/REL1_17/phase3/resources/jquery.tipsy/jquery.tipsy.css (modified) (history)
  • /branches/REL1_17/phase3/skins/common/config.css (modified) (history)
  • /branches/REL1_17/phase3/skins/common/shared.css (modified) (history)

Diff [purge]

Index: branches/REL1_17/extensions/Farmer/MediaWikiFarmer_Wiki.php
@@ -412,7 +412,7 @@
413413 $user = $farmer->dbAdminUser;
414414 $password = $farmer->dbAdminPassword;
415415 $class = 'Database' . ucfirst( $wgDBtype );
416 - $object = new $class( $wgDBserver, $user, $password, $db, false, 0, $prefix );
 416+ $object = new $class( $wgDBserver, $user, $password, $db, 0, $prefix );
417417 if ( $selectDB )
418418 $this->_db = $object;
419419 return $object;
Index: branches/REL1_17/extensions/LabeledSectionTransclusion/lst.php
@@ -21,7 +21,7 @@
2222 # Standard initialisation code
2323 ##
2424
25 -$wgExtensionFunctions[] = array( 'LabeledSectionTransclusion', "setup" );
 25+$wgHooks['ParserFirstCallInit'][] = 'LabeledSectionTransclusion::setup';
2626 $wgHooks['LanguageGetMagic'][] = 'LabeledSectionTransclusion::setupMagic';
2727
2828 $wgExtensionCredits['parserhook'][] = array(
@@ -40,17 +40,15 @@
4141
4242 class LabeledSectionTransclusion {
4343
44 - static function setup()
 44+ static function setup( $parser )
4545 {
46 - global $wgParser;
47 -
48 - $wgParser->setHook( 'section', array( __CLASS__, 'noop' ) );
49 - if ( defined( get_class( $wgParser ) . '::SFH_OBJECT_ARGS' ) ) {
50 - $wgParser->setFunctionHook( 'lst', array( __CLASS__, 'pfuncIncludeObj' ), SFH_OBJECT_ARGS );
51 - $wgParser->setFunctionHook( 'lstx', array( __CLASS__, 'pfuncExcludeObj' ), SFH_OBJECT_ARGS );
 46+ $parser->setHook( 'section', array( __CLASS__, 'noop' ) );
 47+ if ( defined( get_class( $parser ) . '::SFH_OBJECT_ARGS' ) ) {
 48+ $parser->setFunctionHook( 'lst', array( __CLASS__, 'pfuncIncludeObj' ), SFH_OBJECT_ARGS );
 49+ $parser->setFunctionHook( 'lstx', array( __CLASS__, 'pfuncExcludeObj' ), SFH_OBJECT_ARGS );
5250 } else {
53 - $wgParser->setFunctionHook( 'lst', array( __CLASS__, 'pfuncInclude' ) );
54 - $wgParser->setFunctionHook( 'lstx', array( __CLASS__, 'pfuncExclude' ) );
 51+ $parser->setFunctionHook( 'lst', array( __CLASS__, 'pfuncInclude' ) );
 52+ $parser->setFunctionHook( 'lstx', array( __CLASS__, 'pfuncExclude' ) );
5553 }
5654 }
5755
Index: branches/REL1_17/extensions/Wikidata/Database scripts/Incremental/ReadPatch.php
@@ -158,7 +158,7 @@
159159 }
160160 # Attempt to connect to the database as a privileged user
161161 # This will vomit up an error if there are permissions problems
162 -$wdDatabase = new $dbclass( $server, $user, $password, $database, 1 );
 162+$wdDatabase = new $dbclass( $server, $user, $password, $database );
163163
164164 if ( !$wdDatabase->isOpen() ) {
165165 # Appears to have failed
Index: branches/REL1_17/extensions/Wikidata/Database scripts/Convenience/Create wikidata.php
@@ -220,7 +220,7 @@
221221 }
222222 # Attempt to connect to the database as a privileged user
223223 # This will vomit up an error if there are permissions problems
224 -$wdDatabase = new $dbclass( $server, $user, $password, $database, 1 );
 224+$wdDatabase = new $dbclass( $server, $user, $password, $database );
225225
226226 if ( !$wdDatabase->isOpen() ) {
227227 # Appears to have failed
Index: branches/REL1_17/phase3/maintenance/archives/patch-categorylinks-better-collation.sql
@@ -4,6 +4,10 @@
55 -- Bugs 164, 1211, 23682. This is the second version of this patch; the
66 -- changes are also incorporated into patch-categorylinks-better-collation2.sql,
77 -- for the benefit of trunk users who applied the original.
 8+--
 9+-- Due to bug 25254, the length limit of 255 bytes for cl_sortkey_prefix
 10+-- is also enforced in php. If you change the length of that field, make
 11+-- sure to also change the check in LinksUpdate.php.
812 ALTER TABLE /*$wgDBprefix*/categorylinks
913 CHANGE COLUMN cl_sortkey cl_sortkey varbinary(230) NOT NULL default '',
1014 ADD COLUMN cl_sortkey_prefix varchar(255) binary NOT NULL default '',
Index: branches/REL1_17/phase3/skins/common/config.css
@@ -95,6 +95,7 @@
9696 .config-message {
9797 display: list-item;
9898 line-height: 1.5em;
 99+ /* @embed */
99100 list-style-image: url(images/bullet.gif);
100101 list-style-type: square;
101102 }
Index: branches/REL1_17/phase3/skins/common/shared.css
@@ -577,6 +577,7 @@
578578
579579 /* feed links */
580580 a.feedlink {
 581+ /* @embed */
581582 background: url("images/feed-icon.png") center left no-repeat;
582583 padding-left: 16px;
583584 }
@@ -850,6 +851,7 @@
851852
852853 .mw-remove-category {
853854 padding: 8px;
 855+ /* @embed */
854856 background-image: url(images/remove.png);
855857 background-position: center center;
856858 background-repeat: no-repeat;
@@ -857,12 +859,14 @@
858860
859861 .mw-ajax-addcategory {
860862 padding-left: 20px;
 863+ /* @embed */
861864 background-image: url(images/add.png);
862865 background-position: left center;
863866 background-repeat: no-repeat;
864867 }
865868
866869 .mw-ajax-loader {
 870+ /* @embed */
867871 background-image: url(images/ajax-loader.gif);
868872 background-position: center center;
869873 background-repeat: no-repeat;
@@ -874,6 +878,7 @@
875879 .mw-small-spinner {
876880 padding: 10px !important;
877881 margin-right: 0.6em;
 882+ /* @embed */
878883 background-image: url(images/spinner.gif);
879884 background-position: center center;
880885 background-repeat: no-repeat;
@@ -912,6 +917,7 @@
913918 padding-left: 15px;
914919 margin-left: 2px;
915920 margin-bottom: -8px;
 921+ /* @embed */
916922 background-image: url('images/help-question.gif');
917923 background-position: left center;
918924 background-repeat: no-repeat;
@@ -921,6 +927,7 @@
922928 font-size: .8em;
923929 }
924930 .mw-help-field-hint:hover {
 931+ /* @embed */
925932 background-image: url('images/help-question-hover.gif');
926933 }
927934 .mw-help-field-data {
@@ -932,7 +939,7 @@
933940 }
934941 .tipsy { padding: 5px 5px 10px; font-size: 12px; position: absolute; z-index: 100000; overflow: visible; }
935942 .tipsy-inner { padding: 5px 8px 4px 8px; background-color: #d6f3ff; color: black; border: 1px solid #5dc9f4; max-width: 300px; text-align: left; }
936 -.tipsy-arrow { position: absolute; background: url( 'images/tipsy-arrow.gif' ) no-repeat top left; width: 13px; height: 13px; }
 943+.tipsy-arrow { position: absolute; /* @embed */ background: url( 'images/tipsy-arrow.gif' ) no-repeat top left; width: 13px; height: 13px; }
937944 .tipsy-se .tipsy-arrow { bottom: -2px; right: 10px; background-position: 0% 100%; }
938945
939946
Index: branches/REL1_17/phase3/includes/upload/UploadBase.php
@@ -78,20 +78,12 @@
7979 }
8080
8181 /**
82 - * Returns an array of permissions that is required to upload a file
83 - *
84 - * @return array
85 - */
86 - public static function getRequiredPermissions() {
87 - return array( 'upload', 'edit' );
88 - }
89 - /**
9082 * Returns true if the user can use this upload module or else a string
9183 * identifying the missing permission.
9284 * Can be overriden by subclasses.
9385 */
9486 public static function isAllowed( $user ) {
95 - foreach ( self::getRequiredPermissions() as $permission ) {
 87+ foreach ( array( 'upload', 'edit' ) as $permission ) {
9688 if ( !$user->isAllowed( $permission ) ) {
9789 return $permission;
9890 }
Property changes on: branches/REL1_17/phase3/includes/upload/UploadBase.php
___________________________________________________________________
Modified: svn:mergeinfo
9991 Merged /trunk/phase3/includes/upload/UploadBase.php:r79655,79706,79710
Index: branches/REL1_17/phase3/includes/filerepo/ForeignDBRepo.php
@@ -37,7 +37,7 @@
3838 if ( !isset( $this->dbConn ) ) {
3939 $class = 'Database' . ucfirst( $this->dbType );
4040 $this->dbConn = new $class( $this->dbServer, $this->dbUser,
41 - $this->dbPassword, $this->dbName, false, $this->dbFlags,
 41+ $this->dbPassword, $this->dbName, $this->dbFlags,
4242 $this->tablePrefix );
4343 }
4444 return $this->dbConn;
Property changes on: branches/REL1_17/phase3/includes/filerepo/ForeignDBRepo.php
___________________________________________________________________
Added: svn:mergeinfo
4545 Merged /branches/new-installer/phase3/includes/filerepo/ForeignDBRepo.php:r43664-66004
4646 Merged /branches/wmf-deployment/includes/filerepo/ForeignDBRepo.php:r53381
4747 Merged /branches/REL1_15/phase3/includes/filerepo/ForeignDBRepo.php:r51646
4848 Merged /branches/sqlite/includes/filerepo/ForeignDBRepo.php:r58211-58321
4949 Merged /trunk/phase3/includes/filerepo/ForeignDBRepo.php:r79591,79655,79706
Index: branches/REL1_17/phase3/includes/api/ApiOpenSearch.php
@@ -52,20 +52,39 @@
5353
5454 // MWSuggest or similar hit
5555 if ( $suggest && !$wgEnableOpenSearchSuggest ) {
56 - $srchres = array();
 56+ $searches = array();
5757 } else {
58 - // Open search results may be stored for a very long
59 - // time
 58+ // Open search results may be stored for a very long time
6059 $this->getMain()->setCacheMaxAge( $wgSearchSuggestCacheExpiry );
6160 $this->getMain()->setCacheMode( 'public' );
6261
63 - $srchres = PrefixSearch::titleSearch( $search, $limit,
 62+ $searches = PrefixSearch::titleSearch( $search, $limit,
6463 $namespaces );
 64+
 65+ // if the content language has variants, try to retrieve fallback results
 66+ $fallbackLimit = $limit - count( $searches );
 67+ if ( $fallbackLimit > 0 ) {
 68+ global $wgContLang;
 69+
 70+ $fallbackSearches = $wgContLang->autoConvertToAllVariants( $search );
 71+ $fallbackSearches = array_diff( array_unique( $fallbackSearches ), array( $search ) );
 72+
 73+ foreach ( $fallbackSearches as $fbs ) {
 74+ $fallbackSearchResult = PrefixSearch::titleSearch( $fbs, $fallbackLimit,
 75+ $namespaces );
 76+ $searches = array_merge( $searches, $fallbackSearchResult );
 77+ $fallbackLimit -= count( $fallbackSearchResult );
 78+
 79+ if ( $fallbackLimit == 0 ) {
 80+ break;
 81+ }
 82+ }
 83+ }
6584 }
6685 // Set top level elements
6786 $result = $this->getResult();
6887 $result->addValue( null, 0, $search );
69 - $result->addValue( null, 1, $srchres );
 88+ $result->addValue( null, 1, $searches );
7089 }
7190
7291 public function getAllowedParams() {
Property changes on: branches/REL1_17/phase3/includes/api/ApiOpenSearch.php
___________________________________________________________________
Added: svn:mergeinfo
7392 Merged /branches/wmf-deployment/includes/api/ApiOpenSearch.php:r53381,59952
7493 Merged /branches/REL1_15/phase3/includes/api/ApiOpenSearch.php:r51646
7594 Merged /branches/REL1_16/phase3/includes/api/ApiOpenSearch.php:r63621-63636,69357
7695 Merged /branches/wmf/1.16wmf4/includes/api/ApiOpenSearch.php:r69521
7796 Merged /branches/sqlite/includes/api/ApiOpenSearch.php:r58211-58321
7897 Merged /trunk/phase3/includes/api/ApiOpenSearch.php:r79649-79651,79655,79694,79706
Index: branches/REL1_17/phase3/includes/LinksUpdate.php
@@ -67,6 +67,14 @@
6868 $this->mInterlangs[$key] = $title;
6969 }
7070
 71+ foreach ( $this->mCategories as $cat => &$sortkey ) {
 72+ # If the sortkey is longer then 255 bytes,
 73+ # it truncated by DB, and then doesn't get
 74+ # matched when comparing existing vs current
 75+ # categories, causing bug 25254.
 76+ $sortkey = substr( $sortkey, 0, 255 );
 77+ }
 78+
7179 $this->mRecursive = $recursive;
7280
7381 wfRunHooks( 'LinksUpdateConstructed', array( &$this ) );
@@ -687,11 +695,15 @@
688696 * @private
689697 */
690698 function getExistingCategories() {
691 - $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey' ),
 699+ $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ),
692700 array( 'cl_from' => $this->mId ), __METHOD__, $this->mOptions );
693701 $arr = array();
694702 foreach ( $res as $row ) {
695 - $arr[$row->cl_to] = $row->cl_sortkey;
 703+ if ( $row->cl_sortkey_prefix !== '' ) {
 704+ $arr[$row->cl_to] = $row->cl_sortkey_prefix;
 705+ } else {
 706+ $arr[$row->cl_to] = $this->mTitle->getCategorySortkey();
 707+ }
696708 }
697709 return $arr;
698710 }
Index: branches/REL1_17/phase3/includes/Title.php
@@ -4191,14 +4191,15 @@
41924192 */
41934193 public function getRestrictionTypes() {
41944194 global $wgRestrictionTypes;
 4195+
41954196 $types = $this->exists() ? $wgRestrictionTypes : array( 'create' );
41964197
4197 - if ( $this->getNamespace() == NS_FILE ) {
4198 - $types[] = 'upload';
 4198+ if ( $this->getNamespace() != NS_FILE ) {
 4199+ $types = array_diff( $types, array( 'upload' ) );
41994200 }
4200 -
 4201+
42014202 wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) );
4202 -
 4203+
42034204 return $types;
42044205 }
42054206
Property changes on: branches/REL1_17/phase3/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
42064207 Merged /trunk/phase3/includes/Title.php:r79655,79660,79706
Index: branches/REL1_17/phase3/includes/DefaultSettings.php
@@ -3315,8 +3315,10 @@
33163316 * Set of available actions that can be restricted via action=protect
33173317 * You probably shouldn't change this.
33183318 * Translated through restriction-* messages.
 3319+ * Title::getRestrictionTypes() will remove restrictions that are not
 3320+ * applicable to a specific title (upload currently)
33193321 */
3320 -$wgRestrictionTypes = array( 'edit', 'move' );
 3322+$wgRestrictionTypes = array( 'edit', 'move', 'upload' );
33213323
33223324 /**
33233325 * Rights which can be required for each protection level (via action=protect)
Index: branches/REL1_17/phase3/includes/specials/SpecialVersion.php
@@ -242,7 +242,7 @@
243243 */
244244 public static function getExtensionTypeName( $type ) {
245245 $types = self::getExtensionTypes();
246 - return $types[$type];
 246+ return isset( $types[$type] ) ? $types[$type] : $types['other'];
247247 }
248248
249249 /**
Property changes on: branches/REL1_17/phase3/includes/specials/SpecialVersion.php
___________________________________________________________________
Added: svn:mergeinfo
250250 Merged /branches/wmf-deployment/includes/specials/SpecialVersion.php:r53381,56967
251251 Merged /branches/REL1_15/phase3/includes/specials/SpecialVersion.php:r51646
252252 Merged /branches/sqlite/includes/specials/SpecialVersion.php:r58211-58321
253253 Merged /trunk/phase3/includes/specials/SpecialVersion.php:r79655,79704,79706
Index: branches/REL1_17/phase3/includes/Skin.php
@@ -441,7 +441,7 @@
442442 'wgCurRevisionId' => isset( $wgArticle ) ? $wgArticle->getLatest() : 0,
443443 'wgCategories' => $wgOut->getCategories(),
444444 );
445 - foreach ( $wgRestrictionTypes as $type ) {
 445+ foreach ( $wgTitle->getRestrictionTypes() as $type ) {
446446 $vars['wgRestriction' . ucfirst( $type )] = $wgTitle->getRestrictions( $type );
447447 }
448448 if ( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ) {
Index: branches/REL1_17/phase3/includes/extauth/MediaWiki.php
@@ -78,7 +78,6 @@
7979 $wgExternalAuthConf['DBuser'],
8080 $wgExternalAuthConf['DBpassword'],
8181 $wgExternalAuthConf['DBname'],
82 - false,
8382 0,
8483 $wgExternalAuthConf['DBprefix']
8584 );
Property changes on: branches/REL1_17/phase3/includes/extauth/MediaWiki.php
___________________________________________________________________
Added: svn:mergeinfo
8685 Merged /branches/REL1_15/phase3/includes/extauth/MediaWiki.php:r51646
8786 Merged /branches/sqlite/includes/extauth/MediaWiki.php:r58211-58321
8887 Merged /trunk/phase3/includes/extauth/MediaWiki.php:r79593,79655,79706
8988 Merged /branches/new-installer/phase3/includes/extauth/MediaWiki.php:r43664-66004
9089 Merged /branches/wmf-deployment/includes/extauth/MediaWiki.php:r53381
Index: branches/REL1_17/phase3/languages/LanguageConverter.php
@@ -980,7 +980,7 @@
981981
982982 /**
983983 * Armour rendered math against conversion.
984 - * Wrap math into rawoutput -{R| math }- syntax.
 984+ * Escape special chars in parsed math text.(in most cases are img elements)
985985 */
986986 public function armourMath( $text ) {
987987 // convert '-{' and '}-' to '-{' and '}-' to prevent
Property changes on: branches/REL1_17/phase3/languages/LanguageConverter.php
___________________________________________________________________
Added: svn:mergeinfo
988988 Merged /branches/new-installer/phase3/languages/LanguageConverter.php:r43664-66004
989989 Merged /branches/REL1_15/phase3/languages/LanguageConverter.php:r51646
990990 Merged /branches/sqlite/languages/LanguageConverter.php:r58211-58321
991991 Merged /trunk/phase3/languages/LanguageConverter.php:r79653,79655,79706
Index: branches/REL1_17/phase3/RELEASE-NOTES
@@ -236,6 +236,9 @@
237237 * (bug 16019) $wgArticlePath = "/$1" no longer breaks API edit/watch actions
238238 * (bug 18372) File types blacklisted by $wgFileBlacklist will no longer be shown as "Permitted file types" on the upload form
239239 * (bug 26540) Fixed wrong call to applyPatch in MysqlUpdater
 240+* (bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected
 241+ pages to be queried via the API and Special:ProtectedPages, and allowing
 242+ disabling upload protection by removing it from $wgRestrictionTypes.
240243
241244 === Bug fixes in 1.17 ===
242245 * (bug 17560) Half-broken deletion moved image files to deletion archive
Index: branches/REL1_17/phase3/resources/jquery.tipsy/jquery.tipsy.css
@@ -21,6 +21,7 @@
2222 }
2323 .tipsy-arrow {
2424 position: absolute;
 25+ /* @embed */
2526 background: url('images/tipsy.png') no-repeat top left;
2627 width: 9px;
2728 height: 5px;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79578LabeledSectionTransclusion: Use ParserFirstCallInit instead of $wgParsercatrope13:52, 4 January 2011
r79591Simplest possible fix for *(bug 26552) ForeignDBRepo broken?...reedy19:33, 4 January 2011
r79593Remove another setting of failFunction in phase3 in a database constructorreedy19:54, 4 January 2011
r79595Kill some FailFunction remenantsreedy20:04, 4 January 2011
r79649Add fallback languages support for ApiOpenSearch.philip16:21, 5 January 2011
r79650follow r79649, move the in-block assignment outside.philip16:30, 5 January 2011
r79651Follow r79649 and r79650. Errrr, remove the redundant minusphilip16:37, 5 January 2011
r79653follow r78679, correct the comment linephilip16:44, 5 January 2011
r79655(bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected ...btongminh19:17, 5 January 2011
r79660Follow-up r79655: array_diff makes in_array unnecessarybtongminh19:58, 5 January 2011
r79694Minor followup to r79649. Rename variablesreedy00:31, 6 January 2011
r79704Fix fixme on r71071, if passed type is not in the array returned by getExtens...reedy02:30, 6 January 2011
r79706(Bug 25254) cl_timestamp gets updated on null edit where it shouldn't....bawolff02:42, 6 January 2011
r79710Fixup FIXME on r65818reedy03:27, 6 January 2011

Status & tagging log