forked from cyberwolf/cnapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cnapi.drush.inc
70 lines (63 loc) · 1.73 KB
/
cnapi.drush.inc
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
<?php
/**
* @file
* Drush integration for the CultuurNet API module.
*/
/**
* Implements hook_drush_help().
*/
function cnapi_drush_help($section) {
switch ($section) {
case 'cnapi:cnapi-import-values':
return dt("Import all CultuurNet API headings, locations, ...");
case 'cnapi:cnapi-import-actors':
return dt("Import all CultuurNet API actors.");
case 'cnapi:cnapi-flush-caches':
return dt("Flush all CultuurNet API caches.");
}
}
/**
* Implements hook_drush_command().
*/
function cnapi_drush_command() {
$items['cnapi-import-values'] = array(
'description' => 'Import all CultuurNet API values.',
'examples' => array(
'drush cnapi-import-values' => '(Re-)import all CultuurNet API headings, cities, regions, output types, ...',
),
);
$items['cnapi-import-actors'] = array(
'description' => 'Import all CultuurNet API actors.',
'examples' => array(
'drush cnapi-import-actors' => '(Re-)import all CultuurNet API actors.',
),
);
$items['cnapi-flush-caches'] = array(
'description' => 'Flush all CultuurNet API caches.',
'examples' => array(
'drush cnapi-flush-caches' => 'Flush all CultuurNet API caches.',
),
);
return $items;
}
/**
* Implements the 'cnapi-import-values' drush command.
*/
function drush_cnapi_import_values() {
require_once 'cnapi.import.inc';
cnapi_import();
}
/**
* Implements the 'cnapi-import-actors' drush command.
*/
function drush_cnapi_import_actors() {
require_once 'cnapi.import.inc';
cnapi_import_actors();
}
/**
* Implements the 'cnapi-flush-caches' drush command.
*/
function drush_cnapi_flush_caches() {
cache_clear_all('*', 'cache_cnapi', TRUE);
cache_clear_all('*', 'cache_cnapi_detail', TRUE);
}