-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateFromFile.api.php
More file actions
72 lines (64 loc) · 1.85 KB
/
Copy pathCreateFromFile.api.php
File metadata and controls
72 lines (64 loc) · 1.85 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
class ApiCreateFromFile extends ApiBase {
public function execute() {
$params = $this->extractRequestParams();
// For compatibility with GET method, we process JSON
$jsonresult = CreateFromFile::createfromSpreadJS( $params['text'], $params['template'], $params['title'], $params['delimiter'], $params['enclosure'], $params['userparam'], $params['start'], $params['username'], $params['extrainfo'] );
$output = json_decode( $jsonresult );
$this->getResult()->addValue( null, $this->getModuleName(), array ( 'status' => $output->status, 'msg' => $output->msg ) );
return true;
}
public function getAllowedParams() {
return array(
'text' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
),
'template' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
),
'title' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
),
'delimiter' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
),
'enclosure' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
),
'userparam' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
),
'start' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
),
'username' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
),
'extrainfo' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false
)
);
}
public function getDescription() {
return array(
'API for importing delimited separated information into MediaWiki'
);
}
public function getParamDescription() {
return array(
'text' => 'Content to be processed'
);
}
public function getVersion() {
return __CLASS__ . ': 1.1';
}
}