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 ) );
2269 global $wgEmailConfirmToEdit, $wgBlockDisablesLogin;
2272 if ( !$doExpensiveQueries || in_array( $action,
array(
'createaccount',
'unblock' ) ) ) {
2277 if ( $action ===
'read' && !$wgBlockDisablesLogin ) {
2282 if ( $wgEmailConfirmToEdit && !
$user->isEmailConfirmed() ) {
2283 $errors[] =
array(
'confirmedittext' );
2286 if ( ( $action ==
'edit' || $action ==
'create' ) && !
$user->isBlockedFrom( $this ) ) {
2289 } elseif (
$user->isBlocked() &&
$user->mBlock->prevents( $action ) !==
false ) {
2309 global $wgWhitelistRead, $wgWhitelistReadRegexp;
2311 $whitelisted =
false;
2313 # Shortcut for public wikis, allows skipping quite a bit of code
2314 $whitelisted =
true;
2315 } elseif (
$user->isAllowed(
'read' ) ) {
2316 # If the user is allowed to read pages, he is allowed to read all pages
2317 $whitelisted =
true;
2318 } elseif ( $this->
isSpecial(
'Userlogin' )
2322 # Always grant access to the login page.
2323 # Even anons need to be able to log in.
2324 $whitelisted =
true;
2325 } elseif ( is_array( $wgWhitelistRead ) && count( $wgWhitelistRead ) ) {
2326 # Time to check the whitelist
2327 # Only do these checks is there's something to check against
2332 if ( in_array(
$name, $wgWhitelistRead,
true ) || in_array( $dbName, $wgWhitelistRead,
true ) ) {
2333 $whitelisted =
true;
2335 # Old settings might have the title prefixed with
2336 # a colon for main-namespace pages
2337 if ( in_array(
':' .
$name, $wgWhitelistRead ) ) {
2338 $whitelisted =
true;
2341 # If it's a special page, ditch the subpage bit and check again
2346 if ( in_array( $pure, $wgWhitelistRead,
true ) ) {
2347 $whitelisted =
true;
2353 if ( !$whitelisted && is_array( $wgWhitelistReadRegexp ) && !empty( $wgWhitelistReadRegexp ) ) {
2356 foreach ( $wgWhitelistReadRegexp
as $listItem ) {
2357 if ( preg_match( $listItem,
$name ) ) {
2358 $whitelisted =
true;
2364 if ( !$whitelisted ) {
2365 # If the title is not whitelisted, give extensions a chance to do so...
2367 if ( !$whitelisted ) {
2386 return array(
'badaccess-group0' );
2389 $groups = array_map(
array(
'User',
'makeGroupLinkWiki' ),
2392 if ( count( $groups ) ) {
2396 $wgLang->commaList( $groups ),
2400 return array(
'badaccess-group0' );
2418 # Read has special handling
2419 if ( $action ==
'read' ) {
2421 'checkPermissionHooks',
2422 'checkReadPermissions',
2427 'checkQuickPermissions',
2428 'checkPermissionHooks',
2429 'checkSpecialsAndNSPermissions',
2430 'checkCSSandJSPermissions',
2431 'checkPageRestrictions',
2432 'checkCascadingSourcesRestrictions',
2433 'checkActionPermissions',
2439 while ( count( $checks ) > 0 &&
2440 !( $short && count( $errors ) > 0 ) ) {
2441 $method = array_shift( $checks );
2442 $errors = $this->$method( $action,
$user, $errors, $doExpensiveQueries, $short );
2457 global $wgRestrictionTypes;
2458 $types = $wgRestrictionTypes;
2460 # Remove the create restriction for existing titles
2461 $types = array_diff( $types,
array(
'create' ) );
2463 # Only the create and upload restrictions apply to non-existing titles
2464 $types = array_intersect( $types,
array(
'create',
'upload' ) );
2482 # Remove the upload restriction for non-file titles
2483 $types = array_diff( $types,
array(
'upload' ) );
2488 wfDebug( __METHOD__ .
': applicable restrictions to [[' .
2489 $this->
getPrefixedText() .
']] are {' . implode(
',', $types ) .
"}\n" );
2512 if ( !isset( $this->mTitleProtection ) ) {
2516 array(
'pt_user',
'pt_reason',
'pt_expiry',
'pt_create_perm' ),
2522 $this->mTitleProtection =
$dbr->fetchRow(
$res );
2542 $expiry =
array(
'create' => $expiry );
2546 $status = $page->doUpdateRestrictions(
$limit, $expiry, $cascade, $reason,
$wgUser );
2548 return $status->isOK();
2562 $this->mTitleProtection =
false;
2573 global $wgSemiprotectedRestrictionLevels;
2576 $semi = $wgSemiprotectedRestrictionLevels;
2577 if ( !$restrictions || !$semi ) {
2583 foreach ( array_keys( $semi,
'autoconfirmed' )
as $key ) {
2584 $semi[$key] =
'editsemiprotected';
2586 foreach ( array_keys( $restrictions,
'autoconfirmed' )
as $key ) {
2587 $restrictions[$key] =
'editsemiprotected';
2590 return !array_diff( $restrictions, $semi );
2601 global $wgRestrictionLevels;
2605 # Special pages have inherent protection
2610 # Check regular protection levels
2611 foreach ( $restrictionTypes
as $type ) {
2612 if ( $action ==
$type || $action ==
'' ) {
2614 foreach ( $wgRestrictionLevels
as $level ) {
2615 if ( in_array( $level, $r ) && $level !=
'' ) {
2652 return ( $sources > 0 );
2665 return $getPages ? isset( $this->mCascadeSources ) : isset( $this->mHasCascadingRestrictions );
2680 $pagerestrictions =
array();
2682 if ( isset( $this->mCascadeSources ) && $getPages ) {
2683 return array( $this->mCascadeSources, $this->mCascadingRestrictions );
2684 } elseif ( isset( $this->mHasCascadingRestrictions ) && !$getPages ) {
2685 return array( $this->mHasCascadingRestrictions, $pagerestrictions );
2694 $where_clauses =
array(
2700 $tables =
array(
'templatelinks',
'page_restrictions' );
2701 $where_clauses =
array(
2710 $cols =
array(
'pr_page',
'page_namespace',
'page_title',
2711 'pr_expiry',
'pr_type',
'pr_level' );
2712 $where_clauses[] =
'page_id=pr_page';
2715 $cols =
array(
'pr_expiry' );
2720 $sources = $getPages ?
array() :
false;
2722 $purgeExpired =
false;
2724 foreach (
$res as $row ) {
2726 if ( $expiry > $now ) {
2728 $page_id = $row->pr_page;
2729 $page_ns = $row->page_namespace;
2730 $page_title = $row->page_title;
2732 # Add groups needed for each restriction type if its not already there
2733 # Make sure this restriction type still exists
2735 if ( !isset( $pagerestrictions[$row->pr_type] ) ) {
2736 $pagerestrictions[$row->pr_type] =
array();
2740 isset( $pagerestrictions[$row->pr_type] )
2741 && !in_array( $row->pr_level, $pagerestrictions[$row->pr_type] )
2743 $pagerestrictions[$row->pr_type][] = $row->pr_level;
2750 $purgeExpired =
true;
2753 if ( $purgeExpired ) {
2758 $this->mCascadeSources = $sources;
2759 $this->mCascadingRestrictions = $pagerestrictions;
2761 $this->mHasCascadingRestrictions = $sources;
2765 return array( $sources, $pagerestrictions );
2786 if ( !$this->mRestrictionsLoaded ) {
2789 return isset( $this->mRestrictions[$action] )
2790 ? $this->mRestrictions[$action]
2803 if ( !$this->mRestrictionsLoaded ) {
2817 if ( !$this->mRestrictionsLoaded ) {
2820 return isset( $this->mRestrictionsExpiry[$action] ) ? $this->mRestrictionsExpiry[$action] :
false;
2829 if ( !$this->mRestrictionsLoaded ) {
2846 foreach (
$res as $row ) {
2868 foreach ( $restrictionTypes
as $type ) {
2873 $this->mCascadeRestriction =
false;
2875 # Backwards-compatibility: also load the restrictions from the page record (old format).
2877 if ( $oldFashionedRestrictions ===
null ) {
2878 $oldFashionedRestrictions =
$dbr->selectField(
'page',
'page_restrictions',
2882 if ( $oldFashionedRestrictions !=
'' ) {
2884 foreach ( explode(
':', trim( $oldFashionedRestrictions ) )
as $restrict ) {
2885 $temp = explode(
'=', trim( $restrict ) );
2886 if ( count( $temp ) == 1 ) {
2888 $this->mRestrictions[
'edit'] = explode(
',', trim( $temp[0] ) );
2889 $this->mRestrictions[
'move'] = explode(
',', trim( $temp[0] ) );
2891 $restriction = trim( $temp[1] );
2892 if ( $restriction !=
'' ) {
2893 $this->mRestrictions[$temp[0]] = explode(
',', $restriction );
2898 $this->mOldRestrictions =
true;
2902 if ( count( $rows ) ) {
2903 # Current system - load second to make them override.
2905 $purgeExpired =
false;
2907 # Cycle through all the restrictions.
2908 foreach ( $rows
as $row ) {
2911 if ( !in_array( $row->pr_type, $restrictionTypes ) ) {
2920 if ( !$expiry || $expiry > $now ) {
2921 $this->mRestrictionsExpiry[$row->pr_type] = $expiry;
2922 $this->mRestrictions[$row->pr_type] = explode(
',', trim( $row->pr_level ) );
2924 $this->mCascadeRestriction |= $row->pr_cascade;
2927 $purgeExpired =
true;
2931 if ( $purgeExpired ) {
2936 $this->mRestrictionsLoaded =
true;
2947 if ( !$this->mRestrictionsLoaded ) {
2952 'page_restrictions',
2953 array(
'pr_type',
'pr_expiry',
'pr_level',
'pr_cascade' ),
2962 if ( $title_protection ) {
2964 $expiry =
$wgContLang->formatExpiry( $title_protection[
'pt_expiry'],
TS_MW );
2966 if ( !$expiry || $expiry > $now ) {
2968 $this->mRestrictionsExpiry[
'create'] = $expiry;
2969 $this->mRestrictions[
'create'] = explode(
',', trim( $title_protection[
'pt_create_perm'] ) );
2972 $this->mTitleProtection =
false;
2975 $this->mRestrictionsExpiry[
'create'] =
$wgContLang->formatExpiry(
'',
TS_MW );
2977 $this->mRestrictionsLoaded =
true;
2987 $this->mRestrictionsLoaded =
false;
2988 $this->mTitleProtection =
null;
2999 $method = __METHOD__;
3001 $dbw->onTransactionIdle(
function() use ( $dbw, $method ) {
3003 'page_restrictions',
3004 array(
'pr_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ),
3009 array(
'pt_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ),
3026 # We dynamically add a member variable for the purpose of this method
3027 # alone to cache the result. There's no point in having it hanging
3028 # around uninitialized in every Title object; therefore we only add it
3029 # if needed and don't declare it statically.
3030 if ( !isset( $this->mHasSubpages ) ) {
3031 $this->mHasSubpages =
false;
3034 $this->mHasSubpages = (bool)$subpages->count();
3038 return $this->mHasSubpages;
3055 $conds[] =
'page_title ' .
$dbr->buildLike( $this->
getDBkey() .
'/',
$dbr->anyString() );
3061 $dbr->select(
'page',
3062 array(
'page_id',
'page_namespace',
'page_title',
'page_is_redirect' ),
3068 return $this->mSubpages;
3082 $n =
$dbr->selectField(
'archive',
'COUNT(*)',
3087 $n +=
$dbr->selectField(
'filearchive',
'COUNT(*)',
3106 $deleted = (bool)
$dbr->selectField(
'archive',
'1',
3111 $deleted = (bool)
$dbr->selectField(
'filearchive',
'1',
3129 $this->mArticleID = 0;
3133 if (
$flags & self::GAID_FOR_UPDATE ) {
3134 $oldUpdate = $linkCache->forUpdate(
true );
3135 $linkCache->clearLink( $this );
3136 $this->mArticleID = $linkCache->addLinkObj( $this );
3137 $linkCache->forUpdate( $oldUpdate );
3139 if ( -1 == $this->mArticleID ) {
3140 $this->mArticleID = $linkCache->addLinkObj( $this );
3154 if ( !is_null( $this->mRedirect ) ) {
3157 # Calling getArticleID() loads the field from cache as needed
3159 $this->mRedirect =
false;
3164 $cached = $linkCache->getGoodLinkFieldObj( $this,
'redirect' );
3165 if ( $cached ===
null ) {
3166 # Trust LinkCache's state over our own
3167 # LinkCache is telling us that the page doesn't exist, despite there being cached
3168 # data relating to an existing page in $this->mArticleID. Updaters should clear
3169 # LinkCache as appropriate, or use $flags = Title::GAID_FOR_UPDATE. If that flag is
3170 # set, then LinkCache will definitely be up to date here, since getArticleID() forces
3171 # LinkCache to refresh its data from the master.
3172 $this->mRedirect =
false;
3176 $this->mRedirect = (bool)$cached;
3189 if ( $this->mLength != -1 ) {
3192 # Calling getArticleID() loads the field from cache as needed
3198 $cached = $linkCache->getGoodLinkFieldObj( $this,
'length' );
3199 if ( $cached ===
null ) {
3200 # Trust LinkCache's state over our own, as for isRedirect()
3205 $this->mLength = intval( $cached );
3218 return intval( $this->mLatestID );
3220 # Calling getArticleID() loads the field from cache as needed
3222 $this->mLatestID = 0;
3226 $linkCache->addLinkObj( $this );
3227 $cached = $linkCache->getGoodLinkFieldObj( $this,
'revision' );
3228 if ( $cached ===
null ) {
3229 # Trust LinkCache's state over our own, as for isRedirect()
3230 $this->mLatestID = 0;
3234 $this->mLatestID = intval( $cached );
3251 $linkCache->clearLink( $this );
3253 if ( $newid ===
false ) {
3254 $this->mArticleID = -1;
3256 $this->mArticleID = intval( $newid );
3258 $this->mRestrictionsLoaded =
false;
3259 $this->mRestrictions =
array();
3260 $this->mRedirect =
null;
3261 $this->mLength = -1;
3262 $this->mLatestID =
false;
3263 $this->mContentModel =
false;
3264 $this->mEstimateRevisions =
null;
3265 $this->mPageLanguage =
false;
3298 $this->mInterwiki =
'';
3299 $this->mFragment =
'';
3316 $this->mInterwiki = $parts[
'interwiki'];
3317 $this->mNamespace = $parts[
'namespace'];
3318 $this->mUserCaseDBKey = $parts[
'user_case_dbkey'];
3320 $this->mDbkeyform = $parts[
'dbkey'];
3321 $this->mUrlform =
wfUrlencode( $this->mDbkeyform );
3322 $this->mTextform = str_replace(
'_',
' ', $this->mDbkeyform );
3324 # We already know that some pages won't be in the database!
3326 $this->mArticleID = 0;
3352 array(
'page', $table ),
3353 self::getSelectFields(),
3355 "{$prefix}_from=page_id",
3357 "{$prefix}_title" => $this->
getDBkey() ),
3363 if (
$res->numRows() ) {
3365 foreach (
$res as $row ) {
3368 $linkCache->addGoodLinkObjFromRow( $titleObj, $row );
3369 $retVal[] = $titleObj;
3403 global $wgContentHandlerUseDB;
3407 # If the page doesn't exist; there can't be any link from this page
3418 $namespaceFiled =
"{$prefix}_namespace";
3419 $titleField =
"{$prefix}_title";
3421 $fields =
array( $namespaceFiled, $titleField,
'page_id',
'page_len',
'page_is_redirect',
'page_latest' );
3422 if ( $wgContentHandlerUseDB ) {
3423 $fields[] =
'page_content_model';
3427 array( $table,
'page' ),
3429 array(
"{$prefix}_from" => $id ),
3432 array(
'page' =>
array(
'LEFT JOIN',
array(
"page_namespace=$namespaceFiled",
"page_title=$titleField" ) ) )
3436 if (
$res->numRows() ) {
3438 foreach (
$res as $row ) {
3441 if ( $row->page_id ) {
3442 $linkCache->addGoodLinkObjFromRow( $titleObj, $row );
3444 $linkCache->addBadLinkObj( $titleObj );
3446 $retVal[] = $titleObj;
3475 # All links from article ID 0 are false positives
3481 array(
'page',
'pagelinks' ),
3482 array(
'pl_namespace',
'pl_title' ),
3485 'page_namespace IS NULL'
3487 __METHOD__,
array(),
3491 array(
'pl_namespace=page_namespace',
'pl_title=page_title' )
3497 foreach (
$res as $row ) {
3516 if ( $pageLang->hasVariants() ) {
3517 $variants = $pageLang->getVariants();
3518 foreach ( $variants
as $vCode ) {
3525 $urls[] = $this->getInternalUrl(
'action=raw&ctype=text/javascript' );
3527 $urls[] = $this->getInternalUrl(
'action=raw&ctype=text/css' );
3539 if ( $wgUseSquid ) {
3553 return $this->
moveTo( $nt,
false );
3575 if ( $this->
equals( $nt ) ) {
3576 $errors[] =
array(
'selfmove' );
3579 $errors[] =
array(
'immobile-source-namespace', $this->
getNsText() );
3581 if ( $nt->isExternal() ) {
3582 $errors[] =
array(
'immobile-target-namespace-iw' );
3584 if ( !$nt->isMovable() ) {
3585 $errors[] =
array(
'immobile-target-namespace', $nt->getNsText() );
3589 $newid = $nt->getArticleID();
3591 if ( strlen( $nt->getDBkey() ) < 1 ) {
3592 $errors[] =
array(
'articleexists' );
3597 ( $nt->getDBkey() ==
'' )
3599 $errors[] =
array(
'badarticleerror' );
3603 if ( !$wgContentHandlerUseDB &&
3619 $errors[] =
array(
'nonfile-cannot-move-to-file' );
3626 $nt->getUserPermissionsErrors(
'move-target',
$wgUser ),
3627 $nt->getUserPermissionsErrors(
'edit',
$wgUser ) );
3630 $match = EditPage::matchSummarySpamRegex( $reason );
3631 if ( $match !==
false ) {
3633 $errors[] =
array(
'spamprotectiontext' );
3638 $errors[] =
array(
'hookaborted', $err );
3641 # The move is allowed only if (1) the target doesn't exist, or
3642 # (2) the target is a redirect to the source, and has no history
3643 # (so we can undo bad moves right after they're done).
3645 if ( 0 != $newid ) { # Target
exists;
check for validity
3647 $errors[] =
array(
'articleexists' );
3650 $tp = $nt->getTitleProtection();
3651 $right = $tp[
'pt_create_perm'];
3652 if (
$right ==
'sysop' ) {
3653 $right =
'editprotected';
3655 if (
$right ==
'autoconfirmed' ) {
3656 $right =
'editsemiprotected';
3659 $errors[] =
array(
'cantmove-titleprotected' );
3662 if ( empty( $errors ) ) {
3681 if (
$file->exists() ) {
3683 $errors[] =
array(
'imageinvalidfilename' );
3686 $errors[] =
array(
'imagetypemismatch' );
3690 if ( $nt->getNamespace() !=
NS_FILE ) {
3691 $errors[] =
array(
'imagenocrossnamespace' );
3700 if ( !
$wgUser->isAllowed(
'reupload-shared' ) && !$destFile->exists() &&
wfFindFile( $nt ) ) {
3701 $errors[] =
array(
'file-exists-sharedrepo' );
3718 public function moveTo( &$nt, $auth =
true, $reason =
'', $createRedirect =
true ) {
3721 if ( is_array( $err ) ) {
3723 $wgUser->spreadAnyEditBlock();
3727 if ( $auth && !
$wgUser->isAllowed(
'suppressredirect' ) ) {
3728 $createRedirect =
true;
3738 if (
$file->exists() ) {
3739 $status =
$file->move( $nt );
3740 if ( !$status->isOk() ) {
3741 return $status->getErrorsArray();
3749 $dbw->begin( __METHOD__ ); # If
$file was a
LocalFile, its transaction would have closed our own.
3750 $pageid = $this->
getArticleID( self::GAID_FOR_UPDATE );
3758 $prefixes = $dbw->select(
3760 array(
'cl_sortkey_prefix',
'cl_to' ),
3761 array(
'cl_from' => $pageid ),
3764 foreach ( $prefixes
as $prefixRow ) {
3765 $prefix = $prefixRow->cl_sortkey_prefix;
3766 $catTo = $prefixRow->cl_to;
3767 $dbw->update(
'categorylinks',
3770 $nt->getCategorySortkey( $prefix ) ),
3771 'cl_timestamp=cl_timestamp' ),
3773 'cl_from' => $pageid,
3774 'cl_to' => $catTo ),
3782 # Protect the redirect title as the title used to be...
3783 $dbw->insertSelect(
'page_restrictions',
'page_restrictions',
3785 'pr_page' => $redirid,
3786 'pr_type' =>
'pr_type',
3787 'pr_level' =>
'pr_level',
3788 'pr_cascade' =>
'pr_cascade',
3789 'pr_user' =>
'pr_user',
3790 'pr_expiry' =>
'pr_expiry'
3792 array(
'pr_page' => $pageid ),
3796 # Update the protection log
3797 $log =
new LogPage(
'protect' );
3801 $nt->getPrefixedText()
3802 )->inContentLanguage()->text();
3804 $comment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $reason;
3810 $insertedPrIds = $dbw->select(
3811 'page_restrictions',
3813 array(
'pr_page' => $redirid ),
3816 $logRelationsValues =
array();
3817 foreach ( $insertedPrIds
as $prid ) {
3818 $logRelationsValues[] = $prid->pr_id;
3820 $log->addRelations(
'pr_id', $logRelationsValues, $logId );
3827 $newtitle = $nt->getDBkey();
3829 if ( $oldnamespace != $newnamespace || $oldtitle != $newtitle ) {
3833 $dbw->commit( __METHOD__ );
3852 if ( $nt->exists() ) {
3853 $moveOverRedirect =
true;
3854 $logType =
'move_redir';
3856 $moveOverRedirect =
false;
3860 if ( $createRedirect ) {
3862 $redirectContent = $contentHandler->makeRedirectContent( $nt,
3863 wfMessage(
'move-redirect-text' )->inContentLanguage()->plain() );
3867 $redirectContent =
null;
3871 $logEntry->setPerformer(
$wgUser );
3872 $logEntry->setTarget( $this );
3873 $logEntry->setComment( $reason );
3874 $logEntry->setParameters(
array(
3875 '4::target' => $nt->getPrefixedText(),
3876 '5::noredir' => $redirectContent ?
'0':
'1',
3881 $comment = $formatter->getPlainActionText();
3883 $comment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $reason;
3885 # Truncate for whole multibyte characters.
3894 if ( $moveOverRedirect ) {
3895 $newid = $nt->getArticleID();
3896 $newcontent = $newpage->getContent();
3898 # Delete the old redirect. We don't save it to history since
3899 # by definition if we've got here it's rather uninteresting.
3900 # We have to remove it so that the next step doesn't trigger
3901 # a conflict on the unique namespace+title index...
3902 $dbw->delete(
'page',
array(
'page_id' => $newid ), __METHOD__ );
3904 $newpage->doDeleteUpdates( $newid, $newcontent );
3907 # Save a null revision in the page's history notifying of the move
3909 if ( !is_object( $nullRevision ) ) {
3910 throw new MWException(
'No valid null revision produced in ' . __METHOD__ );
3913 $nullRevision->insertOn( $dbw );
3915 # Change the name of the target page:
3916 $dbw->update(
'page',
3918 'page_namespace' => $nt->getNamespace(),
3919 'page_title' => $nt->getDBkey(),
3921 array(
'page_id' => $oldid ),
3926 if ( !$redirectContent ) {
3931 $nt->resetArticleID( $oldid );
3934 $newpage->updateRevisionOn( $dbw, $nullRevision );
3937 array( $newpage, $nullRevision, $nullRevision->getParentId(),
$wgUser ) );
3939 $newpage->doEditUpdates( $nullRevision,
$wgUser,
array(
'changed' =>
false ) );
3941 if ( !$moveOverRedirect ) {
3945 # Recreate the redirect, this time in the other direction.
3946 if ( $redirectContent ) {
3949 $newid = $redirectArticle->insertOn( $dbw );
3956 'content' => $redirectContent ) );
3957 $redirectRevision->insertOn( $dbw );
3958 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
3961 array( $redirectArticle, $redirectRevision,
false,
$wgUser ) );
3963 $redirectArticle->doEditUpdates( $redirectRevision,
$wgUser,
array(
'created' =>
true ) );
3968 $logid = $logEntry->insert();
3969 $logEntry->publish( $logid );
3984 public function moveSubpages( $nt, $auth =
true, $reason =
'', $createRedirect =
true ) {
3985 global $wgMaximumMovedPages;
3987 if ( !$this->
userCan(
'move-subpages' ) ) {
3988 return array(
'cant-move-subpages' );
3992 return array(
'namespace-nosubpages',
3996 return array(
'namespace-nosubpages',
4000 $subpages = $this->
getSubpages( $wgMaximumMovedPages + 1 );
4003 foreach ( $subpages
as $oldSubpage ) {
4005 if (
$count > $wgMaximumMovedPages ) {
4006 $retval[$oldSubpage->getPrefixedText()] =
4007 array(
'movepage-max-pages',
4008 $wgMaximumMovedPages );
4015 if ( $oldSubpage->getArticleID() == $this->
getArticleID()
4016 || $oldSubpage->getArticleID() == $nt->getArticleID()
4022 $newPageName = preg_replace(
4023 '#^' . preg_quote( $this->
getDBkey(),
'#' ) .
'#',
4025 $oldSubpage->getDBkey() );
4026 if ( $oldSubpage->isTalkPage() ) {
4027 $newNs = $nt->getTalkPage()->getNamespace();
4029 $newNs = $nt->getSubjectPage()->getNamespace();
4031 # Bug 14385: we need makeTitleSafe because the new page names may
4032 # be longer than 255 characters.
4035 $success = $oldSubpage->moveTo( $newSubpage, $auth, $reason, $createRedirect );
4037 $retval[$oldSubpage->getPrefixedText()] = $newSubpage->getPrefixedText();
4052 global $wgContentHandlerUseDB;
4057 $fields =
array(
'page_is_redirect',
'page_latest',
'page_id' );
4058 if ( $wgContentHandlerUseDB ) {
4059 $fields[] =
'page_content_model';
4062 $row = $dbw->selectRow(
'page',
4066 array(
'FOR UPDATE' )
4068 # Cache some fields we may want
4069 $this->mArticleID = $row ? intval( $row->page_id ) : 0;
4070 $this->mRedirect = $row ? (bool)$row->page_is_redirect :
false;
4071 $this->mLatestID = $row ? intval( $row->page_latest ) :
false;
4072 $this->mContentModel = $row && isset( $row->page_content_model ) ? strval( $row->page_content_model ) :
false;
4073 if ( !$this->mRedirect ) {
4076 # Does the article have a history?
4077 $row = $dbw->selectField(
array(
'page',
'revision' ),
4082 'page_latest != rev_id'
4085 array(
'FOR UPDATE' )
4087 # Return true if there was no history
4088 return ( $row ===
false );
4099 # Is it an existing file?
4100 if ( $nt->getNamespace() ==
NS_FILE ) {
4102 if (
$file->exists() ) {
4103 wfDebug( __METHOD__ .
": file exists\n" );
4107 # Is it a redirect with no history?
4108 if ( !$nt->isSingleRevRedirect() ) {
4109 wfDebug( __METHOD__ .
": not a one-rev redirect\n" );
4112 # Get the article text
4114 if ( !is_object(
$rev ) ) {
4117 $content =
$rev->getContent();
4118 # Does the redirect point to the source?
4119 # Or is it a broken self-redirect, usually caused by namespace collisions?
4120 $redirTitle = $content ? $content->getRedirectTarget() :
null;
4122 if ( $redirTitle ) {
4124 $redirTitle->getPrefixedDBkey() != $nt->getPrefixedDBkey() ) {
4125 wfDebug( __METHOD__ .
": redirect points to other page\n" );
4131 # Fail safe (not a redirect after all. strange.)
4132 wfDebug( __METHOD__ .
": failsafe: database sais " . $nt->getPrefixedDBkey() .
4133 " is a redirect, but it doesn't contain a valid redirect.\n" );
4152 if ( $titleKey === 0 ) {
4161 array(
'cl_from' => $titleKey ),
4165 if (
$res->numRows() > 0 ) {
4166 foreach (
$res as $row ) {
4185 foreach ( $parents
as $parent => $current ) {
4186 if ( array_key_exists( $parent, $children ) ) {
4187 # Circular reference
4188 $stack[$parent] =
array();
4192 $stack[$parent] = $nt->getParentCategoryTree( $children +
array( $parent => 1 ) );
4208 if ( $this->mArticleID > 0 ) {
4210 return array(
'page_id' => $this->mArticleID );
4212 return array(
'page_namespace' => $this->mNamespace,
'page_title' => $this->mDbkeyform );
4225 $revId = $db->selectField(
'revision',
'rev_id',
4228 'rev_id < ' . intval( $revId )
4231 array(
'ORDER BY' =>
'rev_id DESC' )
4234 if ( $revId ===
false ) {
4237 return intval( $revId );
4250 $revId = $db->selectField(
'revision',
'rev_id',
4253 'rev_id > ' . intval( $revId )
4256 array(
'ORDER BY' =>
'rev_id' )
4259 if ( $revId ===
false ) {
4262 return intval( $revId );
4277 array(
'rev_page' => $pageId ),
4279 array(
'ORDER BY' =>
'rev_timestamp ASC',
'LIMIT' => 1 )
4296 return $rev ?
$rev->getTimestamp() :
null;
4306 return (
bool)
$dbr->selectField(
'page',
'page_is_new', $this->
pageCond(), __METHOD__ );
4315 global $wgDeleteRevisionsLimit;
4317 if ( !$wgDeleteRevisionsLimit ) {
4322 return $revCount > $wgDeleteRevisionsLimit;
4331 if ( !$this->
exists() ) {
4335 if ( $this->mEstimateRevisions ===
null ) {
4337 $this->mEstimateRevisions =
$dbr->estimateRowCount(
'revision',
'*',
4354 if ( !( $old instanceof
Revision ) ) {
4357 if ( !( $new instanceof
Revision ) ) {
4360 if ( !$old || !$new ) {
4366 'rev_timestamp > ' .
$dbr->addQuotes(
$dbr->timestamp( $old->getTimestamp() ) ),
4367 'rev_timestamp < ' .
$dbr->addQuotes(
$dbr->timestamp( $new->getTimestamp() ) )
4369 if ( $max !==
null ) {
4370 $res =
$dbr->select(
'revision',
'1',
4373 array(
'LIMIT' => $max + 1 )
4375 return $res->numRows();
4377 return (
int)
$dbr->selectField(
'revision',
'count(*)', $conds, __METHOD__ );
4398 if ( !( $old instanceof
Revision ) ) {
4401 if ( !( $new instanceof
Revision ) ) {
4407 if ( !$old || !$new ) {
4414 if ( in_array(
'include_old',
$options ) ) {
4417 if ( in_array(
'include_new',
$options ) ) {
4420 if ( in_array(
'include_both',
$options ) ) {
4425 if ( $old->getId() === $new->getId() ) {
4426 return ( $old_cmp ===
'>' && $new_cmp ===
'<' ) ?
array() :
array( $old->getRawUserText() );
4427 } elseif ( $old->getId() === $new->getParentId() ) {
4428 if ( $old_cmp ===
'>=' && $new_cmp ===
'<=' ) {
4429 $authors[] = $old->getRawUserText();
4430 if ( $old->getRawUserText() != $new->getRawUserText() ) {
4431 $authors[] = $new->getRawUserText();
4433 } elseif ( $old_cmp ===
'>=' ) {
4434 $authors[] = $old->getRawUserText();
4435 } elseif ( $new_cmp ===
'<=' ) {
4436 $authors[] = $new->getRawUserText();
4441 $res =
$dbr->select(
'revision',
'DISTINCT rev_user_text',
4444 "rev_timestamp $old_cmp " .
$dbr->addQuotes(
$dbr->timestamp( $old->getTimestamp() ) ),
4445 "rev_timestamp $new_cmp " .
$dbr->addQuotes(
$dbr->timestamp( $new->getTimestamp() ) )
4449 foreach (
$res as $row ) {
4450 $authors[] = $row->rev_user_text;
4471 return $authors ? count( $authors ) : 0;
4543 if ( !is_null( $isKnown ) ) {
4551 switch ( $this->mNamespace ) {
4561 return $this->mDbkeyform ==
'';
4603 return $message->exists();
4622 $message =
wfMessage(
$name )->inLanguage( $lang )->useDatabase(
false );
4624 if ( $message->exists() ) {
4625 return $message->plain();
4641 $method = __METHOD__;
4644 $dbw->onTransactionIdle(
function() use ( $dbw, $conds, $method ) {
4647 array(
'page_touched' => $dbw->timestamp() ),
4679 $touched = $db->selectField(
'page',
'page_touched', $this->
pageCond(), __METHOD__ );
4696 $uid =
$user->getId();
4698 if ( array_key_exists( $uid, $this->mNotificationTimestamp ) ) {
4699 return $this->mNotificationTimestamp[$uid];
4701 if ( !$uid || !$wgShowUpdatedMarker || !
$user->isAllowed(
'viewmywatchlist' ) ) {
4702 $this->mNotificationTimestamp[$uid] =
false;
4703 return $this->mNotificationTimestamp[$uid];
4707 $this->mNotificationTimestamp =
array();
4710 $this->mNotificationTimestamp[$uid] =
$dbr->selectField(
'watchlist',
4711 'wl_notificationtimestamp',
4713 'wl_user' =>
$user->getId(),
4719 return $this->mNotificationTimestamp[$uid];
4743 if ( $namespaceKey ==
'' ) {
4744 $namespaceKey =
'main';
4747 if ( $namespaceKey ==
'file' ) {
4748 $namespaceKey =
'image';
4750 return $prepend . $namespaceKey;
4771 $where[] =
'rd_interwiki = ' .
$dbr->addQuotes(
'' ) .
' OR rd_interwiki IS NULL';
4773 if ( !is_null( $ns ) ) {
4774 $where[
'page_namespace'] = $ns;
4778 array(
'redirect',
'page' ),
4779 array(
'page_namespace',
'page_title' ),
4784 foreach (
$res as $row ) {
4796 global $wgInvalidRedirectTargets;
4799 if ( $this->
isSpecial(
'Userlogout' ) ) {
4803 foreach ( $wgInvalidRedirectTargets
as $target ) {
4827 global $wgContentNamespaces, $wgExemptFromUserRobotsControl;
4829 $bannedNamespaces = is_null( $wgExemptFromUserRobotsControl )
4830 ? $wgContentNamespaces
4831 : $wgExemptFromUserRobotsControl;
4833 return !in_array( $this->mNamespace, $bannedNamespaces );
4848 $unprefixed = $this->
getText();
4855 if ( $prefix !==
'' ) {
4856 # Separate with a line feed, so the unprefixed part is only used as
4857 # a tiebreaker when two pages have the exact same prefix.
4858 # In UCA, tab is the only character that can sort above LF
4859 # so we strip both of them from the original prefix.
4860 $prefix = strtr( $prefix,
"\n\t",
' ' );
4861 return "$prefix\n$unprefixed";
4883 if ( !$this->mPageLanguage || $this->mPageLanguage[1] !== $wgLanguageCode ) {
4888 $langObj =
wfGetLangObj( $contentHandler->getPageLanguage( $this ) );
4889 $this->mPageLanguage =
array( $langObj->getCode(), $wgLanguageCode );
4911 $variant =
$wgLang->getPreferredVariant();
4912 if (
$wgLang->getCode() !== $variant ) {
4922 $pageLang = $contentHandler->getPageViewLanguage( $this );
4939 # Optional notices on a per-namespace and per-page basis
4940 $editnotice_ns =
'editnotice-' . $this->
getNamespace();
4941 $editnotice_ns_message =
wfMessage( $editnotice_ns );
4942 if ( $editnotice_ns_message->exists() ) {
4943 $notices[$editnotice_ns] = $editnotice_ns_message->parseAsBlock();
4946 $parts = explode(
'/', $this->
getDBkey() );
4947 $editnotice_base = $editnotice_ns;
4948 while ( count( $parts ) > 0 ) {
4949 $editnotice_base .=
'-' . array_shift( $parts );
4950 $editnotice_base_msg =
wfMessage( $editnotice_base );
4951 if ( $editnotice_base_msg->exists() ) {
4952 $notices[$editnotice_base] = $editnotice_base_msg->parseAsBlock();
4956 # Even if there are no subpages in namespace, we still don't want / in MW ns.
4957 $editnoticeText = $editnotice_ns .
'-' . str_replace(
'/',
'-', $this->
getDBkey() );
4958 $editnoticeMsg =
wfMessage( $editnoticeText );
4959 if ( $editnoticeMsg->exists() ) {
4960 $notices[$editnoticeText] = $editnoticeMsg->parseAsBlock();
4964 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?