Index: branches/REL1_18/phase3/includes/User.php |
— | — | @@ -282,7 +282,7 @@ |
283 | 283 | * Load user table data, given mId has already been set. |
284 | 284 | * @return Bool false if the ID does not exist, true otherwise |
285 | 285 | */ |
286 | | - private function loadFromId() { |
| 286 | + public function loadFromId() { |
287 | 287 | global $wgMemc; |
288 | 288 | if ( $this->mId == 0 ) { |
289 | 289 | $this->loadDefaults(); |
— | — | @@ -859,7 +859,7 @@ |
860 | 860 | * |
861 | 861 | * @param $name string |
862 | 862 | */ |
863 | | - private function loadDefaults( $name = false ) { |
| 863 | + public function loadDefaults( $name = false ) { |
864 | 864 | wfProfileIn( __METHOD__ ); |
865 | 865 | |
866 | 866 | $this->mId = 0; |
— | — | @@ -1016,7 +1016,7 @@ |
1017 | 1017 | * |
1018 | 1018 | * @return Bool True if the user exists, false if the user is anonymous |
1019 | 1019 | */ |
1020 | | - private function loadFromDatabase() { |
| 1020 | + public function loadFromDatabase() { |
1021 | 1021 | # Paranoia |
1022 | 1022 | $this->mId = intval( $this->mId ); |
1023 | 1023 | |
— | — | @@ -2758,7 +2758,7 @@ |
2759 | 2759 | * Clear the user's cookies and session, and reset the instance cache. |
2760 | 2760 | * @see logout() |
2761 | 2761 | */ |
2762 | | - private function doLogout() { |
| 2762 | + public function doLogout() { |
2763 | 2763 | $this->clearInstanceCache( 'defaults' ); |
2764 | 2764 | |
2765 | 2765 | $this->getRequest()->setSessionData( 'wsUserID', 0 ); |
Index: branches/REL1_18/phase3/includes/installer/Installer.php |
— | — | @@ -1466,10 +1466,14 @@ |
1467 | 1467 | $params['language'] = $myLang; |
1468 | 1468 | } |
1469 | 1469 | |
1470 | | - $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl, |
1471 | | - array( 'method' => 'POST', 'postData' => $params ) )->execute(); |
1472 | | - if( !$res->isOK() ) { |
1473 | | - $s->warning( 'config-install-subscribe-fail', $res->getMessage() ); |
| 1470 | + if( MWHttpRequest::canMakeRequests() ) { |
| 1471 | + $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl, |
| 1472 | + array( 'method' => 'POST', 'postData' => $params ) )->execute(); |
| 1473 | + if( !$res->isOK() ) { |
| 1474 | + $s->warning( 'config-install-subscribe-fail', $res->getMessage() ); |
| 1475 | + } |
| 1476 | + } else { |
| 1477 | + $s->warning( 'config-install-subscribe-notpossible' ); |
1474 | 1478 | } |
1475 | 1479 | } |
1476 | 1480 | |
Index: branches/REL1_18/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -520,6 +520,7 @@ |
521 | 521 | 'config-insecure-keys' => "'''Warning:''' {{PLURAL:$2|A secure key|Secure keys}} ($1) generated during installation {{PLURAL:$2|is|are}} not completely safe. Consider changing {{PLURAL:$2|it|them}} manually.", |
522 | 522 | 'config-install-sysop' => 'Creating administrator user account', |
523 | 523 | 'config-install-subscribe-fail' => 'Unable to subscribe to mediawiki-announce: $1', |
| 524 | + 'config-install-subscribe-notpossible' => 'cURL is not installed and allow_url_fopen is not available.', |
524 | 525 | 'config-install-mainpage' => 'Creating main page with default content', |
525 | 526 | 'config-install-extension-tables' => 'Creating tables for enabled extensions', |
526 | 527 | 'config-install-mainpage-failed' => 'Could not insert main page: $1', |
Index: branches/REL1_18/phase3/includes/api/ApiQueryAllUsers.php |
— | — | @@ -248,7 +248,7 @@ |
249 | 249 | |
250 | 250 | if ( $fld_rights ) { |
251 | 251 | if ( !isset( $lastUserData['rights'] ) ) { |
252 | | - $lastUserData['rights'] = User::getGroupPermissions( User::getImplicitGroups() ); |
| 252 | + $lastUserData['rights'] = User::getGroupPermissions( User::newFromName( $lastUser )->getAutomaticGroups() ); |
253 | 253 | } |
254 | 254 | if ( !is_null( $row->ug_group2 ) ) { |
255 | 255 | $lastUserData['rights'] = array_unique( array_merge( $lastUserData['rights'], |
Index: branches/REL1_18/phase3/includes/api/ApiQueryUsers.php |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | |
156 | 156 | if ( isset( $this->prop['rights'] ) ) { |
157 | 157 | if ( !isset( $data[$name]['rights'] ) ) { |
158 | | - $data[$name]['rights'] = User::getGroupPermissions( User::getImplicitGroups() ); |
| 158 | + $data[$name]['rights'] = User::getGroupPermissions( $user->getAutomaticGroups() ); |
159 | 159 | } |
160 | 160 | |
161 | 161 | if ( !is_null( $row->ug_group ) ) { |
Index: branches/REL1_18/phase3/includes/WikiPage.php |
— | — | @@ -82,6 +82,8 @@ |
83 | 83 | * Always override this for all subclasses (until we use PHP with LSB) |
84 | 84 | * |
85 | 85 | * @param $id Int article ID to load |
| 86 | + * |
| 87 | + * @return WikiPage |
86 | 88 | */ |
87 | 89 | public static function newFromID( $id ) { |
88 | 90 | $t = Title::newFromID( $id ); |
— | — | @@ -278,6 +280,8 @@ |
279 | 281 | /** |
280 | 282 | * Return the list of revision fields that should be selected to create |
281 | 283 | * a new page. |
| 284 | + * |
| 285 | + * @return array |
282 | 286 | */ |
283 | 287 | public static function selectFields() { |
284 | 288 | return array( |
— | — | @@ -535,7 +539,7 @@ |
536 | 540 | * Revision::FOR_THIS_USER to be displayed to $wgUser |
537 | 541 | * Revision::RAW get the text regardless of permissions |
538 | 542 | * @return String|false The text of the current revision |
539 | | - */ |
| 543 | + */ |
540 | 544 | public function getText( $audience = Revision::FOR_PUBLIC ) { |
541 | 545 | $this->loadLastEdit(); |
542 | 546 | if ( $this->mLastRevision ) { |
Index: branches/REL1_18/phase3/includes/HttpFunctions.php |
— | — | @@ -210,6 +210,15 @@ |
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
| 214 | + * Simple function to test if we can make any sort of requests at all, using |
| 215 | + * cURL or fopen() |
| 216 | + * @return bool |
| 217 | + */ |
| 218 | + public static function canMakeRequests() { |
| 219 | + return function_exists( 'curl_init' ) || wfIniGetBool( 'allow_url_fopen' ); |
| 220 | + } |
| 221 | + |
| 222 | + /** |
214 | 223 | * Generate a new request object |
215 | 224 | * @param $url String: url to use |
216 | 225 | * @param $options Array: (optional) extra params to pass (see Http::request()) |
Index: branches/REL1_18/phase3/includes/Block.php |
— | — | @@ -77,7 +77,11 @@ |
78 | 78 | $this->mAuto = $auto; |
79 | 79 | $this->isHardblock( !$anonOnly ); |
80 | 80 | $this->prevents( 'createaccount', $createAccount ); |
81 | | - $this->mExpiry = $expiry; |
| 81 | + if ( $expiry == 'infinity' || $expiry == Block::infinity() ) { |
| 82 | + $this->mExpiry = 'infinity'; |
| 83 | + } else { |
| 84 | + $this->mExpiry = wfTimestamp( TS_MW, $expiry ); |
| 85 | + } |
82 | 86 | $this->isAutoblocking( $enableAutoblock ); |
83 | 87 | $this->mHideName = $hideName; |
84 | 88 | $this->prevents( 'sendemail', $blockEmail ); |
— | — | @@ -348,8 +352,15 @@ |
349 | 353 | $this->mAuto = $row->ipb_auto; |
350 | 354 | $this->mHideName = $row->ipb_deleted; |
351 | 355 | $this->mId = $row->ipb_id; |
352 | | - $this->mExpiry = $row->ipb_expiry; |
353 | 356 | |
| 357 | + // I wish I didn't have to do this |
| 358 | + $db = wfGetDB( DB_SLAVE ); |
| 359 | + if ( $row->ipb_expiry == $db->getInfinity() ) { |
| 360 | + $this->mExpiry = 'infinity'; |
| 361 | + } else { |
| 362 | + $this->mExpiry = wfTimestamp( TS_MW, $row->ipb_expiry ); |
| 363 | + } |
| 364 | + |
354 | 365 | $this->isHardblock( !$row->ipb_anon_only ); |
355 | 366 | $this->isAutoblocking( $row->ipb_enable_autoblock ); |
356 | 367 | |
— | — | @@ -455,7 +466,7 @@ |
456 | 467 | if( !$db ){ |
457 | 468 | $db = wfGetDB( DB_SLAVE ); |
458 | 469 | } |
459 | | - $this->mExpiry = $db->encodeExpiry( $this->mExpiry ); |
| 470 | + $expiry = $db->encodeExpiry( $this->mExpiry ); |
460 | 471 | |
461 | 472 | $a = array( |
462 | 473 | 'ipb_address' => (string)$this->target, |
— | — | @@ -468,7 +479,7 @@ |
469 | 480 | 'ipb_anon_only' => !$this->isHardblock(), |
470 | 481 | 'ipb_create_account' => $this->prevents( 'createaccount' ), |
471 | 482 | 'ipb_enable_autoblock' => $this->isAutoblocking(), |
472 | | - 'ipb_expiry' => $this->mExpiry, |
| 483 | + 'ipb_expiry' => $expiry, |
473 | 484 | 'ipb_range_start' => $this->getRangeStart(), |
474 | 485 | 'ipb_range_end' => $this->getRangeEnd(), |
475 | 486 | 'ipb_deleted' => intval( $this->mHideName ), // typecast required for SQLite |
— | — | @@ -632,8 +643,7 @@ |
633 | 644 | $autoblock->mHideName = $this->mHideName; |
634 | 645 | $autoblock->prevents( 'editownusertalk', $this->prevents( 'editownusertalk' ) ); |
635 | 646 | |
636 | | - $dbr = wfGetDB( DB_SLAVE ); |
637 | | - if ( $this->mExpiry == $dbr->getInfinity() ) { |
| 647 | + if ( $this->mExpiry == 'infinity' ) { |
638 | 648 | # Original block was indefinite, start an autoblock now |
639 | 649 | $autoblock->mExpiry = Block::getAutoblockExpiry( $timestamp ); |
640 | 650 | } else { |