Merge "Use wikimedia/utfnormal library, add backwards-compatability layer"
[lhc/web/wiklou.git] / includes / api / ApiQueryFilearchive.php
index a94b4fa..6b92603 100644 (file)
@@ -193,7 +193,7 @@ class ApiQueryFilearchive extends ApiQueryBase {
 
                                $pageCount = ArchivedFile::newFromRow( $row )->pageCount();
                                if ( $pageCount !== false ) {
-                                       $vals['pagecount'] = $pageCount;
+                                       $file['pagecount'] = $pageCount;
                                }
 
                                $file['height'] = $row->fa_height;
@@ -246,16 +246,8 @@ class ApiQueryFilearchive extends ApiQueryBase {
        public function getAllowedParams() {
                return array(
                        'from' => null,
-                       'continue' => null,
                        'to' => null,
                        'prefix' => null,
-                       'limit' => array(
-                               ApiBase::PARAM_DFLT => 10,
-                               ApiBase::PARAM_TYPE => 'limit',
-                               ApiBase::PARAM_MIN => 1,
-                               ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
-                               ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
-                       ),
                        'dir' => array(
                                ApiBase::PARAM_DFLT => 'ascending',
                                ApiBase::PARAM_TYPE => array(
@@ -283,127 +275,23 @@ class ApiQueryFilearchive extends ApiQueryBase {
                                        'archivename',
                                ),
                        ),
-               );
-       }
-
-       public function getParamDescription() {
-               return array(
-                       'from' => 'The image title to start enumerating from',
-                       'continue' => 'When more results are available, use this to continue',
-                       'to' => 'The image title to stop enumerating at',
-                       'prefix' => 'Search for all image titles that begin with this value',
-                       'dir' => 'The direction in which to list',
-                       'limit' => 'How many images to return in total',
-                       'sha1' => "SHA1 hash of image. Overrides {$this->getModulePrefix()}sha1base36",
-                       'sha1base36' => 'SHA1 hash of image in base 36 (used in MediaWiki)',
-                       'prop' => array(
-                               'What image information to get:',
-                               ' sha1              - Adds SHA-1 hash for the image',
-                               ' timestamp         - Adds timestamp for the uploaded version',
-                               ' user              - Adds user who uploaded the image version',
-                               ' size              - Adds the size of the image in bytes and the height, ' .
-                                       'width and page count (if applicable)',
-                               ' dimensions        - Alias for size',
-                               ' description       - Adds description the image version',
-                               ' parseddescription - Parse the description on the version',
-                               ' mime              - Adds MIME of the image',
-                               ' mediatype         - Adds the media type of the image',
-                               ' metadata          - Lists Exif metadata for the version of the image',
-                               ' bitdepth          - Adds the bit depth of the version',
-                               ' archivename       - Adds the file name of the archive version for non-latest versions'
-                       ),
-               );
-       }
-
-       public function getResultProperties() {
-               return array(
-                       '' => array(
-                               'name' => 'string',
-                               'ns' => 'namespace',
-                               'title' => 'string',
-                               'filehidden' => 'boolean',
-                               'commenthidden' => 'boolean',
-                               'userhidden' => 'boolean',
-                               'suppressed' => 'boolean'
-                       ),
-                       'sha1' => array(
-                               'sha1' => 'string'
-                       ),
-                       'timestamp' => array(
-                               'timestamp' => 'timestamp'
-                       ),
-                       'user' => array(
-                               'userid' => 'integer',
-                               'user' => 'string'
-                       ),
-                       'size' => array(
-                               'size' => 'integer',
-                               'pagecount' => array(
-                                       ApiBase::PROP_TYPE => 'integer',
-                                       ApiBase::PROP_NULLABLE => true
-                               ),
-                               'height' => 'integer',
-                               'width' => 'integer'
-                       ),
-                       'dimensions' => array(
-                               'size' => 'integer',
-                               'pagecount' => array(
-                                       ApiBase::PROP_TYPE => 'integer',
-                                       ApiBase::PROP_NULLABLE => true
-                               ),
-                               'height' => 'integer',
-                               'width' => 'integer'
-                       ),
-                       'description' => array(
-                               'description' => 'string'
-                       ),
-                       'parseddescription' => array(
-                               'description' => 'string',
-                               'parseddescription' => 'string'
-                       ),
-                       'metadata' => array(
-                               'metadata' => 'string'
-                       ),
-                       'bitdepth' => array(
-                               'bitdepth' => 'integer'
-                       ),
-                       'mime' => array(
-                               'mime' => 'string'
-                       ),
-                       'mediatype' => array(
-                               'mediatype' => 'string'
+                       'limit' => array(
+                               ApiBase::PARAM_DFLT => 10,
+                               ApiBase::PARAM_TYPE => 'limit',
+                               ApiBase::PARAM_MIN => 1,
+                               ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
+                               ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
                        ),
-                       'archivename' => array(
-                               'archivename' => 'string'
+                       'continue' => array(
+                               ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
                        ),
                );
        }
 
-       public function getDescription() {
-               return 'Enumerate all deleted files sequentially.';
-       }
-
-       public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(), array(
-                       array(
-                               'code' => 'permissiondenied',
-                               'info' => 'You don\'t have permission to view deleted file information'
-                       ),
-                       array( 'code' => 'hashsearchdisabled', 'info' => 'Search by hash disabled in Miser Mode' ),
-                       array( 'code' => 'invalidsha1hash', 'info' => 'The SHA-1 hash provided is not valid' ),
-                       array(
-                               'code' => 'invalidsha1base36hash',
-                               'info' => 'The SHA1Base36 hash provided is not valid'
-                       ),
-               ) );
-       }
-
-       public function getExamples() {
+       protected function getExamplesMessages() {
                return array(
-                       'api.php?action=query&list=filearchive' => array(
-                               'Simple Use',
-                               'Show a list of all deleted files',
-                       ),
+                       'action=query&list=filearchive'
+                               => 'apihelp-query+filearchive-example-simple',
                );
        }