Merge "escape HTML elements in docblock with double quotes"
[lhc/web/wiklou.git] / includes / api / ApiProtect.php
index d156468..e763fd5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Created on Sep 1, 2007
  *
- * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@gmail.com
+ * Copyright © 2007 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
@@ -56,7 +56,7 @@ class ApiProtect extends ApiBase {
                }
 
                $restrictionTypes = $titleObj->getRestrictionTypes();
-               $dbr = wfGetDB( DB_SLAVE );
+               $db = $this->getDB();
 
                $protections = array();
                $expiryarray = array();
@@ -80,7 +80,7 @@ class ApiProtect extends ApiBase {
                        }
 
                        if ( in_array( $expiry[$i], array( 'infinite', 'indefinite', 'never' ) ) ) {
-                               $expiryarray[$p[0]] = $dbr->getInfinity();
+                               $expiryarray[$p[0]] = $db->getInfinity();
                        } else {
                                $exp = strtotime( $expiry[$i] );
                                if ( $exp < 0 || !$exp ) {
@@ -94,7 +94,7 @@ class ApiProtect extends ApiBase {
                                $expiryarray[$p[0]] = $exp;
                        }
                        $resultProtections[] = array( $p[0] => $protections[$p[0]],
-                                       'expiry' => ( $expiryarray[$p[0]] == $dbr->getInfinity() ?
+                                       'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() ?
                                                                'infinite' :
                                                                wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) ) );
                }
@@ -176,7 +176,7 @@ class ApiProtect extends ApiBase {
                        'protections' => 'Pipe-separated list of protection levels, formatted action=group (e.g. edit=sysop)',
                        'expiry' => array( 'Expiry timestamps. If only one timestamp is set, it\'ll be used for all protections.',
                                        'Use \'infinite\', \'indefinite\' or \'never\', for a neverexpiring protection.' ),
-                       'reason' => 'Reason for (un)protecting (optional)',
+                       'reason' => 'Reason for (un)protecting',
                        'cascade' => array( 'Enable cascading protection (i.e. protect pages included in this page)',
                                        'Ignored if not all protection levels are \'sysop\' or \'protect\'' ),
                        'watch' => 'If set, add the page being (un)protected to your watchlist',
@@ -184,6 +184,16 @@ class ApiProtect extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'title' => 'string',
+                               'reason' => 'string',
+                               'cascade' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Change the protection level of a page';
        }