Index: trunk/phase3/maintenance/cleanupImages.php |
— | — | @@ -89,6 +89,9 @@ |
90 | 90 | $this->progress( 0 ); |
91 | 91 | } |
92 | 92 | |
| 93 | + /** |
| 94 | + * @param $name string |
| 95 | + */ |
93 | 96 | private function killRow( $name ) { |
94 | 97 | if ( $this->dryrun ) { |
95 | 98 | $this->output( "DRY RUN: would delete bogus row '$name'\n" ); |
Index: trunk/phase3/maintenance/reassignEdits.php |
— | — | @@ -139,8 +139,8 @@ |
140 | 140 | * i.e. user => id, user_text => text |
141 | 141 | * |
142 | 142 | * @param $user User for the spec |
143 | | - * @param $idfield Field name containing the identifier |
144 | | - * @param $utfield Field name containing the user text |
| 143 | + * @param $idfield string Field name containing the identifier |
| 144 | + * @param $utfield string Field name containing the user text |
145 | 145 | * @return array |
146 | 146 | */ |
147 | 147 | private function userSpecification( &$user, $idfield, $utfield ) { |
Index: trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php |
— | — | @@ -5,13 +5,17 @@ |
6 | 6 | */ |
7 | 7 | class TitlePermissionTest extends MediaWikiLangTestCase { |
8 | 8 | protected $title; |
9 | | - protected $user; |
10 | | - protected $anonUser; |
11 | | - protected $userUser; |
12 | | - protected $altUser; |
13 | | - protected $userName; |
14 | | - protected $altUserName; |
15 | 9 | |
| 10 | + /** |
| 11 | + * @var User |
| 12 | + */ |
| 13 | + protected $user, $anonUser, $userUser, $altUser; |
| 14 | + |
| 15 | + /** |
| 16 | + * @var string |
| 17 | + */ |
| 18 | + protected $userName, $altUserName; |
| 19 | + |
16 | 20 | function setUp() { |
17 | 21 | global $wgLocaltimezone, $wgLocalTZoffset, $wgMemc, $wgContLang, $wgLang; |
18 | 22 | parent::setUp(); |
— | — | @@ -64,7 +68,7 @@ |
65 | 69 | for ($i = 0; $i < 100; $i++) { |
66 | 70 | $this->user->mRights[$i] = $perm; |
67 | 71 | } |
68 | | - |
| 72 | + |
69 | 73 | // Hack, hack hack ... |
70 | 74 | $this->user->mRights['*'] = $perm; |
71 | 75 | } |
— | — | @@ -543,7 +547,7 @@ |
544 | 548 | $this->setTitle( NS_MAIN, "test page" ); |
545 | 549 | $this->title->mTitleProtection['pt_create_perm'] = ''; |
546 | 550 | $this->title->mTitleProtection['pt_user'] = $this->user->getID(); |
547 | | - $this->title->mTitleProtection['pt_expiry'] = Block::infinity(); |
| 551 | + $this->title->mTitleProtection['pt_expiry'] = wfGetDB( DB_SLAVE )->getInfinity(); |
548 | 552 | $this->title->mTitleProtection['pt_reason'] = 'test'; |
549 | 553 | $this->title->mCascadeRestriction = false; |
550 | 554 | |
Index: trunk/phase3/includes/upload/UploadFromStash.php |
— | — | @@ -9,13 +9,18 @@ |
10 | 10 | |
11 | 11 | class UploadFromStash extends UploadBase { |
12 | 12 | protected $mFileKey, $mVirtualTempPath, $mFileProps, $mSourceType; |
13 | | - |
| 13 | + |
14 | 14 | // an instance of UploadStash |
15 | 15 | private $stash; |
16 | | - |
| 16 | + |
17 | 17 | //LocalFile repo |
18 | 18 | private $repo; |
19 | | - |
| 19 | + |
| 20 | + /** |
| 21 | + * @param $user User |
| 22 | + * @param $stash UploadStash |
| 23 | + * @param $repo FileRepo |
| 24 | + */ |
20 | 25 | public function __construct( $user = false, $stash = false, $repo = false ) { |
21 | 26 | // user object. sometimes this won't exist, as when running from cron. |
22 | 27 | $this->user = $user; |
— | — | @@ -40,7 +45,11 @@ |
41 | 46 | |
42 | 47 | return true; |
43 | 48 | } |
44 | | - |
| 49 | + |
| 50 | + /** |
| 51 | + * @param $key string |
| 52 | + * @return bool |
| 53 | + */ |
45 | 54 | public static function isValidKey( $key ) { |
46 | 55 | // this is checked in more detail in UploadStash |
47 | 56 | return (bool)preg_match( UploadStash::KEY_FORMAT_REGEX, $key ); |
— | — | @@ -58,13 +67,17 @@ |
59 | 68 | return self::isValidKey( $request->getText( 'wpFileKey', $request->getText( 'wpSessionKey' ) ) ); |
60 | 69 | } |
61 | 70 | |
| 71 | + /** |
| 72 | + * @param $key string |
| 73 | + * @param $name string |
| 74 | + */ |
62 | 75 | public function initialize( $key, $name = 'upload_file' ) { |
63 | 76 | /** |
64 | 77 | * Confirming a temporarily stashed upload. |
65 | 78 | * We don't want path names to be forged, so we keep |
66 | 79 | * them in the session on the server and just give |
67 | 80 | * an opaque key to the user agent. |
68 | | - */ |
| 81 | + */ |
69 | 82 | $metadata = $this->stash->getMetadata( $key ); |
70 | 83 | $this->initializePathInfo( $name, |
71 | 84 | $this->getRealPath ( $metadata['us_path'] ), |
— | — | @@ -91,8 +104,11 @@ |
92 | 105 | return $this->initialize( $fileKey, $desiredDestName ); |
93 | 106 | } |
94 | 107 | |
95 | | - public function getSourceType() { |
96 | | - return $this->mSourceType; |
| 108 | + /** |
| 109 | + * @return string |
| 110 | + */ |
| 111 | + public function getSourceType() { |
| 112 | + return $this->mSourceType; |
97 | 113 | } |
98 | 114 | |
99 | 115 | /** |
— | — | @@ -106,6 +122,8 @@ |
107 | 123 | |
108 | 124 | /** |
109 | 125 | * Stash the file. |
| 126 | + * |
| 127 | + * @return UploadStashFile |
110 | 128 | */ |
111 | 129 | public function stashFile() { |
112 | 130 | // replace mLocalFile with an instance of UploadStashFile, which adds some methods |
— | — | @@ -131,6 +149,11 @@ |
132 | 150 | |
133 | 151 | /** |
134 | 152 | * Perform the upload, then remove the database record afterward. |
| 153 | + * @param $comment string |
| 154 | + * @param $pageText string |
| 155 | + * @param $watch bool |
| 156 | + * @param $user User |
| 157 | + * @return Status |
135 | 158 | */ |
136 | 159 | public function performUpload( $comment, $pageText, $watch, $user ) { |
137 | 160 | $rv = parent::performUpload( $comment, $pageText, $watch, $user ); |
— | — | @@ -141,7 +164,7 @@ |
142 | 165 | /** |
143 | 166 | * Append a chunk to the temporary file. |
144 | 167 | * |
145 | | - * @return void |
| 168 | + * @return Status |
146 | 169 | */ |
147 | 170 | public function appendChunk($chunk, $chunkSize, $offset) { |
148 | 171 | //to use $this->getFileSize() here, db needs to be updated |
— | — | @@ -153,7 +176,7 @@ |
154 | 177 | //append chunk |
155 | 178 | if ( $fileSize == $offset ) { |
156 | 179 | $status = $this->appendToUploadFile( $chunk, |
157 | | - $this->mVirtualTempPath ); |
| 180 | + $this->mVirtualTempPath ); |
158 | 181 | } else { |
159 | 182 | $status = Status::newFatal( 'invalid-chunk-offset' ); |
160 | 183 | } |
Index: trunk/phase3/includes/CategoryPage.php |
— | — | @@ -17,6 +17,15 @@ |
18 | 18 | # Subclasses can change this to override the viewer class. |
19 | 19 | protected $mCategoryViewerClass = 'CategoryViewer'; |
20 | 20 | |
| 21 | + /** |
| 22 | + * @var Title |
| 23 | + */ |
| 24 | + protected $mTitle; |
| 25 | + |
| 26 | + /** |
| 27 | + * @param $title Title |
| 28 | + * @return WikiCategoryPage |
| 29 | + */ |
21 | 30 | protected function newPage( Title $title ) { |
22 | 31 | // Overload mPage with a category-specific page |
23 | 32 | return new WikiCategoryPage( $title ); |
— | — | @@ -69,7 +78,7 @@ |
70 | 79 | $oldUntil = $request->getVal( 'until' ); |
71 | 80 | |
72 | 81 | $reqArray = $request->getValues(); |
73 | | - |
| 82 | + |
74 | 83 | $from = $until = array(); |
75 | 84 | foreach ( array( 'page', 'subcat', 'file' ) as $type ) { |
76 | 85 | $from[$type] = $request->getVal( "{$type}from", $oldFrom ); |
— | — | @@ -101,7 +110,7 @@ |
102 | 111 | $imgsNoGallery; |
103 | 112 | |
104 | 113 | /** |
105 | | - * @var |
| 114 | + * @var |
106 | 115 | */ |
107 | 116 | var $nextPage; |
108 | 117 | |
— | — | @@ -236,7 +245,7 @@ |
237 | 246 | } |
238 | 247 | $this->children[] = $link; |
239 | 248 | |
240 | | - $this->children_start_char[] = |
| 249 | + $this->children_start_char[] = |
241 | 250 | $this->getSubcategorySortChar( $cat->getTitle(), $sortkey ); |
242 | 251 | } |
243 | 252 | |
Index: trunk/phase3/includes/WikiFilePage.php |
— | — | @@ -5,6 +5,9 @@ |
6 | 6 | * @ingroup Media |
7 | 7 | */ |
8 | 8 | class WikiFilePage extends WikiPage { |
| 9 | + /** |
| 10 | + * @var File |
| 11 | + */ |
9 | 12 | protected $mFile = false; // !< File object |
10 | 13 | protected $mRepo = null; // !< |
11 | 14 | protected $mFileLoaded = false; // !< |
— | — | @@ -43,6 +46,7 @@ |
44 | 47 | } |
45 | 48 | } |
46 | 49 | $this->mRepo = $this->mFile->getRepo(); |
| 50 | + return true; |
47 | 51 | } |
48 | 52 | |
49 | 53 | public function getRedirectTarget() { |
— | — | @@ -77,7 +81,7 @@ |
78 | 82 | if ( $this->mFile->isLocal() ) { |
79 | 83 | return parent::isRedirect( $text ); |
80 | 84 | } |
81 | | - |
| 85 | + |
82 | 86 | return (bool)$this->mFile->getRedirected(); |
83 | 87 | } |
84 | 88 | |
Index: trunk/phase3/includes/parser/Preprocessor_DOM.php |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | */ |
83 | 83 | function memCheck() { |
84 | 84 | if ( $this->memoryLimit === false ) { |
85 | | - return; |
| 85 | + return true; |
86 | 86 | } |
87 | 87 | $usage = memory_get_usage(); |
88 | 88 | if ( $usage > $this->memoryLimit * 0.9 ) { |
Index: trunk/phase3/includes/db/LoadBalancer.php |
— | — | @@ -723,6 +723,9 @@ |
724 | 724 | wfProfileOut( __METHOD__ ); |
725 | 725 | } |
726 | 726 | |
| 727 | + /** |
| 728 | + * @return int |
| 729 | + */ |
727 | 730 | function getWriterIndex() { |
728 | 731 | return 0; |
729 | 732 | } |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -923,7 +923,7 @@ |
924 | 924 | wfProfileOut( __METHOD__ ); |
925 | 925 | return $status; |
926 | 926 | } |
927 | | - if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section, $this->hookError, $this->summary ) ) { |
| 927 | + if ( $wgFilterCallback && is_callable( $wgFilterCallback ) && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section, $this->hookError, $this->summary ) ) { |
928 | 928 | # Error messages or other handling should be performed by the filter function |
929 | 929 | $status->setResult( false, self::AS_FILTERING ); |
930 | 930 | wfProfileOut( __METHOD__ . '-checks' ); |
Index: trunk/phase3/includes/RawPage.php |
— | — | @@ -154,6 +154,7 @@ |
155 | 155 | } else { |
156 | 156 | return $this->getArticleText(); |
157 | 157 | } |
| 158 | + return ''; |
158 | 159 | } |
159 | 160 | |
160 | 161 | function getArticleText() { |
Index: trunk/phase3/includes/libs/CSSMin.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -/* |
| 3 | +/** |
4 | 4 | * Copyright 2010 Wikimedia Foundation |
5 | 5 | * |
6 | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -3702,6 +3702,7 @@ |
3703 | 3703 | * - false : let it through |
3704 | 3704 | * |
3705 | 3705 | * @deprecated since 1.17 Use hooks. See SpamBlacklist extension. |
| 3706 | + * @var callback |
3706 | 3707 | */ |
3707 | 3708 | $wgFilterCallback = false; |
3708 | 3709 | |
Index: trunk/phase3/includes/specials/SpecialImport.php |
— | — | @@ -112,11 +112,11 @@ |
113 | 113 | if( $user->isAllowed( 'importupload' ) ) { |
114 | 114 | $source = ImportStreamSource::newFromUpload( "xmlimport" ); |
115 | 115 | } else { |
116 | | - return $this->getOutput()->permissionRequired( 'importupload' ); |
| 116 | + throw new PermissionsError( 'importupload' ); |
117 | 117 | } |
118 | 118 | } elseif ( $sourceName == "interwiki" ) { |
119 | 119 | if( !$user->isAllowed( 'import' ) ){ |
120 | | - return $this->getOutput()->permissionRequired( 'import' ); |
| 120 | + throw new PermissionsError( 'import' ); |
121 | 121 | } |
122 | 122 | $this->interwiki = $request->getVal( 'interwiki' ); |
123 | 123 | if ( !in_array( $this->interwiki, $wgImportSources ) ) { |
Index: trunk/phase3/includes/specials/SpecialUploadStash.php |
— | — | @@ -35,7 +35,6 @@ |
36 | 36 | try { |
37 | 37 | $this->stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash(); |
38 | 38 | } catch ( UploadStashNotAvailableException $e ) { |
39 | | - return null; |
40 | 39 | } |
41 | 40 | } |
42 | 41 | |
— | — | @@ -48,17 +47,15 @@ |
49 | 48 | public function execute( $subPage ) { |
50 | 49 | if ( !$this->userCanExecute( $this->getUser() ) ) { |
51 | 50 | $this->displayRestrictionError(); |
52 | | - return; |
| 51 | + return false; |
53 | 52 | } |
54 | 53 | |
55 | 54 | if ( $subPage === null || $subPage === '' ) { |
56 | 55 | return $this->showUploads(); |
57 | | - } else { |
58 | | - return $this->showUpload( $subPage ); |
59 | 56 | } |
| 57 | + return $this->showUpload( $subPage ); |
60 | 58 | } |
61 | 59 | |
62 | | - |
63 | 60 | /** |
64 | 61 | * If file available in stash, cats it out to the client as a simple HTTP response. |
65 | 62 | * n.b. Most sanity checking done in UploadStashLocalFile, so this is straightforward. |
— | — | @@ -206,7 +203,7 @@ |
207 | 204 | // do not use trailing slash |
208 | 205 | global $wgUploadStashScalerBaseUrl; |
209 | 206 | $scalerBaseUrl = $wgUploadStashScalerBaseUrl; |
210 | | - |
| 207 | + |
211 | 208 | if( preg_match( '/^\/\//', $scalerBaseUrl ) ) { |
212 | 209 | // this is apparently a protocol-relative URL, which makes no sense in this context, |
213 | 210 | // since this is used for communication that's internal to the application. |
Index: trunk/phase3/includes/Block.php |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | $this->mAuto = $auto; |
79 | 79 | $this->isHardblock( !$anonOnly ); |
80 | 80 | $this->prevents( 'createaccount', $createAccount ); |
81 | | - if ( $expiry == 'infinity' || $expiry == Block::infinity() ) { |
| 81 | + if ( $expiry == 'infinity' || $expiry == wfGetDB( DB_SLAVE )->getInfinity() ) { |
82 | 82 | $this->mExpiry = 'infinity'; |
83 | 83 | } else { |
84 | 84 | $this->mExpiry = wfTimestamp( TS_MW, $expiry ); |
Index: trunk/phase3/includes/extauth/vB.php |
— | — | @@ -103,13 +103,14 @@ |
104 | 104 | |
105 | 105 | private function getDb() { |
106 | 106 | global $wgExternalAuthConf; |
107 | | - return new Database( |
108 | | - $wgExternalAuthConf['server'], |
109 | | - $wgExternalAuthConf['username'], |
110 | | - $wgExternalAuthConf['password'], |
111 | | - $wgExternalAuthConf['dbname'], |
112 | | - 0, |
113 | | - $wgExternalAuthConf['tablePrefix'] |
| 107 | + return DatabaseBase::factory( 'mysql', |
| 108 | + array( |
| 109 | + 'host' => $wgExternalAuthConf['server'], |
| 110 | + 'user' => $wgExternalAuthConf['username'], |
| 111 | + 'password' => $wgExternalAuthConf['password'], |
| 112 | + 'dbname' => $wgExternalAuthConf['dbname'], |
| 113 | + 'tablePrefix' => $wgExternalAuthConf['tablePrefix'], |
| 114 | + ) |
114 | 115 | ); |
115 | 116 | } |
116 | 117 | |
Index: trunk/phase3/includes/Exception.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | global $wgExceptionHooks; |
55 | 55 | |
56 | 56 | if ( !isset( $wgExceptionHooks ) || !is_array( $wgExceptionHooks ) ) { |
57 | | - return; // Just silently ignore |
| 57 | + return; // Just silently ignore |
58 | 58 | } |
59 | 59 | |
60 | 60 | if ( !array_key_exists( $name, $wgExceptionHooks ) || !is_array( $wgExceptionHooks[ $name ] ) ) { |
Index: trunk/phase3/api.php |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | $processor->execute(); |
119 | 119 | |
120 | 120 | // Execute any deferred updates |
121 | | -wfDoUpdates(); |
| 121 | +DeferredUpdates::doUpdates(); |
122 | 122 | |
123 | 123 | // Log what the user did, for book-keeping purposes. |
124 | 124 | $endtime = microtime( true ); |