/
_generic.php
54 lines (36 loc) · 1.2 KB
/
_generic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
#
# A MediaWiki bot - used for automated tasks on sites powered by MediaWiki.
# API: Query: Generic.
#
# Author: Grigor Gatchev <grigor at gatchev dot info>
# Licensed under GNU Affero Public License, version 3.0 or any later.
#
# ---------------------------------------------------------------------------- #
require_once ( dirname ( __FILE__ ) . '/../../_generic/query.php' );
require_once ( dirname ( __FILE__ ) . '/../actions/query.php' );
abstract class API_Query extends Backend_Query
{
# ----- Implemented ----- #
protected function action ( $settings, $defaults )
{
return new API_Action_Query ( $this->backend, $settings, $defaults );
}
protected function backend_name ()
{
return "api";
}
public function nohooks__set_params ( $hook_object, $params )
{
$paramnames = $this->universal_query_paramnames();
foreach ( $paramnames as $paramname )
if ( isset ( $this->$paramname ) && ! isset ( $params[$paramname] ) )
$params[$paramname] = $this->$paramname;
return parent::nohooks__set_params ( $hook_object, $params );
}
# ----- Overridable ----- #
protected function universal_query_paramnames ()
{
return $this->backend->info->universal_query_paramnames();
}
}