Go to the documentation of this file.
80 # Don't change the following default, NS_MAIN is hardcoded in several
81 # places. See bug 696.
82 # Zero except in {{transclusion}} tags
104 static $titleCodec =
null;
105 static $titleCodecFingerprint =
null;
111 $fingerprint = spl_object_hash(
$wgContLang ) .
'|' . join(
'+', $wgLocalInterwikis );
113 if ( $fingerprint !== $titleCodecFingerprint ) {
117 if ( !$titleCodec ) {
119 $titleCodecFingerprint = $fingerprint;
154 $t->mDbkeyform = $key;
155 if (
$t->secureAndSplit() ) {
190 if ( is_object( $text ) ) {
191 throw new MWException(
'Title::newFromText given an object' );
204 if ( $defaultNamespace ==
NS_MAIN &&
$cache->has( $text ) ) {
205 return $cache->get( $text );
208 # Convert things like é ā or 〗 into normalized (bug 14952) text
212 $t->mDbkeyform = str_replace(
' ',
'_', $filteredText );
213 $t->mDefaultNamespace = intval( $defaultNamespace );
215 if (
$t->secureAndSplit() ) {
216 if ( $defaultNamespace ==
NS_MAIN ) {
244 # For compatibility with old buggy URLs. "+" is usually not valid in titles,
245 # but some URLs used it as a space replacement and they still come
246 # from some external search tools.
247 if ( strpos( self::legalChars(),
'+' ) ===
false ) {
248 $url = str_replace(
'+',
' ', $url );
251 $t->mDbkeyform = str_replace(
' ',
'_', $url );
252 if (
$t->secureAndSplit() ) {
263 if ( self::$titleCache ==
null ) {
264 self::$titleCache =
new MapCacheLRU( self::CACHE_MAX );
276 global $wgContentHandlerUseDB;
279 'page_namespace',
'page_title',
'page_id',
280 'page_len',
'page_is_redirect',
'page_latest',
283 if ( $wgContentHandlerUseDB ) {
284 $fields[] =
'page_content_model';
299 $row = $db->selectRow(
301 self::getSelectFields(),
302 array(
'page_id' => $id ),
305 if ( $row !==
false ) {
320 if ( !count( $ids ) ) {
327 self::getSelectFields(),
328 array(
'page_id' => $ids ),
333 foreach (
$res as $row ) {
347 $t->loadFromRow( $row );
359 if ( isset( $row->page_id ) ) {
360 $this->mArticleID = (int)$row->page_id;
362 if ( isset( $row->page_len ) ) {
363 $this->mLength = (int)$row->page_len;
365 if ( isset( $row->page_is_redirect ) ) {
366 $this->mRedirect = (bool)$row->page_is_redirect;
368 if ( isset( $row->page_latest ) ) {
369 $this->mLatestID = (int)$row->page_latest;
371 if ( isset( $row->page_content_model ) ) {
372 $this->mContentModel = strval( $row->page_content_model );
377 $this->mArticleID = 0;
379 $this->mRedirect =
false;
380 $this->mLatestID = 0;
400 $t->mInterwiki = $interwiki;
401 $t->mFragment = $fragment;
402 $t->mNamespace = $ns = intval( $ns );
403 $t->mDbkeyform = str_replace(
' ',
'_',
$title );
404 $t->mArticleID = ( $ns >= 0 ) ? -1 : 0;
406 $t->mTextform = str_replace(
'_',
' ',
$title );
429 if (
$t->secureAndSplit() ) {
464 return $content->getRedirectTarget();
481 return $content->getUltimateRedirectTarget();
498 return $content->getRedirectChain();
512 array(
'page_namespace',
'page_title' ),
513 array(
'page_id' => $id ),
516 if (
$s ===
false ) {
530 global $wgLegalTitleChars;
531 return $wgLegalTitleChars;
544 static $rxTc =
false;
546 # Matching titles will be held as illegal.
550 #
URL percent encoding sequences interfere with the ability
551 # to round-trip titles -- you can't link to them consistently.
553 # XML/HTML
character references produce similar issues.
554 '|&[A-Za-z0-9\x80-\xff]+;' .
556 '|&#x[0-9A-Fa-f]+;' .
573 $length = strlen( $byteClass );
575 $x0 = $x1 = $x2 =
'';
577 $d0 = $d1 = $d2 =
'';
579 $ord0 = $ord1 = $ord2 = 0;
581 $r0 = $r1 = $r2 =
'';
585 $allowUnicode =
false;
586 for ( $pos = 0; $pos < $length; $pos++ ) {
597 $inChar = $byteClass[$pos];
598 if ( $inChar ==
'\\' ) {
599 if ( preg_match(
'/x([0-9a-fA-F]{2})/A', $byteClass, $m, 0, $pos + 1 ) ) {
600 $x0 = $inChar . $m[0];
601 $d0 = chr( hexdec( $m[1] ) );
602 $pos += strlen( $m[0] );
603 } elseif ( preg_match(
'/[0-7]{3}/A', $byteClass, $m, 0, $pos + 1 ) ) {
604 $x0 = $inChar . $m[0];
605 $d0 = chr( octdec( $m[0] ) );
606 $pos += strlen( $m[0] );
607 } elseif ( $pos + 1 >= $length ) {
610 $d0 = $byteClass[$pos + 1];
619 if ( $ord0 < 32 || $ord0 == 0x7f ) {
620 $r0 = sprintf(
'\x%02x', $ord0 );
621 } elseif ( $ord0 >= 0x80 ) {
623 $r0 = sprintf(
'\x%02x', $ord0 );
624 $allowUnicode =
true;
625 } elseif ( strpos(
'-\\[]^', $d0 ) !==
false ) {
631 if ( $x0 !==
'' && $x1 ===
'-' && $x2 !==
'' ) {
633 if ( $ord2 > $ord0 ) {
635 } elseif ( $ord0 >= 0x80 ) {
637 $allowUnicode =
true;
638 if ( $ord2 < 0x80 ) {
647 $x0 = $x1 = $d0 = $d1 = $r0 = $r1 =
'';
648 } elseif ( $ord2 < 0x80 ) {
653 if ( $ord1 < 0x80 ) {
656 if ( $ord0 < 0x80 ) {
659 if ( $allowUnicode ) {
660 $out .=
'\u0080-\uFFFF';
678 $t = preg_replace(
"/[^{$lc}]+/",
' ',
$t );
682 $t = preg_replace(
"/([{$lc}]+)'s( |$)/",
"\\1 \\1's ",
$t );
683 $t = preg_replace(
"/([{$lc}]+)s'( |$)/",
"\\1s ",
$t );
685 $t = preg_replace(
"/\\s+/",
' ',
$t );
688 $t = preg_replace(
"/ (png|gif|jpg|jpeg|ogg)$/",
"",
$t );
702 public static function makeName( $ns,
$title, $fragment =
'', $interwiki =
'' ) {
706 $name = $namespace ==
'' ?
$title :
"$namespace:$title";
707 if ( strval( $interwiki ) !=
'' ) {
708 $name =
"$interwiki:$name";
710 if ( strval( $fragment ) !=
'' ) {
711 $name .=
'#' . $fragment;
723 # Note that we don't urlencode the fragment. urlencoded Unicode
724 # fragments appear not to work in IE (at least up to 7) or in at least
725 # one version of Opera 9.x. The W3C validator, for one, doesn't seem
726 # to care if they aren't encoded.
739 if ( $a->getNamespace() == $b->getNamespace() ) {
740 return strcmp( $a->getText(), $b->getText() );
742 return $a->getNamespace() - $b->getNamespace();
756 return $iw->isLocal();
768 return $this->mInterwiki !==
'';
819 if ( $this->mTitleValue ===
null ) {
825 }
catch ( InvalidArgumentException $ex ) {
826 wfDebug( __METHOD__ .
': Can\'t create a TitleValue for [[' .
867 if ( !is_null( $this->mUserCaseDBKey ) ) {
891 if ( !$this->mContentModel ) {
893 $this->mContentModel = $linkCache->getGoodLinkFieldObj( $this,
'model' );
896 if ( !$this->mContentModel ) {
900 if ( !$this->mContentModel ) {
901 throw new MWException(
'Failed to determine content model!' );
937 return $formatter->getNamespaceName( $this->mNamespace, $this->mDbkeyform );
938 }
catch ( InvalidArgumentException $ex ) {
939 wfDebug( __METHOD__ .
': ' . $ex->getMessage() .
"\n" );
980 return $this->mNamespace >=
NS_MAIN;
1010 if (
$name == $thisName ) {
1026 if ( $canonicalName ) {
1028 if ( $localName != $this->mDbkeyform ) {
1151 strpos( $this->
getText(),
'Conversiontable/' ) === 0;
1179 #NOTE: this hook is also called in ContentHandler::getDefaultModel. It's called here again to make sure
1180 # hook functions can force this method to return true even outside the mediawiki namespace.
1184 return $isCssOrJsPage;
1203 $subpage = explode(
'/', $this->mTextform );
1204 $subpage = $subpage[count( $subpage ) - 1];
1205 $lastdot = strrpos( $subpage,
'.' );
1206 if ( $lastdot ===
false ) {
1207 return $subpage; # Never happens:
only called
for names ending
in '.css' or
'.js'
1209 return substr( $subpage, 0, $lastdot );
1302 return $this->mFragment !==
'';
1328 $this->mFragment = str_replace(
'_',
' ', substr( $fragment, 1 ) );
1342 $p = $this->mInterwiki .
':';
1345 if ( 0 != $this->mNamespace ) {
1358 $s = $this->
prefix( $this->mDbkeyform );
1359 $s = str_replace(
' ',
'_',
$s );
1370 if ( $this->mPrefixedText ===
null ) {
1371 $s = $this->
prefix( $this->mTextform );
1372 $s = str_replace(
'_',
' ',
$s );
1373 $this->mPrefixedText =
$s;
1418 return strtok( $this->
getText(),
'/' );
1453 $parts = explode(
'/', $this->
getText() );
1454 # Don't discard the real title if there's no subpage involved
1455 if ( count( $parts ) > 1 ) {
1456 unset( $parts[count( $parts ) - 1] );
1458 return implode(
'/', $parts );
1492 $parts = explode(
'/', $this->mTextform );
1493 return $parts[count( $parts ) - 1];
1532 $text =
wfUrlencode( str_replace(
' ',
'_', $text ) );
1542 $s = $this->
prefix( $this->mDbkeyform );
1561 if ( $query2 !==
false ) {
1562 wfDeprecated(
"Title::get{Canonical,Full,Link,Local,Internal}URL " .
1563 "method called with a second parameter is deprecated. Add your " .
1564 "parameter to an array passed as the first parameter.",
"1.19" );
1566 if ( is_array(
$query ) ) {
1570 if ( is_string( $query2 ) ) {
1601 # Hand off all the decisions on urls to getLocalURL
1604 # Expand the url to make it a full url. Note that getLocalURL has the
1605 # potential to output full urls for a variety of reasons, so we use
1606 # wfExpandUrl instead of simply prepending $wgServer
1609 # Finally, add the fragment.
1645 if ( $namespace !=
'' ) {
1646 # Can this actually happen? Interwikis shouldn't be parsed.
1647 # Yes! It can in interwiki transclusion. But... it probably shouldn't.
1650 $url = $interwiki->getURL( $namespace . $this->
getDBkey() );
1663 && preg_match(
'/^(.*&|)action=([^&]*)(&(.*)|)$/',
$query,
$matches )
1665 $action = urldecode(
$matches[2] );
1679 && $wgVariantArticlePath
1684 $variant = urldecode(
$matches[1] );
1688 $url = str_replace(
'$2', urlencode( $variant ), $wgVariantArticlePath );
1689 $url = str_replace(
'$1', $dbkey, $url );
1693 if ( $url ===
false ) {
1697 $url =
"{$wgScript}?title={$dbkey}&{$query}";
1705 if ( $wgRequest->getVal(
'action' ) ==
'render' ) {
1706 $url = $wgServer . $url;
1783 global $wgInternalServer, $wgServer;
1785 $server = $wgInternalServer !==
false ? $wgInternalServer : $wgServer;
1846 if ( is_null( $this->mWatched ) ) {
1848 $this->mWatched =
false;
1850 $this->mWatched =
$wgUser->isWatched( $this );
1864 return $this->
userCan(
'read' );
1896 public function userCan( $action,
$user =
null, $doExpensiveQueries =
true ) {
1921 foreach ( $errors
as $index =>
$error ) {
1924 if ( in_array( $error_key, $ignoreErrors ) ) {
1925 unset( $errors[$index] );
1944 if ( !
wfRunHooks(
'TitleQuickPermissions',
array( $this,
$user, $action, &$errors, $doExpensiveQueries, $short ) ) ) {
1948 if ( $action ==
'create' ) {
1953 $errors[] =
$user->isAnon() ?
array(
'nocreatetext' ) :
array(
'nocreate-loggedin' );
1955 } elseif ( $action ==
'move' ) {
1956 if ( !
$user->isAllowed(
'move-rootuserpages' )
1959 $errors[] =
array(
'cant-move-user-page' );
1963 if ( $this->mNamespace ==
NS_FILE && !
$user->isAllowed(
'movefile' ) ) {
1964 $errors[] =
array(
'movenotallowedfile' );
1967 if ( !
$user->isAllowed(
'move' ) ) {
1971 if (
$user->isAnon() && ( $userCanMove || $autoconfirmedCanMove ) ) {
1973 $errors[] =
array(
'movenologintext' );
1975 $errors[] =
array(
'movenotallowed' );
1978 } elseif ( $action ==
'move-target' ) {
1979 if ( !
$user->isAllowed(
'move' ) ) {
1981 $errors[] =
array(
'movenotallowed' );
1982 } elseif ( !
$user->isAllowed(
'move-rootuserpages' )
1985 $errors[] =
array(
'cant-move-to-user-page' );
1987 } elseif ( !
$user->isAllowed( $action ) ) {
2008 $errors = array_merge( $errors,
$result );
2012 } elseif (
$result ===
false ) {
2014 $errors[] =
array(
'badaccess-group0' );
2043 && !( $short && count( $errors ) > 0 )
2064 # Only 'createaccount' can be performed on special pages,
2065 # which don't actually exist in the DB.
2066 if (
NS_SPECIAL == $this->mNamespace && $action !==
'createaccount' ) {
2067 $errors[] =
array(
'ns-specialprotected' );
2070 # Check $wgNamespaceProtection for restricted namespaces
2072 $ns = $this->mNamespace ==
NS_MAIN ?
2075 array(
'protectedinterface' ) :
array(
'namespaceprotected', $ns );
2093 # Protect css/js subpages of user pages
2094 # XXX: this might be better using restrictions
2095 # XXX: right 'editusercssjs' is deprecated, for backward compatibility only
2096 if ( $action !=
'patrol' && !
$user->isAllowed(
'editusercssjs' ) ) {
2097 if ( preg_match(
'/^' . preg_quote(
$user->getName(),
'/' ) .
'\//', $this->mTextform ) ) {
2098 if ( $this->
isCssSubpage() && !
$user->isAllowedAny(
'editmyusercss',
'editusercss' ) ) {
2099 $errors[] =
array(
'mycustomcssprotected' );
2100 } elseif ( $this->
isJsSubpage() && !
$user->isAllowedAny(
'editmyuserjs',
'edituserjs' ) ) {
2101 $errors[] =
array(
'mycustomjsprotected' );
2105 $errors[] =
array(
'customcssprotected' );
2107 $errors[] =
array(
'customjsprotected' );
2131 if (
$right ==
'sysop' ) {
2132 $right =
'editprotected';
2135 if (
$right ==
'autoconfirmed' ) {
2136 $right =
'editsemiprotected';
2143 } elseif ( $this->mCascadeRestriction && !
$user->isAllowed(
'protect' ) ) {
2144 $errors[] =
array(
'protectedpagetext',
'protect' );
2164 # We /could/ use the protection level on the source page, but it's
2165 # fairly ugly as we have to establish a precedence hierarchy for pages
2166 # included by multiple cascade-protected pages. So just restrict
2167 # it to people with 'protect' permission, as they could remove the
2168 # protection anyway.
2170 # Cascading protection depends on more than this page...
2171 # Several cascading protected pages may include this page...
2172 # Check each cascading level
2173 # This is only for protection restrictions, not for all actions
2174 if ( isset( $restrictions[$action] ) ) {
2175 foreach ( $restrictions[$action]
as $right ) {
2177 if (
$right ==
'sysop' ) {
2178 $right =
'editprotected';
2181 if (
$right ==
'autoconfirmed' ) {
2182 $right =
'editsemiprotected';
2186 foreach ( $cascadingSources
as $page ) {
2187 $pages .=
'* [[:' . $page->getPrefixedText() .
"]]\n";
2189 $errors[] =
array(
'cascadeprotected', count( $cascadingSources ), $pages );
2212 if ( $action ==
'protect' ) {
2215 $errors[] =
array(
'protect-cantedit' );
2217 } elseif ( $action ==
'create' ) {
2219 if ( $title_protection ) {
2220 if ( $title_protection[
'pt_create_perm'] ==
'sysop' ) {
2221 $title_protection[
'pt_create_perm'] =
'editprotected';
2223 if ( $title_protection[
'pt_create_perm'] ==
'autoconfirmed' ) {
2224 $title_protection[
'pt_create_perm'] =
'editsemiprotected';
2226 if ( $title_protection[
'pt_create_perm'] ==
''
2227 || !
$user->isAllowed( $title_protection[
'pt_create_perm'] )
2229 $errors[] =
array(
'titleprotected',
User::whoIs( $title_protection[
'pt_user'] ), $title_protection[
'pt_reason'] );
2232 } elseif ( $action ==
'move' ) {
2236 $errors[] =
array(
'immobile-source-namespace', $this->
getNsText() );
2239 $errors[] =
array(
'immobile-source-page' );
2241 } elseif ( $action ==
'move-target' ) {
2243 $errors[] =
array(
'immobile-target-namespace', $this->
getNsText() );
2245 $errors[] =
array(
'immobile-target-page' );
2247 } elseif ( $action ==
'delete' ) {
2248 if ( $doExpensiveQueries && $wgDeleteRevisionsLimit
2251 $errors[] =
array(
'delete-toobig',
$wgLang->formatNum( $wgDeleteRevisionsLimit ) );
2271 if ( !$doExpensiveQueries || in_array( $action,
array(
'createaccount',
'unblock' ) ) ) {
2275 global $wgEmailConfirmToEdit;
2277 if ( $wgEmailConfirmToEdit && !
$user->isEmailConfirmed() ) {
2278 $errors[] =
array(
'confirmedittext' );
2281 if ( ( $action ==
'edit' || $action ==
'create' ) && !
$user->isBlockedFrom( $this ) ) {
2284 } elseif (
$user->isBlocked() &&
$user->mBlock->prevents( $action ) !==
false ) {
2304 global $wgWhitelistRead, $wgWhitelistReadRegexp;
2306 $whitelisted =
false;
2308 # Shortcut for public wikis, allows skipping quite a bit of code
2309 $whitelisted =
true;
2310 } elseif (
$user->isAllowed(
'read' ) ) {
2311 # If the user is allowed to read pages, he is allowed to read all pages
2312 $whitelisted =
true;
2313 } elseif ( $this->
isSpecial(
'Userlogin' )
2317 # Always grant access to the login page.
2318 # Even anons need to be able to log in.
2319 $whitelisted =
true;
2320 } elseif ( is_array( $wgWhitelistRead ) && count( $wgWhitelistRead ) ) {
2321 # Time to check the whitelist
2322 # Only do these checks is there's something to check against
2327 if ( in_array(
$name, $wgWhitelistRead,
true ) || in_array( $dbName, $wgWhitelistRead,
true ) ) {
2328 $whitelisted =
true;
2330 # Old settings might have the title prefixed with
2331 # a colon for main-namespace pages
2332 if ( in_array(
':' .
$name, $wgWhitelistRead ) ) {
2333 $whitelisted =
true;
2336 # If it's a special page, ditch the subpage bit and check again
2341 if ( in_array( $pure, $wgWhitelistRead,
true ) ) {
2342 $whitelisted =
true;
2348 if ( !$whitelisted && is_array( $wgWhitelistReadRegexp ) && !empty( $wgWhitelistReadRegexp ) ) {
2351 foreach ( $wgWhitelistReadRegexp
as $listItem ) {
2352 if ( preg_match( $listItem,
$name ) ) {
2353 $whitelisted =
true;
2359 if ( !$whitelisted ) {
2360 # If the title is not whitelisted, give extensions a chance to do so...
2362 if ( !$whitelisted ) {
2381 return array(
'badaccess-group0' );
2384 $groups = array_map(
array(
'User',
'makeGroupLinkWiki' ),
2387 if ( count( $groups ) ) {
2391 $wgLang->commaList( $groups ),
2395 return array(
'badaccess-group0' );
2413 # Read has special handling
2414 if ( $action ==
'read' ) {
2416 'checkPermissionHooks',
2417 'checkReadPermissions',
2421 'checkQuickPermissions',
2422 'checkPermissionHooks',
2423 'checkSpecialsAndNSPermissions',
2424 'checkCSSandJSPermissions',
2425 'checkPageRestrictions',
2426 'checkCascadingSourcesRestrictions',
2427 'checkActionPermissions',
2433 while ( count( $checks ) > 0 &&
2434 !( $short && count( $errors ) > 0 ) ) {
2435 $method = array_shift( $checks );
2436 $errors = $this->$method( $action,
$user, $errors, $doExpensiveQueries, $short );
2451 global $wgRestrictionTypes;
2452 $types = $wgRestrictionTypes;
2454 # Remove the create restriction for existing titles
2455 $types = array_diff( $types,
array(
'create' ) );
2457 # Only the create and upload restrictions apply to non-existing titles
2458 $types = array_intersect( $types,
array(
'create',
'upload' ) );
2476 # Remove the upload restriction for non-file titles
2477 $types = array_diff( $types,
array(
'upload' ) );
2482 wfDebug( __METHOD__ .
': applicable restrictions to [[' .
2483 $this->
getPrefixedText() .
']] are {' . implode(
',', $types ) .
"}\n" );
2506 if ( !isset( $this->mTitleProtection ) ) {
2510 array(
'pt_user',
'pt_reason',
'pt_expiry',
'pt_create_perm' ),
2516 $this->mTitleProtection =
$dbr->fetchRow(
$res );
2536 $expiry =
array(
'create' => $expiry );
2540 $status = $page->doUpdateRestrictions(
$limit, $expiry, $cascade, $reason,
$wgUser );
2542 return $status->isOK();
2556 $this->mTitleProtection =
false;
2567 global $wgSemiprotectedRestrictionLevels;
2570 $semi = $wgSemiprotectedRestrictionLevels;
2571 if ( !$restrictions || !$semi ) {
2577 foreach ( array_keys( $semi,
'autoconfirmed' )
as $key ) {
2578 $semi[$key] =
'editsemiprotected';
2580 foreach ( array_keys( $restrictions,
'autoconfirmed' )
as $key ) {
2581 $restrictions[$key] =
'editsemiprotected';
2584 return !array_diff( $restrictions, $semi );
2595 global $wgRestrictionLevels;
2599 # Special pages have inherent protection
2604 # Check regular protection levels
2605 foreach ( $restrictionTypes
as $type ) {
2606 if ( $action ==
$type || $action ==
'' ) {
2608 foreach ( $wgRestrictionLevels
as $level ) {
2609 if ( in_array( $level, $r ) && $level !=
'' ) {
2646 return ( $sources > 0 );
2659 return $getPages ? isset( $this->mCascadeSources ) : isset( $this->mHasCascadingRestrictions );
2674 $pagerestrictions =
array();
2676 if ( isset( $this->mCascadeSources ) && $getPages ) {
2677 return array( $this->mCascadeSources, $this->mCascadingRestrictions );
2678 } elseif ( isset( $this->mHasCascadingRestrictions ) && !$getPages ) {
2679 return array( $this->mHasCascadingRestrictions, $pagerestrictions );
2688 $where_clauses =
array(
2694 $tables =
array(
'templatelinks',
'page_restrictions' );
2695 $where_clauses =
array(
2704 $cols =
array(
'pr_page',
'page_namespace',
'page_title',
2705 'pr_expiry',
'pr_type',
'pr_level' );
2706 $where_clauses[] =
'page_id=pr_page';
2709 $cols =
array(
'pr_expiry' );
2714 $sources = $getPages ?
array() :
false;
2716 $purgeExpired =
false;
2718 foreach (
$res as $row ) {
2720 if ( $expiry > $now ) {
2722 $page_id = $row->pr_page;
2723 $page_ns = $row->page_namespace;
2724 $page_title = $row->page_title;
2726 # Add groups needed for each restriction type if its not already there
2727 # Make sure this restriction type still exists
2729 if ( !isset( $pagerestrictions[$row->pr_type] ) ) {
2730 $pagerestrictions[$row->pr_type] =
array();
2734 isset( $pagerestrictions[$row->pr_type] )
2735 && !in_array( $row->pr_level, $pagerestrictions[$row->pr_type] )
2737 $pagerestrictions[$row->pr_type][] = $row->pr_level;
2744 $purgeExpired =
true;
2747 if ( $purgeExpired ) {
2752 $this->mCascadeSources = $sources;
2753 $this->mCascadingRestrictions = $pagerestrictions;
2755 $this->mHasCascadingRestrictions = $sources;
2759 return array( $sources, $pagerestrictions );
2780 if ( !$this->mRestrictionsLoaded ) {
2783 return isset( $this->mRestrictions[$action] )
2784 ? $this->mRestrictions[$action]
2797 if ( !$this->mRestrictionsLoaded ) {
2811 if ( !$this->mRestrictionsLoaded ) {
2814 return isset( $this->mRestrictionsExpiry[$action] ) ? $this->mRestrictionsExpiry[$action] :
false;
2823 if ( !$this->mRestrictionsLoaded ) {
2840 foreach (
$res as $row ) {
2862 foreach ( $restrictionTypes
as $type ) {
2867 $this->mCascadeRestriction =
false;
2869 # Backwards-compatibility: also load the restrictions from the page record (old format).
2871 if ( $oldFashionedRestrictions ===
null ) {
2872 $oldFashionedRestrictions =
$dbr->selectField(
'page',
'page_restrictions',
2876 if ( $oldFashionedRestrictions !=
'' ) {
2878 foreach ( explode(
':', trim( $oldFashionedRestrictions ) )
as $restrict ) {
2879 $temp = explode(
'=', trim( $restrict ) );
2880 if ( count( $temp ) == 1 ) {
2882 $this->mRestrictions[
'edit'] = explode(
',', trim( $temp[0] ) );
2883 $this->mRestrictions[
'move'] = explode(
',', trim( $temp[0] ) );
2885 $restriction = trim( $temp[1] );
2886 if ( $restriction !=
'' ) {
2887 $this->mRestrictions[$temp[0]] = explode(
',', $restriction );
2892 $this->mOldRestrictions =
true;
2896 if ( count( $rows ) ) {
2897 # Current system - load second to make them override.
2899 $purgeExpired =
false;
2901 # Cycle through all the restrictions.
2902 foreach ( $rows
as $row ) {
2905 if ( !in_array( $row->pr_type, $restrictionTypes ) ) {
2914 if ( !$expiry || $expiry > $now ) {
2915 $this->mRestrictionsExpiry[$row->pr_type] = $expiry;
2916 $this->mRestrictions[$row->pr_type] = explode(
',', trim( $row->pr_level ) );
2918 $this->mCascadeRestriction |= $row->pr_cascade;
2921 $purgeExpired =
true;
2925 if ( $purgeExpired ) {
2930 $this->mRestrictionsLoaded =
true;
2941 if ( !$this->mRestrictionsLoaded ) {
2946 'page_restrictions',
2947 array(
'pr_type',
'pr_expiry',
'pr_level',
'pr_cascade' ),
2956 if ( $title_protection ) {
2958 $expiry =
$wgContLang->formatExpiry( $title_protection[
'pt_expiry'],
TS_MW );
2960 if ( !$expiry || $expiry > $now ) {
2962 $this->mRestrictionsExpiry[
'create'] = $expiry;
2963 $this->mRestrictions[
'create'] = explode(
',', trim( $title_protection[
'pt_create_perm'] ) );
2966 $this->mTitleProtection =
false;
2969 $this->mRestrictionsExpiry[
'create'] =
$wgContLang->formatExpiry(
'',
TS_MW );
2971 $this->mRestrictionsLoaded =
true;
2981 $this->mRestrictionsLoaded =
false;
2982 $this->mTitleProtection =
null;
2993 $method = __METHOD__;
2995 $dbw->onTransactionIdle(
function() use ( $dbw, $method ) {
2997 'page_restrictions',
2998 array(
'pr_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ),
3003 array(
'pt_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ),
3020 # We dynamically add a member variable for the purpose of this method
3021 # alone to cache the result. There's no point in having it hanging
3022 # around uninitialized in every Title object; therefore we only add it
3023 # if needed and don't declare it statically.
3024 if ( !isset( $this->mHasSubpages ) ) {
3025 $this->mHasSubpages =
false;
3028 $this->mHasSubpages = (bool)$subpages->count();
3032 return $this->mHasSubpages;
3049 $conds[] =
'page_title ' .
$dbr->buildLike( $this->
getDBkey() .
'/',
$dbr->anyString() );
3055 $dbr->select(
'page',
3056 array(
'page_id',
'page_namespace',
'page_title',
'page_is_redirect' ),
3062 return $this->mSubpages;
3076 $n =
$dbr->selectField(
'archive',
'COUNT(*)',
3081 $n +=
$dbr->selectField(
'filearchive',
'COUNT(*)',
3100 $deleted = (bool)
$dbr->selectField(
'archive',
'1',
3105 $deleted = (bool)
$dbr->selectField(
'filearchive',
'1',
3123 $this->mArticleID = 0;
3127 if (
$flags & self::GAID_FOR_UPDATE ) {
3128 $oldUpdate = $linkCache->forUpdate(
true );
3129 $linkCache->clearLink( $this );
3130 $this->mArticleID = $linkCache->addLinkObj( $this );
3131 $linkCache->forUpdate( $oldUpdate );
3133 if ( -1 == $this->mArticleID ) {
3134 $this->mArticleID = $linkCache->addLinkObj( $this );
3148 if ( !is_null( $this->mRedirect ) ) {
3151 # Calling getArticleID() loads the field from cache as needed
3153 $this->mRedirect =
false;
3158 $cached = $linkCache->getGoodLinkFieldObj( $this,
'redirect' );
3159 if ( $cached ===
null ) {
3160 # Trust LinkCache's state over our own
3161 # LinkCache is telling us that the page doesn't exist, despite there being cached
3162 # data relating to an existing page in $this->mArticleID. Updaters should clear
3163 # LinkCache as appropriate, or use $flags = Title::GAID_FOR_UPDATE. If that flag is
3164 # set, then LinkCache will definitely be up to date here, since getArticleID() forces
3165 # LinkCache to refresh its data from the master.
3166 $this->mRedirect =
false;
3170 $this->mRedirect = (bool)$cached;
3183 if ( $this->mLength != -1 ) {
3186 # Calling getArticleID() loads the field from cache as needed
3192 $cached = $linkCache->getGoodLinkFieldObj( $this,
'length' );
3193 if ( $cached ===
null ) {
3194 # Trust LinkCache's state over our own, as for isRedirect()
3199 $this->mLength = intval( $cached );
3212 return intval( $this->mLatestID );
3214 # Calling getArticleID() loads the field from cache as needed
3216 $this->mLatestID = 0;
3220 $linkCache->addLinkObj( $this );
3221 $cached = $linkCache->getGoodLinkFieldObj( $this,
'revision' );
3222 if ( $cached ===
null ) {
3223 # Trust LinkCache's state over our own, as for isRedirect()
3224 $this->mLatestID = 0;
3228 $this->mLatestID = intval( $cached );
3245 $linkCache->clearLink( $this );
3247 if ( $newid ===
false ) {
3248 $this->mArticleID = -1;
3250 $this->mArticleID = intval( $newid );
3252 $this->mRestrictionsLoaded =
false;
3253 $this->mRestrictions =
array();
3254 $this->mRedirect =
null;
3255 $this->mLength = -1;
3256 $this->mLatestID =
false;
3257 $this->mContentModel =
false;
3258 $this->mEstimateRevisions =
null;
3259 $this->mPageLanguage =
false;
3292 $this->mInterwiki =
'';
3293 $this->mFragment =
'';
3310 $this->mInterwiki = $parts[
'interwiki'];
3311 $this->mNamespace = $parts[
'namespace'];
3312 $this->mUserCaseDBKey = $parts[
'user_case_dbkey'];
3314 $this->mDbkeyform = $parts[
'dbkey'];
3315 $this->mUrlform =
wfUrlencode( $this->mDbkeyform );
3316 $this->mTextform = str_replace(
'_',
' ', $this->mDbkeyform );
3318 # We already know that some pages won't be in the database!
3320 $this->mArticleID = 0;
3346 array(
'page', $table ),
3347 self::getSelectFields(),
3349 "{$prefix}_from=page_id",
3351 "{$prefix}_title" => $this->
getDBkey() ),
3357 if (
$res->numRows() ) {
3359 foreach (
$res as $row ) {
3362 $linkCache->addGoodLinkObjFromRow( $titleObj, $row );
3363 $retVal[] = $titleObj;
3397 global $wgContentHandlerUseDB;
3401 # If the page doesn't exist; there can't be any link from this page
3412 $namespaceFiled =
"{$prefix}_namespace";
3413 $titleField =
"{$prefix}_title";
3415 $fields =
array( $namespaceFiled, $titleField,
'page_id',
'page_len',
'page_is_redirect',
'page_latest' );
3416 if ( $wgContentHandlerUseDB ) {
3417 $fields[] =
'page_content_model';
3421 array( $table,
'page' ),
3423 array(
"{$prefix}_from" => $id ),
3426 array(
'page' =>
array(
'LEFT JOIN',
array(
"page_namespace=$namespaceFiled",
"page_title=$titleField" ) ) )
3430 if (
$res->numRows() ) {
3432 foreach (
$res as $row ) {
3435 if ( $row->page_id ) {
3436 $linkCache->addGoodLinkObjFromRow( $titleObj, $row );
3438 $linkCache->addBadLinkObj( $titleObj );
3440 $retVal[] = $titleObj;
3469 # All links from article ID 0 are false positives
3475 array(
'page',
'pagelinks' ),
3476 array(
'pl_namespace',
'pl_title' ),
3479 'page_namespace IS NULL'
3481 __METHOD__,
array(),
3485 array(
'pl_namespace=page_namespace',
'pl_title=page_title' )
3491 foreach (
$res as $row ) {
3510 if ( $pageLang->hasVariants() ) {
3511 $variants = $pageLang->getVariants();
3512 foreach ( $variants
as $vCode ) {
3519 $urls[] = $this->getInternalUrl(
'action=raw&ctype=text/javascript' );
3521 $urls[] = $this->getInternalUrl(
'action=raw&ctype=text/css' );
3533 if ( $wgUseSquid ) {
3547 return $this->
moveTo( $nt,
false );
3569 if ( $this->
equals( $nt ) ) {
3570 $errors[] =
array(
'selfmove' );
3573 $errors[] =
array(
'immobile-source-namespace', $this->
getNsText() );
3575 if ( $nt->isExternal() ) {
3576 $errors[] =
array(
'immobile-target-namespace-iw' );
3578 if ( !$nt->isMovable() ) {
3579 $errors[] =
array(
'immobile-target-namespace', $nt->getNsText() );
3583 $newid = $nt->getArticleID();
3585 if ( strlen( $nt->getDBkey() ) < 1 ) {
3586 $errors[] =
array(
'articleexists' );
3591 ( $nt->getDBkey() ==
'' )
3593 $errors[] =
array(
'badarticleerror' );
3597 if ( !$wgContentHandlerUseDB &&
3613 $errors[] =
array(
'nonfile-cannot-move-to-file' );
3620 $nt->getUserPermissionsErrors(
'move-target',
$wgUser ),
3621 $nt->getUserPermissionsErrors(
'edit',
$wgUser ) );
3624 $match = EditPage::matchSummarySpamRegex( $reason );
3625 if ( $match !==
false ) {
3627 $errors[] =
array(
'spamprotectiontext' );
3632 $errors[] =
array(
'hookaborted', $err );
3635 # The move is allowed only if (1) the target doesn't exist, or
3636 # (2) the target is a redirect to the source, and has no history
3637 # (so we can undo bad moves right after they're done).
3639 if ( 0 != $newid ) { # Target
exists;
check for validity
3641 $errors[] =
array(
'articleexists' );
3644 $tp = $nt->getTitleProtection();
3645 $right = $tp[
'pt_create_perm'];
3646 if (
$right ==
'sysop' ) {
3647 $right =
'editprotected';
3649 if (
$right ==
'autoconfirmed' ) {
3650 $right =
'editsemiprotected';
3653 $errors[] =
array(
'cantmove-titleprotected' );
3656 if ( empty( $errors ) ) {
3675 if (
$file->exists() ) {
3677 $errors[] =
array(
'imageinvalidfilename' );
3680 $errors[] =
array(
'imagetypemismatch' );
3684 if ( $nt->getNamespace() !=
NS_FILE ) {
3685 $errors[] =
array(
'imagenocrossnamespace' );
3694 if ( !
$wgUser->isAllowed(
'reupload-shared' ) && !$destFile->exists() &&
wfFindFile( $nt ) ) {
3695 $errors[] =
array(
'file-exists-sharedrepo' );
3712 public function moveTo( &$nt, $auth =
true, $reason =
'', $createRedirect =
true ) {
3715 if ( is_array( $err ) ) {
3717 $wgUser->spreadAnyEditBlock();
3721 if ( $auth && !
$wgUser->isAllowed(
'suppressredirect' ) ) {
3722 $createRedirect =
true;
3732 if (
$file->exists() ) {
3733 $status =
$file->move( $nt );
3734 if ( !$status->isOk() ) {
3735 return $status->getErrorsArray();
3743 $dbw->begin( __METHOD__ ); # If
$file was a
LocalFile, its transaction would have closed our own.
3744 $pageid = $this->
getArticleID( self::GAID_FOR_UPDATE );
3752 $prefixes = $dbw->select(
3754 array(
'cl_sortkey_prefix',
'cl_to' ),
3755 array(
'cl_from' => $pageid ),
3758 foreach ( $prefixes
as $prefixRow ) {
3759 $prefix = $prefixRow->cl_sortkey_prefix;
3760 $catTo = $prefixRow->cl_to;
3761 $dbw->update(
'categorylinks',
3764 $nt->getCategorySortkey( $prefix ) ),
3765 'cl_timestamp=cl_timestamp' ),
3767 'cl_from' => $pageid,
3768 'cl_to' => $catTo ),
3776 # Protect the redirect title as the title used to be...
3777 $dbw->insertSelect(
'page_restrictions',
'page_restrictions',
3779 'pr_page' => $redirid,
3780 'pr_type' =>
'pr_type',
3781 'pr_level' =>
'pr_level',
3782 'pr_cascade' =>
'pr_cascade',
3783 'pr_user' =>
'pr_user',
3784 'pr_expiry' =>
'pr_expiry'
3786 array(
'pr_page' => $pageid ),
3790 # Update the protection log
3791 $log =
new LogPage(
'protect' );
3795 $nt->getPrefixedText()
3796 )->inContentLanguage()->text();
3798 $comment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $reason;
3804 $insertedPrIds = $dbw->select(
3805 'page_restrictions',
3807 array(
'pr_page' => $redirid ),
3810 $logRelationsValues =
array();
3811 foreach ( $insertedPrIds
as $prid ) {
3812 $logRelationsValues[] = $prid->pr_id;
3814 $log->addRelations(
'pr_id', $logRelationsValues, $logId );
3821 $newtitle = $nt->getDBkey();
3823 if ( $oldnamespace != $newnamespace || $oldtitle != $newtitle ) {
3827 $dbw->commit( __METHOD__ );
3846 if ( $nt->exists() ) {
3847 $moveOverRedirect =
true;
3848 $logType =
'move_redir';
3850 $moveOverRedirect =
false;
3854 if ( $createRedirect ) {
3856 $redirectContent = $contentHandler->makeRedirectContent( $nt,
3857 wfMessage(
'move-redirect-text' )->inContentLanguage()->plain() );
3861 $redirectContent =
null;
3865 $logEntry->setPerformer(
$wgUser );
3866 $logEntry->setTarget( $this );
3867 $logEntry->setComment( $reason );
3868 $logEntry->setParameters(
array(
3869 '4::target' => $nt->getPrefixedText(),
3870 '5::noredir' => $redirectContent ?
'0':
'1',
3875 $comment = $formatter->getPlainActionText();
3877 $comment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $reason;
3879 # Truncate for whole multibyte characters.
3888 if ( $moveOverRedirect ) {
3889 $newid = $nt->getArticleID();
3890 $newcontent = $newpage->getContent();
3892 # Delete the old redirect. We don't save it to history since
3893 # by definition if we've got here it's rather uninteresting.
3894 # We have to remove it so that the next step doesn't trigger
3895 # a conflict on the unique namespace+title index...
3896 $dbw->delete(
'page',
array(
'page_id' => $newid ), __METHOD__ );
3898 $newpage->doDeleteUpdates( $newid, $newcontent );
3901 # Save a null revision in the page's history notifying of the move
3903 if ( !is_object( $nullRevision ) ) {
3904 throw new MWException(
'No valid null revision produced in ' . __METHOD__ );
3907 $nullRevision->insertOn( $dbw );
3909 # Change the name of the target page:
3910 $dbw->update(
'page',
3912 'page_namespace' => $nt->getNamespace(),
3913 'page_title' => $nt->getDBkey(),
3915 array(
'page_id' => $oldid ),
3920 if ( !$redirectContent ) {
3925 $nt->resetArticleID( $oldid );
3928 $newpage->updateRevisionOn( $dbw, $nullRevision );
3931 array( $newpage, $nullRevision, $nullRevision->getParentId(),
$wgUser ) );
3933 $newpage->doEditUpdates( $nullRevision,
$wgUser,
array(
'changed' =>
false ) );
3935 if ( !$moveOverRedirect ) {
3939 # Recreate the redirect, this time in the other direction.
3940 if ( $redirectContent ) {
3943 $newid = $redirectArticle->insertOn( $dbw );
3950 'content' => $redirectContent ) );
3951 $redirectRevision->insertOn( $dbw );
3952 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
3955 array( $redirectArticle, $redirectRevision,
false,
$wgUser ) );
3957 $redirectArticle->doEditUpdates( $redirectRevision,
$wgUser,
array(
'created' =>
true ) );
3962 $logid = $logEntry->insert();
3963 $logEntry->publish( $logid );
3978 public function moveSubpages( $nt, $auth =
true, $reason =
'', $createRedirect =
true ) {
3979 global $wgMaximumMovedPages;
3981 if ( !$this->
userCan(
'move-subpages' ) ) {
3982 return array(
'cant-move-subpages' );
3986 return array(
'namespace-nosubpages',
3990 return array(
'namespace-nosubpages',
3994 $subpages = $this->
getSubpages( $wgMaximumMovedPages + 1 );
3997 foreach ( $subpages
as $oldSubpage ) {
3999 if (
$count > $wgMaximumMovedPages ) {
4000 $retval[$oldSubpage->getPrefixedText()] =
4001 array(
'movepage-max-pages',
4002 $wgMaximumMovedPages );
4009 if ( $oldSubpage->getArticleID() == $this->
getArticleID()
4010 || $oldSubpage->getArticleID() == $nt->getArticleID()
4016 $newPageName = preg_replace(
4017 '#^' . preg_quote( $this->
getDBkey(),
'#' ) .
'#',
4019 $oldSubpage->getDBkey() );
4020 if ( $oldSubpage->isTalkPage() ) {
4021 $newNs = $nt->getTalkPage()->getNamespace();
4023 $newNs = $nt->getSubjectPage()->getNamespace();
4025 # Bug 14385: we need makeTitleSafe because the new page names may
4026 # be longer than 255 characters.
4029 $success = $oldSubpage->moveTo( $newSubpage, $auth, $reason, $createRedirect );
4031 $retval[$oldSubpage->getPrefixedText()] = $newSubpage->getPrefixedText();
4046 global $wgContentHandlerUseDB;
4051 $fields =
array(
'page_is_redirect',
'page_latest',
'page_id' );
4052 if ( $wgContentHandlerUseDB ) {
4053 $fields[] =
'page_content_model';
4056 $row = $dbw->selectRow(
'page',
4060 array(
'FOR UPDATE' )
4062 # Cache some fields we may want
4063 $this->mArticleID = $row ? intval( $row->page_id ) : 0;
4064 $this->mRedirect = $row ? (bool)$row->page_is_redirect :
false;
4065 $this->mLatestID = $row ? intval( $row->page_latest ) :
false;
4066 $this->mContentModel = $row && isset( $row->page_content_model ) ? strval( $row->page_content_model ) :
false;
4067 if ( !$this->mRedirect ) {
4070 # Does the article have a history?
4071 $row = $dbw->selectField(
array(
'page',
'revision' ),
4076 'page_latest != rev_id'
4079 array(
'FOR UPDATE' )
4081 # Return true if there was no history
4082 return ( $row ===
false );
4093 # Is it an existing file?
4094 if ( $nt->getNamespace() ==
NS_FILE ) {
4096 if (
$file->exists() ) {
4097 wfDebug( __METHOD__ .
": file exists\n" );
4101 # Is it a redirect with no history?
4102 if ( !$nt->isSingleRevRedirect() ) {
4103 wfDebug( __METHOD__ .
": not a one-rev redirect\n" );
4106 # Get the article text
4108 if ( !is_object(
$rev ) ) {
4111 $content =
$rev->getContent();
4112 # Does the redirect point to the source?
4113 # Or is it a broken self-redirect, usually caused by namespace collisions?
4114 $redirTitle = $content ? $content->getRedirectTarget() :
null;
4116 if ( $redirTitle ) {
4118 $redirTitle->getPrefixedDBkey() != $nt->getPrefixedDBkey() ) {
4119 wfDebug( __METHOD__ .
": redirect points to other page\n" );
4125 # Fail safe (not a redirect after all. strange.)
4126 wfDebug( __METHOD__ .
": failsafe: database sais " . $nt->getPrefixedDBkey() .
4127 " is a redirect, but it doesn't contain a valid redirect.\n" );
4146 if ( $titleKey === 0 ) {
4155 array(
'cl_from' => $titleKey ),
4159 if (
$res->numRows() > 0 ) {
4160 foreach (
$res as $row ) {
4179 foreach ( $parents
as $parent => $current ) {
4180 if ( array_key_exists( $parent, $children ) ) {
4181 # Circular reference
4182 $stack[$parent] =
array();
4186 $stack[$parent] = $nt->getParentCategoryTree( $children +
array( $parent => 1 ) );
4202 if ( $this->mArticleID > 0 ) {
4204 return array(
'page_id' => $this->mArticleID );
4206 return array(
'page_namespace' => $this->mNamespace,
'page_title' => $this->mDbkeyform );
4219 $revId = $db->selectField(
'revision',
'rev_id',
4222 'rev_id < ' . intval( $revId )
4225 array(
'ORDER BY' =>
'rev_id DESC' )
4228 if ( $revId ===
false ) {
4231 return intval( $revId );
4244 $revId = $db->selectField(
'revision',
'rev_id',
4247 'rev_id > ' . intval( $revId )
4250 array(
'ORDER BY' =>
'rev_id' )
4253 if ( $revId ===
false ) {
4256 return intval( $revId );
4271 array(
'rev_page' => $pageId ),
4273 array(
'ORDER BY' =>
'rev_timestamp ASC',
'LIMIT' => 1 )
4290 return $rev ?
$rev->getTimestamp() :
null;
4300 return (
bool)
$dbr->selectField(
'page',
'page_is_new', $this->
pageCond(), __METHOD__ );
4309 global $wgDeleteRevisionsLimit;
4311 if ( !$wgDeleteRevisionsLimit ) {
4316 return $revCount > $wgDeleteRevisionsLimit;
4325 if ( !$this->
exists() ) {
4329 if ( $this->mEstimateRevisions ===
null ) {
4331 $this->mEstimateRevisions =
$dbr->estimateRowCount(
'revision',
'*',
4348 if ( !( $old instanceof
Revision ) ) {
4351 if ( !( $new instanceof
Revision ) ) {
4354 if ( !$old || !$new ) {
4360 'rev_timestamp > ' .
$dbr->addQuotes(
$dbr->timestamp( $old->getTimestamp() ) ),
4361 'rev_timestamp < ' .
$dbr->addQuotes(
$dbr->timestamp( $new->getTimestamp() ) )
4363 if ( $max !==
null ) {
4364 $res =
$dbr->select(
'revision',
'1',
4367 array(
'LIMIT' => $max + 1 )
4369 return $res->numRows();
4371 return (
int)
$dbr->selectField(
'revision',
'count(*)', $conds, __METHOD__ );
4392 if ( !( $old instanceof
Revision ) ) {
4395 if ( !( $new instanceof
Revision ) ) {
4401 if ( !$old || !$new ) {
4408 if ( in_array(
'include_old',
$options ) ) {
4411 if ( in_array(
'include_new',
$options ) ) {
4414 if ( in_array(
'include_both',
$options ) ) {
4419 if ( $old->getId() === $new->getId() ) {
4420 return ( $old_cmp ===
'>' && $new_cmp ===
'<' ) ?
array() :
array( $old->getRawUserText() );
4421 } elseif ( $old->getId() === $new->getParentId() ) {
4422 if ( $old_cmp ===
'>=' && $new_cmp ===
'<=' ) {
4423 $authors[] = $old->getRawUserText();
4424 if ( $old->getRawUserText() != $new->getRawUserText() ) {
4425 $authors[] = $new->getRawUserText();
4427 } elseif ( $old_cmp ===
'>=' ) {
4428 $authors[] = $old->getRawUserText();
4429 } elseif ( $new_cmp ===
'<=' ) {
4430 $authors[] = $new->getRawUserText();
4435 $res =
$dbr->select(
'revision',
'DISTINCT rev_user_text',
4438 "rev_timestamp $old_cmp " .
$dbr->addQuotes(
$dbr->timestamp( $old->getTimestamp() ) ),
4439 "rev_timestamp $new_cmp " .
$dbr->addQuotes(
$dbr->timestamp( $new->getTimestamp() ) )
4443 foreach (
$res as $row ) {
4444 $authors[] = $row->rev_user_text;
4465 return $authors ? count( $authors ) : 0;
4537 if ( !is_null( $isKnown ) ) {
4545 switch ( $this->mNamespace ) {
4555 return $this->mDbkeyform ==
'';
4597 return $message->exists();
4616 $message =
wfMessage(
$name )->inLanguage( $lang )->useDatabase(
false );
4618 if ( $message->exists() ) {
4619 return $message->plain();
4635 $method = __METHOD__;
4638 $dbw->onTransactionIdle(
function() use ( $dbw, $conds, $method ) {
4641 array(
'page_touched' => $dbw->timestamp() ),
4673 $touched = $db->selectField(
'page',
'page_touched', $this->
pageCond(), __METHOD__ );
4690 $uid =
$user->getId();
4692 if ( array_key_exists( $uid, $this->mNotificationTimestamp ) ) {
4693 return $this->mNotificationTimestamp[$uid];
4695 if ( !$uid || !$wgShowUpdatedMarker || !
$user->isAllowed(
'viewmywatchlist' ) ) {
4696 $this->mNotificationTimestamp[$uid] =
false;
4697 return $this->mNotificationTimestamp[$uid];
4701 $this->mNotificationTimestamp =
array();
4704 $this->mNotificationTimestamp[$uid] =
$dbr->selectField(
'watchlist',
4705 'wl_notificationtimestamp',
4707 'wl_user' =>
$user->getId(),
4713 return $this->mNotificationTimestamp[$uid];
4737 if ( $namespaceKey ==
'' ) {
4738 $namespaceKey =
'main';
4741 if ( $namespaceKey ==
'file' ) {
4742 $namespaceKey =
'image';
4744 return $prepend . $namespaceKey;
4765 $where[] =
'rd_interwiki = ' .
$dbr->addQuotes(
'' ) .
' OR rd_interwiki IS NULL';
4767 if ( !is_null( $ns ) ) {
4768 $where[
'page_namespace'] = $ns;
4772 array(
'redirect',
'page' ),
4773 array(
'page_namespace',
'page_title' ),
4778 foreach (
$res as $row ) {
4790 global $wgInvalidRedirectTargets;
4793 if ( $this->
isSpecial(
'Userlogout' ) ) {
4797 foreach ( $wgInvalidRedirectTargets
as $target ) {
4821 global $wgContentNamespaces, $wgExemptFromUserRobotsControl;
4823 $bannedNamespaces = is_null( $wgExemptFromUserRobotsControl )
4824 ? $wgContentNamespaces
4825 : $wgExemptFromUserRobotsControl;
4827 return !in_array( $this->mNamespace, $bannedNamespaces );
4842 $unprefixed = $this->
getText();
4849 if ( $prefix !==
'' ) {
4850 # Separate with a line feed, so the unprefixed part is only used as
4851 # a tiebreaker when two pages have the exact same prefix.
4852 # In UCA, tab is the only character that can sort above LF
4853 # so we strip both of them from the original prefix.
4854 $prefix = strtr( $prefix,
"\n\t",
' ' );
4855 return "$prefix\n$unprefixed";
4877 if ( !$this->mPageLanguage || $this->mPageLanguage[1] !== $wgLanguageCode ) {
4882 $langObj =
wfGetLangObj( $contentHandler->getPageLanguage( $this ) );
4883 $this->mPageLanguage =
array( $langObj->getCode(), $wgLanguageCode );
4905 $variant =
$wgLang->getPreferredVariant();
4906 if (
$wgLang->getCode() !== $variant ) {
4916 $pageLang = $contentHandler->getPageViewLanguage( $this );
4933 # Optional notices on a per-namespace and per-page basis
4934 $editnotice_ns =
'editnotice-' . $this->
getNamespace();
4935 $editnotice_ns_message =
wfMessage( $editnotice_ns );
4936 if ( $editnotice_ns_message->exists() ) {
4937 $notices[$editnotice_ns] = $editnotice_ns_message->parseAsBlock();
4940 $parts = explode(
'/', $this->
getDBkey() );
4941 $editnotice_base = $editnotice_ns;
4942 while ( count( $parts ) > 0 ) {
4943 $editnotice_base .=
'-' . array_shift( $parts );
4944 $editnotice_base_msg =
wfMessage( $editnotice_base );
4945 if ( $editnotice_base_msg->exists() ) {
4946 $notices[$editnotice_base] = $editnotice_base_msg->parseAsBlock();
4950 # Even if there are no subpages in namespace, we still don't want / in MW ns.
4951 $editnoticeText = $editnotice_ns .
'-' . str_replace(
'/',
'-', $this->
getDBkey() );
4952 $editnoticeMsg =
wfMessage( $editnoticeText );
4953 if ( $editnoticeMsg->exists() ) {
4954 $notices[$editnoticeText] = $editnoticeMsg->parseAsBlock();
4958 wfRunHooks(
'TitleGetEditNotices',
array( $this, $oldid, &$notices ) );
$mInterwiki
Cascade restrictions on this page to included templates and images?
getTitleProtection()
Is this title subject to title protection? Title protection is the one applied against creation of su...
static deprecated( $func, $version, $component=false)
Logs a deprecation warning, visible if $wgDevelopmentWarnings, but only if self::$enableDeprecationWa...
canUseNoindex()
Whether the magic words INDEX and NOINDEX function for this page.
inNamespaces()
Returns true if the title is inside one of the specified namespaces.
getLocalURL( $query='', $query2=false)
Get a URL with no fragment or server name (relative URL) from a Title object.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
isSemiProtected( $action='edit')
Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionL...
isNamespaceProtected(User $user)
Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtecti...
getTalkNsText()
Get the namespace text of the talk page.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
static checkExtensionCompatibility(File $old, $new)
Checks if file extensions are compatible.
in this case you re responsible for computing and outputting the entire conflict i the difference between revisions and your text headers and sections and Diff overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
getSubpageText()
Get the lowest-level subpage name, i.e.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static subjectEquals( $ns1, $ns2)
Returns whether the specified namespaces share the same subject.
static onArticleCreate( $title)
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of ...
getNextRevisionID( $revId, $flags=0)
Get the revision ID of the next revision.
isBigDeletion()
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.
areCascadeProtectionSourcesLoaded( $getPages=true)
Determines whether cascading protection sources have already been loaded from the database.
static singleton()
Get a RepoGroup instance.
getAuthorsBetween( $old, $new, $limit, $options=array())
Get the authors between the given revisions or revision IDs.
static getFilteredRestrictionTypes( $exists=true)
Get a filtered list of all restriction types supported by this wiki.
wfMergeErrorArrays()
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
getInternalURL( $query='', $query2=false)
Get the URL form for an internal link.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getFragment()
Get the Title fragment (i.e. the bit after the #) in text form.
static isTalk( $index)
Is the given namespace a talk namespace?
static newNullRevision( $dbw, $pageId, $summary, $minor)
Create a new null-revision for insertion into a page's history.
inNamespace( $ns)
Returns true if the title is inside the specified namespace.
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
static newFromResult( $res)
isMovable()
Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable.
checkReadPermissions( $action, $user, $errors, $doExpensiveQueries, $short)
Check that the user is allowed to read this page.
$mOldRestrictions
Cascade restrictions on this page to included templates and images?
isJsSubpage()
Is this a .js subpage of a user page?
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
isWikitextPage()
Does that page contain wikitext, or it is JS, CSS or whatever?
getBacklinkCache()
Get a backlink cache object.
getPartialURL()
Get the URL-encoded form of the main part.
getTitleValue()
Get a TitleValue object representing this Title.
estimateRevisionCount()
Get the approximate revision count of this page.
countRevisionsBetween( $old, $new, $max=null)
Get the number of revisions between the given revision.
getPrefixedDBkey()
Get the prefixed database key form.
getLinksTo( $options=array(), $table='pagelinks', $prefix='pl')
Get an array of Title objects linking to this Title Also stores the IDs in the link cache.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
$mNotificationTimestamp
Cascade restrictions on this page to included templates and images?
checkActionPermissions( $action, $user, $errors, $doExpensiveQueries, $short)
Check action permissions not already checked in checkQuickPermissions.
getTalkPage()
Get a Title object associated with the talk page of this article.
static newMainPage()
Create a new Title for the Main Page.
getNotificationTimestamp( $user=null)
Get the timestamp when this page was updated since the user last saw it.
static fixUrlQueryArgs( $query, $query2=false)
Helper to fix up the get{Canonical,Full,Link,Local,Internal}URL args get{Canonical,...
fixSpecialName()
If the Title refers to a special page alias which is not the local default, resolve the alias,...
</p > ! end ! test Bare pipe character(bug 52363) !! wikitext|!! html< p >|</p > !! end !! test Bare pipe character from a template(bug 52363) !! wikitext
$mDefaultNamespace
Cascade restrictions on this page to included templates and images?
wfProfileIn( $functionname)
Begin profiling of a function.
touchLinks()
Update page_touched timestamps and send squid purge messages for pages linking to this title.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
checkPageRestrictions( $action, $user, $errors, $doExpensiveQueries, $short)
Check against page_restrictions table requirements on this page.
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
getPrefixedText()
Get the prefixed title with spaces.
getTransWikiID()
Returns the DB name of the distant wiki which owns the object.
resultToError( $errors, $result)
Add the resulting error code to the errors array.
isCssJsSubpage()
Is this a .css or .js subpage of a user page?
getLinkURL( $query='', $query2=false, $proto=PROTO_RELATIVE)
Get a URL that's the simplest URL that will be valid to link, locally, to the current Title.
getArticleID( $flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
return false if a UserGetRights hook might remove the named right $right
static escapeRegexReplacement( $string)
Escape a string to make it suitable for inclusion in a preg_replace() replacement parameter.
$mContentModel
Cascade restrictions on this page to included templates and images?
getSquidURLs()
Get a list of URLs to purge from the Squid cache when this page changes.
secureAndSplit()
Secure and split - main initialisation function for this object.
quickUserCan( $action, $user=null)
Can $user perform $action on this page? This skips potentially expensive cascading permission checks ...
checkSpecialsAndNSPermissions( $action, $user, $errors, $doExpensiveQueries, $short)
Check permissions on special pages & namespaces.
moveNoAuth(&$nt)
Move this page without authentication.
isTalkPage()
Is this a talk page of some sort?
wfReadOnly()
Check whether the wiki is in read-only mode.
static fetch( $prefix)
Fetch an Interwiki object.
static decodeCharReferencesAndNormalize( $text)
Decode any character references, numeric or named entities, in the next and normalize the resulting s...
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
escapeCanonicalURL( $query='', $query2=false)
HTML-escaped version of getCanonicalURL()
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
isExternal()
Is this Title interwiki?
loadRestrictionsFromRows( $rows, $oldFashionedRestrictions=null)
Compiles list of active page restrictions from both page table (pre 1.10) and page_restrictions table...
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
getDefaultMessageText()
Get the default message text or false if the message doesn't exist.
const CONTENT_MODEL_WIKITEXT
hasSourceText()
Does this page have source text?
$mCascadeRestriction
Cascade restrictions on this page to included templates and images?
loadFromRow( $row)
Load Title object fields from a DB row.
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
resetArticleID( $newid)
This clears some fields in this object, and clears any associated keys in the "bad links" section of ...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
setFragment( $fragment)
Set the fragment for this title.
static convertByteClassToUnicodeClass( $byteClass)
Utility method for converting a character sequence from bytes to Unicode.
you have access to all of the normal MediaWiki so you can get a DB use the cache
getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries=true, $short=false)
Can $user perform $action on this page? This is an internal function, which checks ONLY that previous...
exists()
Check if page exists.
$mHasCascadingRestrictions
Are cascading restrictions in effect on this page?
getIndexTitle()
Get title for search index.
getParentCategories()
Get categories to which this Title belongs and return an array of categories' names.
userCanRead()
Can $wgUser read this page?
$mRestrictionsLoaded
Boolean for initialisation on demand.
getNsText()
Get the namespace text.
static getLocalizedName( $name)
Returns the localized name for a given content model.
getSkinFromCssJsSubpage()
Trim down a .css or .js subpage title to get the corresponding skin name.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
checkCascadingSourcesRestrictions( $action, $user, $errors, $doExpensiveQueries, $short)
Check restrictions on cascading pages.
isCascadeProtected()
Cascading protection: Return true if cascading restrictions apply to this page, false if not.
isValidMoveTarget( $nt)
Checks if $this can be moved to a given Title.
getUserPermissionsErrors( $action, $user, $doExpensiveQueries=true, $ignoreErrors=array())
Can $user perform $action on this page?
static getDefaultModelFor(Title $title)
Returns the name of the default content model to be used for the page with the given title.
getDBkey()
Get the main part with underscores.
static nameOf( $id)
Get the prefixed DB key associated with an ID.
isSpecial( $name)
Returns true if this title resolves to the named special page.
wfStripIllegalFilenameChars( $name)
Replace all invalid characters with - Additional characters can be defined in $wgIllegalFileChars (se...
static getTitleFormatter()
B/C kludge: provide a TitleParser for use by Title.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
isMainPage()
Is this the mainpage?
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
escapeLocalURL( $query='', $query2=false)
Get an HTML-escaped version of the URL form, suitable for using in a link, without a server name or f...
getSubpage( $text)
Get the title for a subpage of the current page.
$mTitleValue
Cascade restrictions on this page to included templates and images?
getBaseTitle()
Get the base page name title, i.e.
getNamespace()
Get the namespace index, i.e.
static get(Title $title)
Create a new BacklinkCache or reuse any existing one.
static newFromRow( $row)
Make a Title object from a DB row.
isConversionTable()
Is this a conversion table for the LanguageConverter?
checkPermissionHooks( $action, $user, $errors, $doExpensiveQueries, $short)
Check various permission hooks.
isProtected( $action='')
Does the title correspond to a protected article?
flushRestrictions()
Flush the protection cache in this object and force reload from the database.
getCategorySortkey( $prefix='')
Returns the raw sort key to be used for categories, with the specified prefix.
getContentModel()
Get the page's content model id, see the CONTENT_MODEL_XXX constants.
getInterwiki()
Get the interwiki prefix.
do that in ParserLimitReportFormat instead $parser
static onArticleDelete( $title)
Clears caches when article is deleted.
static canTalk( $index)
Can this namespace ever have a talk namespace?
isValidRedirectTarget()
Check if this Title is a valid redirect target.
deleteTitleProtection()
Remove any title protection due to page existing.
__construct()
Constructor.
static isContent( $index)
Does this namespace contain content, for the purposes of calculating statistics, etc?
$mEstimateRevisions
Cascade restrictions on this page to included templates and images?
getBrokenLinksFrom()
Get an array of Title objects referring to non-existent articles linked from this page.
moveToInternal(&$nt, $reason='', $createRedirect=true)
Move page to a title which is either a redirect to the source page or nonexistent.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Class to simplify the use of log pages.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
missingPermissionError( $action, $short)
Get a description array when the user doesn't have the right to perform $action (i....
checkCSSandJSPermissions( $action, $user, $errors, $doExpensiveQueries, $short)
Check CSS/JS sub-page permissions.
static newExtraneousContext(Title $title, $request=array())
Create a new extraneous context.
$mRestrictions
Cascade restrictions on this page to included templates and images?
static duplicateEntries( $ot, $nt)
Check if the given title already is watched by the user, and if so add watches on a new title.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
getSubjectPage()
Get a title object associated with the subject page of this talk page.
Handles a simple LRU key/value map with a maximum number of entries.
wfGetLangObj( $langcode=false)
Return a Language object from $langcode.
getFullText()
Get the prefixed title with spaces, plus any fragment (part beginning with '#')
static hasSubpages( $index)
Does the namespace allow subpages?
hasFragment()
Check if a Title fragment is set.
isCssSubpage()
Is this a .css subpage of a user page?
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getRedirectsHere( $ns=null)
Get all extant redirects to this Title.
checkQuickPermissions( $action, $user, $errors, $doExpensiveQueries, $short)
Permissions checks that fail most often, and which are easiest to test.
static newFromRedirectRecurse( $text)
Extract a redirect destination from a string and return the Title, or null if the text doesn't contai...
static isMovable( $index)
Can pages in the given namespace be moved?
static exists( $name)
Check if a given name exist as a special page or as a special page alias.
when a variable name is used in a it is silently declared as a new masking the global
equals(Title $title)
Compare with another title.
$mLength
Cascade restrictions on this page to included templates and images?
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
getRootText()
Get the root page name text without a namespace, i.e.
escapeFullURL( $query='', $query2=false)
Get an HTML-escaped version of the URL form, suitable for using in a link, including the server name ...
canExist()
Is this in a namespace that allows actual pages?
Handles purging appropriate Squid URLs given a title (or titles)
checkUserBlock( $action, $user, $errors, $doExpensiveQueries, $short)
Check that the user isn't blocked from editing.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain URL
getCanonicalURL( $query='', $query2=false)
Get the URL for a canonical link, for use in things like IRC and e-mail notifications.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Class to represent a local file in the wiki's own database.
processing should stop and the error should be shown to the user * false
static singleton()
Get the signleton instance of this class.
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
static newFromRedirectArray( $text)
Extract a redirect destination from a string and return an array of Titles, or null if the text doesn...
static escapeId( $id, $options=array())
Given a value, escape it so that it can be used in an id attribute and return it.
getDefaultNamespace()
Get the default namespace index, for when there is no namespace.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
static newFromTitleValue(TitleValue $titleValue)
Create a new Title from a TitleValue.
static compare( $a, $b)
Callback for usort() to do title sorts by (namespace, title)
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
static newFromTitle( $title, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given title.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Class to invalidate the HTML cache of all the pages linking to a given title.
$mFragment
Cascade restrictions on this page to included templates and images?
getPrefixedURL()
Get a URL-encoded title (not an actual URL) including interwiki.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
__toString()
Return a string representation of this title.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
static whoIs( $id)
Get the username corresponding to a given user ID.
if(!defined( 'MEDIAWIKI')) if(!isset( $wgVersion)) $matches
countAuthorsBetween( $old, $new, $limit, $options=array())
Get the number of authors between the given revisions or revision IDs.
areRestrictionsCascading()
Returns cascading restrictions for the current article.
getLatestRevID( $flags=0)
What is the page_latest field for this page?
areRestrictionsLoaded()
Accessor for mRestrictionsLoaded.
getSubpages( $limit=-1)
Get all subpages of this page.
isSingleRevRedirect()
Checks if this page is just a one-rev redirect.
$mLatestID
Cascade restrictions on this page to included templates and images?
const GAID_FOR_UPDATE
Used to be GAID_FOR_UPDATE define.
getPageViewLanguage()
Get the language in which the content of this page is written when viewed by user.
static newFromDBkey( $key)
Create a new Title from a prefixed DB key.
getText()
Returns the title in text form, without namespace prefix or fragment.
static legalSearchChars()
isSubpage()
Is this a subpage?
getParentCategoryTree( $children=array())
Get a tree of parent categories.
hasContentModel( $id)
Convenience method for checking a title's content model name.
getRestrictionExpiry( $action)
Get the expiry time for the restriction against a given action.
$mCascadeSources
Where are the cascading restrictions coming from on this page?
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
isValidMoveOperation(&$nt, $auth=true, $reason='')
Check whether a given move operation would be valid.
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
$mPageLanguage
Cascade restrictions on this page to included templates and images?
static getLocalNameFor( $name, $subpage=false)
Get the local name for a specified canonical name.
isSubpageOf(Title $title)
Check if this title is a subpage of another title.
isLocal()
Determine whether the object refers to a page within this project.
static exists( $index)
Returns whether the specified namespace exists.
static newFromIDs( $ids)
Make an array of titles from an array of IDs.
static getMain()
Static methods.
prefix( $name)
Prefix some arbitrary text with the namespace or interwiki prefix of this object.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
getNamespaceKey( $prepend='nstab-')
Generate strings used for xml 'id' names in monobook tabs.
getEditURL()
Get the edit URL for this Title.
published in in Madrid In the first edition of the Vocabolario for was published In in Rotterdam was the Dictionnaire Universel ! html< p > The first monolingual dictionary written in a Romance language was< i > Sebastián Covarrubias</i >< i > Tesoro de la lengua castellana o published in in Madrid In the first edition of the< i > Vocabolario dell< a href="/index.php?title=Accademia_della_Crusca&action=edit&redlink=1" class="new" title="Accademia della Crusca (page does not exist)"> Accademia della Crusca</a ></i > for was published In in Rotterdam was the< i > Dictionnaire Universel</i ></p > ! end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html php< p >< i > foo</i ></p > ! html parsoid< p >< i > foo</i >< b ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! options ! wikitext foo ! html< p >< b >< i > foo</i ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< i ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< b ></b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s family</b ></i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s</b > family</i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo</i ></b >< i > s family</i ></p > !end ! test Italics and ! options ! wikitext this is about foo s family ! html< p >< i > this is about</i > foo< b > s family</b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo s</i > family</b ></p > !end ! test Italicized possessive ! wikitext The s talk page ! html< p > The< i >< a href="/wiki/Main_Page" title="Main Page"> Main Page</a ></i > s talk page</p > ! end ! test Parsoid only
getFullURL( $query='', $query2=false, $proto=PROTO_RELATIVE)
Get a real URL referring to this title, with interwiki link and fragment.
static getTitleParser()
B/C kludge: provide a TitleParser for use by Title.
isKnown()
Does this title refer to a page that can (or might) be meaningfully viewed? In particular,...
if(PHP_SAPI !='cli') $file
validateFileMoveOperation( $nt)
Check if the requested move target is a valid file move target.
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
$mRedirect
Cascade restrictions on this page to included templates and images?
userCan( $action, $user=null, $doExpensiveQueries=true)
Can $user perform $action on this page?
getFirstRevision( $flags=0)
Get the first revision of the page.
getAllRestrictions()
Accessor/initialisation for mRestrictions.
getEarliestRevTime( $flags=0)
Get the oldest revision timestamp of this page.
static isEveryoneAllowed( $right)
Check if all users have the given permission.
Represents a title within MediaWiki.
moveTo(&$nt, $auth=true, $reason='', $createRedirect=true)
Move a title to a new location.
namespace and then decline to actually register it & $namespaces
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
$mCascadingRestrictions
Cascade restrictions on this page to included templates and images?
canTalk()
Could this title have a corresponding talk page?
getCascadeProtectionSources( $getPages=true)
Cascading protection: Get the source of any cascading restrictions on this page.
getRestrictionTypes()
Returns restriction types for the current Title.
updateTitleProtection( $create_perm, $reason, $expiry)
Update the title protection status.
loadRestrictionsFromResultWrapper( $res, $oldFashionedRestrictions=null)
Loads a string into mRestrictions array.
isRedirect( $flags=0)
Is this an article that is a redirect page? Uses link cache, adding it if necessary.
static equals( $ns1, $ns2)
Returns whether the specified namespaces are the same namespace.
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
isDeleted()
Is there a version of this page in the deletion archive?
static makeName( $ns, $title, $fragment='', $interwiki='')
Make a prefixed DB key from a DB key and a namespace index.
getLinksFrom( $options=array(), $table='pagelinks', $prefix='pl')
Get an array of Title objects linked from this Title Also stores the IDs in the link cache.
static capitalize( $text, $ns=NS_MAIN)
Capitalize a text string for a title if it belongs to a namespace that capitalizes.
$mTitleProtection
Cached value for getTitleProtection (create protection)
hasSubjectNamespace( $ns)
Returns true if the title has the same subject namespace as the namespace specified.
isSpecialPage()
Returns true if this is a special page.
purgeSquid()
Purge all applicable Squid URLs.
getPreviousRevisionID( $revId, $flags=0)
Get the revision ID of the previous revision.
The TitleArray class only exists to provide the newFromResult method at pre- sent.
getPageLanguage()
Get the language in which the content of this page is written in wikitext.
const CACHE_MAX
Title::newFromText maintains a cache to avoid expensive re-normalization of commonly used titles.
getEditNotices( $oldid=0)
Get a list of rendered edit notices for this page.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getTouched( $db=null)
Get the last touched timestamp.
wfFindFile( $title, $options=array())
Find a file.
$mUserCaseDBKey
Cascade restrictions on this page to included templates and images?
static isCapitalized( $index)
Is the namespace first-letter capitalized?
isCssOrJsPage()
Could this page contain custom CSS or JavaScript for the global UI.
getFragmentForURL()
Get the fragment in URL form, including the "#" character if there is one.
$mWatched
Cascade restrictions on this page to included templates and images?
$mDbkeyform
Cascade restrictions on this page to included templates and images?
Class for creating log entries manually, for example to inject them into the database.
if(!isset( $wgVersion)) if( $wgScript===false) if( $wgLoadScript===false) if( $wgArticlePath===false) if(!empty( $wgActionPaths) &&!isset( $wgActionPaths['view'])) if( $wgStylePath===false) if( $wgLocalStylePath===false) if( $wgStyleDirectory===false) if( $wgExtensionAssetsPath===false) if( $wgLogo===false) if( $wgUploadPath===false) if( $wgUploadDirectory===false) if( $wgReadOnlyFile===false) if( $wgFileCacheDirectory===false) if( $wgDeletedDirectory===false) if(isset( $wgFileStore['deleted']['directory'])) if(isset( $wgFooterIcons['copyright']) &&isset( $wgFooterIcons['copyright']['copyright']) && $wgFooterIcons['copyright']['copyright']===array()) if(isset( $wgFooterIcons['poweredby']) &&isset( $wgFooterIcons['poweredby']['mediawiki']) && $wgFooterIcons['poweredby']['mediawiki']['src']===null) $wgNamespaceProtection[NS_MEDIAWIKI]
Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a sysadmin to set $wgName...
isAlwaysKnown()
Should links to this title be shown as potentially viewable (i.e.
isDeletedQuick()
Is there a version of this page in the deletion archive?
getSubpageUrlForm()
Get a URL-encoded form of the subpage text.
static factory( $code)
Get a cached or new language object for a given language code.
isNewPage()
Check if this is a new page.
moveSubpages( $nt, $auth=true, $reason='', $createRedirect=true)
Move this page's subpages to be subpages of $nt.
static newFromRedirect( $text)
Extract a redirect destination from a string and return the Title, or null if the text doesn't contai...
const CONTENT_MODEL_JAVASCRIPT
static getTitleInvalidRegex()
Returns a simple regex that will match on characters and sequences invalid in titles.
static legalChars()
Get a regex character class describing the legal characters in a link.
getEscapedText()
Get the HTML-escaped displayable text form.
static isWatchable( $index)
Can pages in a namespace be watched?
getTemplateLinksFrom( $options=array())
Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache.
isTrans()
Determine whether the object refers to a page within this project and is transcludable.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
getRestrictions( $action)
Accessor/initialisation for mRestrictions.
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
static getTalk( $index)
Get the talk namespace index for a given namespace.
$mNamespace
Cascade restrictions on this page to included templates and images?
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
static indexTitle( $ns, $title)
Get a string representation of a title suitable for including in a search index.
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
isContentPage()
Is this Title in a namespace which contains content? In other words, is this a content page,...
$mHasSubpage
Cascade restrictions on this page to included templates and images?
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
wfLocalFile( $title)
Get an object referring to a locally registered file.
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
invalidateCache()
Updates page_touched for this page; called from LinksUpdate.php.
getUserCaseDBKey()
Get the DB key with the initial letter case as specified by the user.
getTemplateLinksTo( $options=array())
Get an array of Title objects using this Title as a template Also stores the IDs in the link cache.
static & singleton()
Get an instance of this class.
static getSelectFields()
Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries.
hasSubpages()
Does this have subpages? (Warning, usually requires an extra DB query.)
static escapeFragmentForURL( $fragment)
Escape a text fragment, say from a link, for a URL.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
getBaseText()
Get the base page name without a namespace, i.e.
pageCond()
Get an associative array for selecting this title from the "page" table.
getText()
Get the text form (spaces not underscores) of the main part.
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
static purgeExpiredRestrictions()
Purge expired restrictions from the page_restrictions table.
$mTextform
Cascade restrictions on this page to included templates and images?
$mArticleID
Cascade restrictions on this page to included templates and images?
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
static getGroupsWithPermission( $role)
Get all the groups who have a given permission.
getSubjectNsText()
Get the namespace text of the subject (rather than talk) page.
userIsWatching()
Is $wgUser watching this page?
$mRestrictionsExpiry
When do the restrictions on this page expire?
loadRestrictions( $oldFashionedRestrictions=null)
Load restrictions from the page_restrictions table.
Represents a page (or page fragment) title within MediaWiki.
$mUrlform
Cascade restrictions on this page to included templates and images?
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes two arrays as input, and returns a CGI-style string, e.g.
$mPrefixedText
Text form including namespace/interwiki, initialised on demand.
getRootTitle()
Get the root page name title, i.e.
getLength( $flags=0)
What is the length of this page? Uses link cache, adding it if necessary.
isWatchable()
Can this title be added to a user's watchlist?