Do not allow a user to delete a page they can't edit
[lhc/web/wiklou.git] / includes / api / ApiProtect.php
index ffbf01b..828fc22 100644 (file)
@@ -77,7 +77,7 @@ class ApiProtect extends ApiBase {
                                $this->dieUsageMsg( array( 'protect-invalidlevel', $p[1] ) );
                        }
 
-                       if ( in_array( $expiry[$i], array( 'infinite', 'indefinite', 'never' ) ) ) {
+                       if ( in_array( $expiry[$i], array( 'infinite', 'indefinite', 'infinity', 'never' ) ) ) {
                                $expiryarray[$p[0]] = $db->getInfinity();
                        } else {
                                $exp = strtotime( $expiry[$i] );
@@ -187,7 +187,7 @@ class ApiProtect extends ApiBase {
                        'expiry' => array(
                                'Expiry timestamps. If only one timestamp is ' .
                                        'set, it\'ll be used for all protections.',
-                               'Use \'infinite\', \'indefinite\' or \'never\', for a never-expiring protection.'
+                               'Use \'infinite\', \'indefinite\', \'infinity\' or \'never\', for a never-expiring protection.'
                        ),
                        'reason' => 'Reason for (un)protecting',
                        'cascade' => array(
@@ -200,35 +200,10 @@ 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.';
        }
 
-       public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(),
-                       $this->getTitleOrPageIdErrorMessage(),
-                       array(
-                               array( 'toofewexpiries', 'noofexpiries', 'noofprotections' ),
-                               array( 'create-titleexists' ),
-                               array( 'missingtitle-createonly' ),
-                               array( 'protect-invalidaction', 'action' ),
-                               array( 'protect-invalidlevel', 'level' ),
-                               array( 'invalidexpiry', 'expiry' ),
-                               array( 'pastexpiry', 'expiry' ),
-                       )
-               );
-       }
-
        public function needsToken() {
                return true;
        }