1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Install, update and uninstall functions for the print_pdf_wkhtmltopdf module.
|
6
|
*
|
7
|
* @ingroup print
|
8
|
*/
|
9
|
|
10
|
/**
|
11
|
* Implements hook_uninstall().
|
12
|
*/
|
13
|
function print_pdf_wkhtmltopdf_uninstall() {
|
14
|
variable_del('print_pdf_wkhtmltopdf_options');
|
15
|
variable_del('print_pdf_wkhtmltopdf_version');
|
16
|
}
|
17
|
|
18
|
/**
|
19
|
* Implements hook_requirements().
|
20
|
*/
|
21
|
function print_pdf_wkhtmltopdf_requirements($phase) {
|
22
|
$requirements = array();
|
23
|
$t = get_t();
|
24
|
switch ($phase) {
|
25
|
// On status report page, make sure that a PDF generation tool is selected.
|
26
|
case 'runtime':
|
27
|
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
|
28
|
if (!empty($print_pdf_pdf_tool)) {
|
29
|
$tool = explode('|', $print_pdf_pdf_tool);
|
30
|
|
31
|
if (is_file($tool[1]) && is_readable($tool[1])) {
|
32
|
if (drupal_substr(basename($tool[1], '.exe'), 0, 11) == 'wkhtmltopdf') {
|
33
|
if (function_exists('is_executable') && !is_executable($tool[1])) {
|
34
|
$requirements['print_pdf_wkhtmltopdf'] = array(
|
35
|
'title' => $t('wkhtmltopdf library'),
|
36
|
'value' => $t('Non-executable permissions'),
|
37
|
'description' => $t('You must modify the permissions of the wkhtmltopdf file (%file) to make it executable.', array('%file' => $tool[1])),
|
38
|
'severity' => REQUIREMENT_ERROR,
|
39
|
);
|
40
|
}
|
41
|
}
|
42
|
}
|
43
|
}
|
44
|
break;
|
45
|
}
|
46
|
return $requirements;
|
47
|
}
|