r90716 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90715‎ | r90716 | r90717 >
Date:15:22, 24 June 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
removing ApiQueryPageSchemas
Modified paths:
  • /trunk/extensions/PageSchemas/ApiQueryPageSchemas.php (deleted) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/ApiQueryPageSchemas.php
@@ -1,89 +0,0 @@
2 -<?php
3 -/**
4 - * Adds the 'PageSchema' action to the MediaWiki API.
5 - *
6 - * @author Ankit Garg
7 - */
8 -
9 -/**
10 - * Protect against register_globals vulnerabilities.
11 - * This line must be present before any global variable is referenced.
12 - */
13 -if (!defined('MEDIAWIKI')) die();
14 -
15 -/**
16 - * @ingroup API
17 - */
18 -class APIQueryPageSchemas extends ApiQueryBase {
19 -
20 - public function __construct( $query, $moduleName ) {
21 - parent :: __construct( $query, $moduleName, 'ti' );
22 - }
23 -
24 - public function execute() {
25 - $params = $this->extractRequestParams();
26 - $titles = $this->getPageSet()->getGoodTitles();
27 - if (count($titles) == 0)
28 - return;
29 -
30 - $this->addTables( 'page_props' );
31 - $this->addFields( array( 'pp_page', 'pp_value' ) );
32 - $this->addWhere( array(
33 - 'pp_page' => array_keys( $titles ),
34 - 'pp_propname' => 'PageSchema'
35 - ) );
36 - if ( !is_null( $params['continue'] ) )
37 - {
38 - $fromid = intval( $params['continue'] );
39 - $this->addWhere( "pp_page >= $fromid" );
40 - }
41 - $this->addOption( 'ORDER BY', 'pp_page' );
42 -
43 - $res = $this->select(__METHOD__);
44 - while ( $row = $this->getDB()->fetchObject( $res ) ) {
45 - $vals = array( );
46 - $template_info = $row->pp_value;
47 - // determine whether this is actual XML or an error
48 - // message by checking whether the first character
49 - // is '<' - this is an interim solution until there's
50 - // a better storage format in place
51 - if (substr($template_info, 0, 1) == '<')
52 - ApiResult::setContent( $vals, $row->pp_value );
53 - else
54 - // add error message as an "error=" attribute
55 - $vals['error'] = $row->pp_value;
56 - $fit = $this->addPageSubItems( $row->pp_page, $vals );
57 - if( !$fit ) {
58 - $this->setContinueEnumParameter( 'continue', $row->pp_page );
59 - break;
60 - }
61 - }
62 - }
63 -
64 - public function getAllowedParams() {
65 - return array (
66 - 'continue' => null,
67 - );
68 - }
69 -
70 - public function getParamDescription() {
71 - return array (
72 - 'continue' => 'When more results are available, use this to continue',
73 - );
74 - }
75 -
76 - public function getDescription() {
77 - return 'Template information, defined by the Template Info extension (http://www.mediawiki.org/Extension:Template_Info)';
78 - }
79 -
80 - protected function getExamples() {
81 - return array (
82 - 'api.php?action=query&prop=PageSchema&titles=Template:Foo|Template:Bar',
83 - );
84 - }
85 -
86 - public function getVersion() {
87 - return __CLASS__ . ': $Id$';
88 - }
89 -
90 -}

Status & tagging log