-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpecialDataImportManager.php
More file actions
45 lines (41 loc) · 1.16 KB
/
SpecialDataImportManager.php
File metadata and controls
45 lines (41 loc) · 1.16 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
<?php
class SpecialDataImportManager extends FormSpecialPage {
public function __construct() {
parent::__construct( 'DataImport', 'manage-dataimport' );
}
protected function getFormFields() {
return array(
'wiki' => array(
'type' => 'text',
'label-message' => 'dataimport-label-wiki',
'required' => true,
'validation-callback' => null // @TODO: Replace w/ API check.
),
'file-assignment' => array(
'type' => 'checkbox',
'label-message' => 'dataimport-label-assignment',
'required' => true,
'validation-callback' => null // @TODO: Replace w/ check to see file exists. AJAX check.
),
'file-path' => array(
'type' => 'text',
'label-message' => 'dataimport-label-filepath',
'required' = true,
'disabled' => true,
'validation-callback' => null // @TODO: Some sort of validation.
);
}
protected function onSubmit( array $data ) {
$dbw = wfGetDB( DB_MASTER );
$record = $dbw->insert(
'importmanager',
array(
'wiki' => $data['wiki'],
'file' => $data['file'],
'complete' => false
)
};
$job = new DataImportJob( $data['wiki'], $record );
$record->update( 'job' => $record );
}
}