From 8bea72e16882e1a246dd5c38f0a19b619d23c093 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 28 Aug 2010 01:18:18 +0000 Subject: [PATCH] Describe user property in ApiQueryAllimages Add userid to ApiQueryProtectedTitles bug 19195 --- includes/api/ApiQueryAllimages.php | 1 + includes/api/ApiQueryProtectedTitles.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiQueryAllimages.php b/includes/api/ApiQueryAllimages.php index 1c65536017..951854b72c 100644 --- a/includes/api/ApiQueryAllimages.php +++ b/includes/api/ApiQueryAllimages.php @@ -200,6 +200,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase { 'Which properties to get', ' timestamp - Adds the timestamp when the image was upload', ' user - Adds the username of the last uploader', + ' userid - Adds the user id of the last uploader', ' comment - Adds the comment of the last upload', ' url - Adds the URL of the image and its description page', ' size - Adds the size of the image in bytes and its height and width', diff --git a/includes/api/ApiQueryProtectedTitles.php b/includes/api/ApiQueryProtectedTitles.php index d247827ce4..d2d2b869b8 100644 --- a/includes/api/ApiQueryProtectedTitles.php +++ b/includes/api/ApiQueryProtectedTitles.php @@ -55,7 +55,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { $this->addFields( array( 'pt_namespace', 'pt_title', 'pt_timestamp' ) ); $prop = array_flip( $params['prop'] ); - $this->addFieldsIf( 'pt_user', isset( $prop['user'] ) ); + $this->addFieldsIf( 'pt_user', isset( $prop['user'] ) || isset( $prop['userid'] ) ); $this->addFieldsIf( 'pt_reason', isset( $prop['comment'] ) || isset( $prop['parsedcomment'] ) ); $this->addFieldsIf( 'pt_expiry', isset( $prop['expiry'] ) ); $this->addFieldsIf( 'pt_create_perm', isset( $prop['level'] ) ); @@ -96,6 +96,10 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { $vals['user'] = $row->user_name; } + if ( isset( $prop['user'] ) ) { + $vals['userid'] = $row->pt_user; + } + if ( isset( $prop['comment'] ) ) { $vals['comment'] = $row->pt_reason; } @@ -177,6 +181,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { ApiBase::PARAM_TYPE => array( 'timestamp', 'user', + 'userid', 'comment', 'parsedcomment', 'expiry', @@ -197,6 +202,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { 'Which properties to get', ' timestamp - Adds the timestamp of when protection was added', ' user - Adds the user to add the protection', + ' userid - Adds the user id to add the protection', ' comment - Adds the comment for the protection', ' parsedcomment - Adds the parsed comment for the protection', ' expiry - Adds the timestamp of when the protection will be lifted', -- 2.20.1