define ( 'GAID_FOR_UPDATE', 1 );
-/**
- * Title::newFromText maintains a cache to avoid expensive re-normalization of
- * commonly used titles. On a batch operation this can become a memory leak
- * if not bounded. After hitting this many titles reset the cache.
- */
-define( 'MW_TITLECACHE_MAX', 1000 );
/**
* Constants for pr_cascade bitfield
static private $interwikiCache=array();
//@}
+ /**
+ * Title::newFromText maintains a cache to avoid expensive re-normalization of
+ * commonly used titles. On a batch operation this can become a memory leak
+ * if not bounded. After hitting this many titles reset the cache.
+ */
+ const CACHE_MAX = 1000;
+
+
/**
* @name Private member variables
* Please use the accessor functions instead.
static $cachedcount = 0 ;
if( $t->secureAndSplit() ) {
if( $defaultNamespace == NS_MAIN ) {
- if( $cachedcount >= MW_TITLECACHE_MAX ) {
+ if( $cachedcount >= self::CACHE_MAX ) {
# Avoid memory leaks on mass operations...
Title::$titleCache = array();
$cachedcount=0;
/**
* Make an array of titles from an array of IDs
- * @param $ids \arrayof{\int} Array of IDs
- * @return \arrayof{Title} Array of Titles
+ * @param $ids \type{\arrayof{\int}} Array of IDs
+ * @return \type{\arrayof{Title}} Array of Titles
*/
public static function newFromIDs( $ids ) {
if ( !count( $ids ) ) {
* there's a fragment but the prefixed text is empty, we just return a link
* to the fragment.
*
- * @param $query \arrayof{\string} An associative array of key => value pairs for the
+ * @param $query \type{\arrayof{\string}} An associative array of key => value pairs for the
* query string. Keys and values will be escaped.
* @param $variant \type{\string} Language variant of URL (for sr, zh..). Ignored
* for external links. Default is "false" (same variant as current page,
/**
* Can $wgUser perform $action on this page?
- * @param \type{\string} $action action that permission needs to be checked for
+ * @param $action \type{\string} action that permission needs to be checked for
* @param $doExpensiveQueries \type{\bool} Set this to false to avoid doing unnecessary queries.
* @return \type{\bool}
*/
* @param $action \type{\string}action that permission needs to be checked for
* @param $user \type{User} user to check
* @param $doExpensiveQueries \type{\bool} Set this to false to avoid doing unnecessary queries.
- * @param $ignoreErrors \arrayof{\string} Set this to a list of message keys whose corresponding errors may be ignored.
+ * @param $ignoreErrors \type{\arrayof{\string}} Set this to a list of message keys whose corresponding errors may be ignored.
* @return \type{\array} Array of arrays of the arguments to wfMsg to explain permissions problems.
*/
public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true, $ignoreErrors = array() ) {
* Cascading protection: Get the source of any cascading restrictions on this page.
*
* @param $get_pages \type{\bool} Whether or not to retrieve the actual pages that the restrictions have come from.
- * @return \arrayof{mixed title array, restriction array} Array of the Title objects of the pages from
+ * @return \type{\arrayof{mixed title array, restriction array}} Array of the Title objects of the pages from
* which cascading restrictions have come, false for none, or true if such restrictions exist, but $get_pages was not set.
* The restriction array is an array of each type, each of which contains an array of unique groups.
*/
* Accessor/initialisation for mRestrictions
*
* @param $action \type{\string} action that permission needs to be checked for
- * @return \arrayof{\string} the array of groups allowed to edit this article
+ * @return \type{\arrayof{\string}} the array of groups allowed to edit this article
*/
public function getRestrictions( $action ) {
if( !$this->mRestrictionsLoaded ) {
* On heavily-used templates it will max out the memory.
*
* @param $options \type{\string} may be FOR UPDATE
- * @return \arrayof{Title} the Title objects linking here
+ * @return \type{\arrayof{Title}} the Title objects linking here
*/
public function getLinksTo( $options = '', $table = 'pagelinks', $prefix = 'pl' ) {
$linkCache = LinkCache::singleton();
* On heavily-used templates it will max out the memory.
*
* @param $options \type{\string} may be FOR UPDATE
- * @return \arrayof{Title} the Title objects linking here
+ * @return \type{\arrayof{Title}} the Title objects linking here
*/
public function getTemplateLinksTo( $options = '' ) {
return $this->getLinksTo( $options, 'templatelinks', 'tl' );
*
* @todo check if needed (used only in SpecialBrokenRedirects.php, and should use redirect table in this case)
* @param $options \type{\string} may be FOR UPDATE
- * @return \arrayof{Title} the Title objects
+ * @return \type{\arrayof{Title}} the Title objects
*/
public function getBrokenLinksFrom( $options = '' ) {
if ( $this->getArticleId() == 0 ) {
* Get a list of URLs to purge from the Squid cache when this
* page changes
*
- * @return \arrayof{\string} the URLs
+ * @return \type{\arrayof{\string}} the URLs
*/
public function getSquidURLs() {
global $wgContLang;
$nt->getUserPermissionsErrors('edit', $wgUser));
}
+ $match = EditPage::matchSpamRegex( $reason );
+ if( $match !== false ) {
+ // This is kind of lame, won't display nice
+ $errors[] = array('spamprotectiontext');
+ }
+
global $wgUser;
$err = null;
if( !wfRunHooks( 'AbortMove', array( $this, $nt, $wgUser, &$err, $reason ) ) ) {
$fname = 'MovePageForm::moveToNewTitle';
$comment = wfMsgForContent( '1movedto2', $this->getPrefixedText(), $nt->getPrefixedText() );
if ( $reason ) {
- $comment .= ": $reason";
+ $comment .= wfMsgExt( 'colon-separator',
+ array( 'escapenoentities', 'content' ) );
+ $comment .= $reason;
}
$newid = $nt->getArticleID();
/**
* Get the last touched timestamp
+ * @param Database $db, optional db
* @return \type{\string} Last touched timestamp
*/
- public function getTouched() {
- $dbr = wfGetDB( DB_SLAVE );
- $touched = $dbr->selectField( 'page', 'page_touched',
+ public function getTouched( $db = NULL ) {
+ $db = isset($db) ? $db : wfGetDB( DB_SLAVE );
+ $touched = $db->selectField( 'page', 'page_touched',
array(
'page_namespace' => $this->getNamespace(),
'page_title' => $this->getDBkey()
*
* @param $ns \twotypes{\int,\null} Single namespace to consider;
* NULL to consider all namespaces
- * @return \arrayof{Title} Redirects to this title
+ * @return \type{\arrayof{Title}} Redirects to this title
*/
public function getRedirectsHere( $ns = null ) {
$redirs = array();