Special:Version
* Edit notices can now be translated.
* (bug 22887) Add warning and tracking category for preprocessor errors
+* (bug 31704) Allow selection of associated namespace on the watchlist
=== Bug fixes in 1.20 ===
* (bug 30245) Use the correct way to construct a log page title.
* (bug 32492) API now allows editing using pageid
* (bug 32497) API now allows changing of protection level using pageid
* (bug 32498) API now allows comparing pages using pageids
+* (bug 30975) API import of pages with invalid characters in this wiki leads to Fatal Error
+* (bug 30488) API now allows listing of backlinks/embeddedin/imageusage per pageid
=== Languages updated in 1.20 ===
var $mRedirect = null; // /< Is the article at this title a redirect?
var $mNotificationTimestamp = array(); // /< Associative array of user ID -> timestamp/false
var $mBacklinkCache = null; // /< Cache of links to this title
+ var $mHasSubpage; // /< Whether a page has any subpages
// @}
* fied by a prefix. If you want to force a specific namespace even if
* $text might begin with a namespace prefix, use makeTitle() or
* makeTitleSafe().
- * @return Title, or null on an error.
+ * @throws MWException
+ * @return Title|null - Title or null on an error.
*/
public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
if ( is_object( $text ) ) {
* This is MUCH simpler than individually testing for equivilance
* against both NS_USER and NS_USER_TALK, and is also forward compatible.
* @since 1.19
+ * @param $ns int
* @return bool
*/
public function hasSubjectNamespace( $ns ) {
* andthe wfArrayToCGI moved to getLocalURL();
*
* @since 1.19 (r105919)
+ * @param $query
+ * @param $query2 bool
* @return String
*/
private static function fixUrlQueryArgs( $query, $query2 = false ) {
* See getLocalURL for the arguments.
*
* @see self::getLocalURL
+ * @param $query string
+ * @param $query2 bool|string
* @return String the URL
*/
public function escapeLocalURL( $query = '', $query2 = false ) {
/**
* Get the expiry time for the restriction against a given action
*
+ * @param $action
* @return String|Bool 14-char timestamp, or 'infinity' if the page is protected forever
- * or not protected at all, or false if the action is not recognised.
+ * or not protected at all, or false if the action is not recognised.
*/
public function getRestrictionExpiry( $action ) {
if ( !$this->mRestrictionsLoaded ) {
* $wgLang (such as special pages, which are in the user language).
*
* @since 1.18
- * @return object Language
+ * @return Language
*/
public function getPageLanguage() {
global $wgLang;
* @param &$cascade Integer. Set to false if cascading protection isn't allowed.
* @param $expiry Array: per restriction type expiration
* @param $user User The user updating the restrictions
- * @return bool true on success
+ * @return Status
*/
public function doUpdateRestrictions( array $limit, array $expiry, &$cascade, $reason, User $user ) {
global $wgContLang;
/**
* @return array
*/
- public function getTitleOrPageIdErrorMessage( ) {
- return $this->getRequireOnlyOneParameterErrorMessages( array( 'title', 'pageid' ) );
+ public function getTitleOrPageIdErrorMessage() {
+ return array_merge(
+ $this->getRequireOnlyOneParameterErrorMessages( array( 'title', 'pageid' ) ),
+ array(
+ array( 'invalidtitle', 'title' ),
+ array( 'nosuchpageid', 'pageid' ),
+ )
+ );
}
/**
return array_merge( parent::getPossibleErrors(),
$this->getTitleOrPageIdErrorMessage(),
array(
- array( 'invalidtitle', 'title' ),
- array( 'nosuchpageid', 'pageid' ),
array( 'notanarticle' ),
array( 'hookaborted', 'error' ),
array( 'delete-toobig', 'limit' ),
return array_merge( parent::getPossibleErrors(),
$this->getTitleOrPageIdErrorMessage(),
array(
- array( 'nosuchpageid', 'pageid' ),
array( 'missingtext' ),
- array( 'invalidtitle', 'title' ),
array( 'createonly-exists' ),
array( 'nocreate-missing' ),
array( 'nosuchrevid', 'undo' ),
function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
// Add a result entry
$r = array();
- ApiQueryBase::addTitleInfo( $r, $title );
- $r['revisions'] = intval( $successCount );
+
+ if ( $title === null ) {\r
+ # Invalid or non-importable title
+ $r['title'] = $pageInfo['title'];
+ $r['invalid'] = '';\r
+ } else {\r
+ ApiQueryBase::addTitleInfo( $r, $title );
+ $r['revisions'] = intval( $successCount );
+ }
+
$this->mResultArr[] = $r;
// Piggyback on the parent to do the logging
return array_merge( parent::getPossibleErrors(),
$this->getTitleOrPageIdErrorMessage(),
array(
- array( 'invalidtitle', 'title' ),
- array( 'nosuchpageid', 'pageid' ),
array( 'toofewexpiries', 'noofexpiries', 'noofprotections' ),
array( 'create-titleexists' ),
array( 'missingtitle-createonly' ),
if ( !is_null( $this->params['continue'] ) ) {
$this->parseContinueParam();
} else {
- if ( $this->params['title'] !== '' ) {
- $title = Title::newFromText( $this->params['title'] );
- if ( !$title ) {
- $this->dieUsageMsg( array( 'invalidtitle', $this->params['title'] ) );
- } else {
- $this->rootTitle = $title;
- }
- }
+ $this->rootTitle = $this->getTitleOrPageId( $this->params );
}
// only image titles are allowed for the root in imageinfo mode
$retval = array(
'title' => array(
ApiBase::PARAM_TYPE => 'string',
- ApiBase::PARAM_REQUIRED => true
+ ),
+ 'pageid' => array(
+ ApiBase::PARAM_TYPE => 'integer',
),
'continue' => null,
'namespace' => array(
public function getParamDescription() {
$retval = array(
- 'title' => 'Title to search',
+ 'title' => "Title to search. Cannot be used together with {$this->bl_code}pageid",
+ 'pageid' => "Pageid to search. Cannot be used together with {$this->bl_code}title",
'continue' => 'When more results are available, use this to continue',
'namespace' => 'The namespace to enumerate',
);
}
public function getPossibleErrors() {
- return array_merge( parent::getPossibleErrors(), array(
- array( 'invalidtitle', 'title' ),
- array( 'code' => 'bad_image_title', 'info' => "The title for {$this->getModuleName()} query must be an image" ),
- array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
- ) );
+ return array_merge( parent::getPossibleErrors(),
+ $this->getTitleOrPageIdErrorMessage(),
+ array(
+ array( 'code' => 'bad_image_title', 'info' => "The title for {$this->getModuleName()} query must be an image" ),
+ array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
+ )
+ );
}
public function getExamples() {
array(
array( 'code' => 'invalidcategory', 'info' => 'The category name you entered is not valid' ),
array( 'code' => 'badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ),
- array( 'nosuchpageid', 'pageid' ),
)
);
}
$info['title'] = $titleObj->getPrefixedText();
$info['revisions'] = intval( $retval[0] );
$info['fileversions'] = intval( $retval[1] );
- $info['reason'] = intval( $retval[2] );
+ $info['reason'] = $retval[2];
$this->getResult()->addValue( null, $this->getModuleName(), $info );
}
/* bool */ 'hideOwn' => (int)$user->getBoolOption( 'watchlisthideown' ),
/* ? */ 'namespace' => 'all',
/* ? */ 'invert' => false,
+ /* bool */ 'associated' => false,
);
$this->customFilters = array();
wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ) );
# Get namespace value, if supplied, and prepare a WHERE fragment
$nameSpace = $request->getIntOrNull( 'namespace' );
- $invert = $request->getIntOrNull( 'invert' );
+ $invert = $request->getBool( 'invert' );
+ $associated = $request->getBool( 'associated' );
if ( !is_null( $nameSpace ) ) {
+ $eq_op = $invert ? '!=' : '=';\r
+ $bool_op = $invert ? 'AND' : 'OR';
$nameSpace = intval( $nameSpace ); // paranioa
- if ( $invert ) {
- $nameSpaceClause = "rc_namespace != $nameSpace";
+ if ( !$associated ) {
+ $nameSpaceClause = "rc_namespace $eq_op $nameSpace";
} else {
- $nameSpaceClause = "rc_namespace = $nameSpace";
+ $associatedNS = MWNamespace::getAssociated( $nameSpace );\r
+ $nameSpaceClause =
+ "rc_namespace $eq_op $nameSpace " .\r
+ $bool_op .\r
+ " rc_namespace $eq_op $associatedNS";
}
} else {
$nameSpace = '';
}
$values['namespace'] = $nameSpace;
$values['invert'] = $invert;
+ $values['associated'] = $associated;
if( is_null( $values['days'] ) || !is_numeric( $values['days'] ) ) {
$big = 1000; /* The magical big */
'class' => 'namespaceselector',
)
) . ' ';
- $form .= Xml::checkLabel( $this->msg( 'invert' )->text(), 'invert', 'nsinvert', $invert ) . ' ';
+ $form .= Xml::checkLabel(
+ $this->msg( 'invert' )->text(),
+ 'invert',
+ 'nsinvert',
+ $invert,
+ array( 'title' => $this->msg( 'tooltip-invert' )->text() )
+ ) . ' ';
+ $form .= Xml::checkLabel(
+ $this->msg( 'namespace_association' )->text(),
+ 'associated',
+ 'associated',
+ $associated,
+ array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
+ ) . ' ';
$form .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . '</p>';
$form .= Html::hidden( 'days', $values['days'] );
foreach ( $filters as $key => $msg ) {
function __construct() {
parent::__construct();
+ global $wgEnableEmail;
$this->users['noemail'] = new User;
$this->context = new RequestContext;
$this->context->setTitle( Title::newFromText('PreferencesTest') );
+
+ //some tests depends on email setting
+ $wgEnableEmail = true;
}
/**