More parameter documentation
[lhc/web/wiklou.git] / includes / api / ApiQueryProtectedTitles.php
index d247827..fcca490 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 /**
- * API for MediaWiki 1.8+
+ *
  *
  * Created on Feb 13, 2009
  *
- * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,6 +48,10 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
                $this->run( $resultPageSet );
        }
 
+       /**
+        * @param $resultPageSet ApiPageSet
+        * @return void
+        */
        private function run( $resultPageSet = null ) {
                $params = $this->extractRequestParams();
 
@@ -55,7 +59,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 +100,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 +185,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
                                ApiBase::PARAM_TYPE => array(
                                        'timestamp',
                                        'user',
+                                       'userid',
                                        'comment',
                                        'parsedcomment',
                                        'expiry',
@@ -197,6 +206,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',