forked from cschwirz/d2daddon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d2daddon.module
106 lines (103 loc) · 3.36 KB
/
d2daddon.module
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
/**
* @file
* A demo add-on for the Drupal-to-Drupal module.
*
* A longer description will follow here.
*/
require_once 'includes/d2daddon.constants.inc';
require_once 'includes/d2daddon.info.inc';
require_once 'includes/d2daddon.remote_control.inc';
require_once 'includes/d2daddon.publish_patterns.inc';
require_once 'includes/d2daddon.create_statistics.inc';
require_once 'includes/d2daddon.statistics.inc';
/**
* Implements hook_menu_alter().
*/
function d2daddon_menu_alter(&$items) {
$items['admin/drupaltodrupal/addon'] = array(
'title' => 'Add Ons',
'page callback' => 'd2daddon_show_info',
'access arguments' => array('administer drupaltodrupal'),
'type' => MENU_LOCAL_TASK,
'weight' => 55,
);
$items['admin/drupaltodrupal/addon/info'] = array(
'title' => 'Friends Info',
'page callback' => 'd2daddon_show_info',
'access arguments' => array('administer drupaltodrupal'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 1,
);
$items['admin/drupaltodrupal/addon/remote_control'] = array(
'title' => 'Remote Control',
'page callback' => 'd2daddon_remote_control',
'access arguments' => array('administer drupaltodrupal'),
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
$items['admin/drupaltodrupal/addon/statistics'] = array(
'title' => 'Remote Statistics',
'page callback' => 'd2daddon_show_statistics',
'access arguments' => array('administer drupaltodrupal'),
'type' => MENU_LOCAL_TASK,
'weight' => 3,
);
$items['admin/drupaltodrupal/addon/statistics_config'] = array(
'title' => 'Configure Statistics',
'page callback' => 'd2daddon_configure_statistics',
'access arguments' => array('administer drupaltodrupal'),
'type' => MENU_LOCAL_TASK,
'weight' => 4,
);
/*
$items['admin/drupaltodrupal/addon/publish_patterns'] = array(
'title' => 'Publish Patterns',
'page callback' => 'd2daddon_publish_patterns',
'access arguments' => array('administer drupaltodrupal'),
'type' => MENU_LOCAL_TASK,
'weight' => 3,
);
*/
return $items;
}
/**
* Implements hook_drupaltodrupal_secure_rpc().
*/
function d2daddon_drupaltodrupal_secure_rpc() {
$methods = array();
$methods['d2daddon_remote_control'] = array(
'arguments' => array('code' => 'is_string'),
'callback' => 'd2daddon_srpc_remote_control',
'description' => 'runs code on remote instance',
);
$methods['d2daddon_info'] = array(
'arguments' => array(),
'callback' => 'd2daddon_srpc_info',
'description' => 'returns information about this instance',
);
$methods['d2daddon_push_patterns'] = array(
'arguments' => array('patterns' => 'is_string'),
'callback' => 'd2daddon_push_patterns',
'description' => 'publish public patterns to remote instance',
);
$methods['d2daddon_get_community_name'] = array(
'arguments' => array(),
'callback' => 'd2daddon_statistics_get_community_name',
'description' => 'returns the name of the community',
);
$methods['d2daddon_get_query_results'] = array(
'arguments' => array('query' => 'is_string'),
'callback' => 'd2daddon_statistics_get_query_results',
'description' => 'returns the result of a query on the database',
);
return $methods;
}
/**
* Implements hook_cron().
*/
function d2daddon_cron() {
if (variable_get('d2daddon_auto_publish', FALSE)) {
d2daddon_publish_public_patterns(FALSE);
}
}