-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepsacrop.install
118 lines (104 loc) · 3.57 KB
/
epsacrop.install
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
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* @file
* install file for epsacrop.module
*/
/**
* Implements hook_schema().
*
* @access public
* @return array
*/
function epsacrop_schema() {
$schema['epsacrop_files'] = array(
'description' => 'TODO: please describe this table!',
'fields' => array(
'fid' => array(
'description' => 'TODO: please describe this field!',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'coords' => array(
'description' => 'TODO: please describe this field!',
'type' => 'text',
'size' => 'big',
'not null' => TRUE,
),
),
'primary key' => array('fid'),
);
return $schema;
}
/**
* Implements hook_requirements().
*
* @access public
* @param string $phase
* @return array
*/
function epsacrop_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'install') {
// The _epsacrop_jcrop_get_version() function is in the .module file, which isn't
// loaded yet.
include_once dirname(__FILE__) . '/epsacrop.module';
}
if (!function_exists('libraries_get_path')) {
include_once backdrop_get_path('module', 'libraries') . '/libraries.module';
}
$requirements['epsacrop_jcrop']['title'] = $t('EPSA Crop : Jcrop');
$requirements['epsacrop_json2']['title'] = $t('EPSA Crop : json2.js');
if ($version = _epsacrop_jcrop_get_version() || _epsacrop_is_json2_exists(FALSE)) {
$version = _epsacrop_jcrop_get_version();
// Everything looks good; display the current Jcrop version.
if ($version) {
$requirements['epsacrop_jcrop']['value'] = 'Jcrop version : ' . $version;
$requirements['epsacrop_jcrop']['severity'] = REQUIREMENT_OK;
}
if (_epsacrop_is_json2_exists(FALSE)) {
$requirements['epsacrop_json2']['value'] = 'JSON file (json2.js) OK';
$requirements['epsacrop_json2']['severity'] = REQUIREMENT_OK;
}
}
else {
// Required libraies wasn't found. Abort installation.
if (!_epsacrop_jcrop_get_version()) {
$requirements['epsacrop_jcrop']['value'] = $t('Not found');
$requirements['epsacrop_jcrop']['description'] = $t('The <a href="@jcrop">Jcrop</a> plugin is missing. <a href="@download">Download</a> and extract it in your <em>sites/all/libraries</em> directory.', array('@jcrop' => 'http://deepliquid.com/content/Jcrop.html', '@download' => 'https://github.com/tapmodo/Jcrop/archive/master.zip'));
$requirements['epsacrop_jcrop']['severity'] = REQUIREMENT_ERROR;
}
if (!_epsacrop_is_json2_exists(FALSE)) {
$requirements['epsacrop_json2']['value'] = $t('Not found');
$requirements['epsacrop_json2']['description'] = $t("The <a href='@json2'>json2.js</a> file is missing, you can download it <a href='@downjson2'>here</a> and put it in your <em>sites/all/libraries</em> directory. Don't forget rename the downloaded folder into json2. At the end, you should have something like this sites/all/libraries/json2", array('@json2' => 'http://www.json.org/js.html', '@downjson2' => 'https://github.com/douglascrockford/JSON-js'));
$requirements['epsacrop_json2']['severity'] = REQUIREMENT_ERROR;
}
}
return $requirements;
}
/**
* Implements hook_install().
*
* @access public
* @return void
*/
function epsacrop_install() {
db_update('system')
->fields(array('weight' => 10))
->condition('name', 'epsacrop')
->execute();
}
/**
* Implements hook_uninstall().
*
* @access public
* @return void
*/
function epsacrop_uninstall() { }
/**
* Implements hook_update_last_removed().
*/
function modulename_update_last_removed() {
return 7202;
}