forked from drupalprojects/panopoly_core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
panopoly_core.install
98 lines (83 loc) · 3.42 KB
/
panopoly_core.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
<?php
/**
* @file
* An installation file for Panopoly Core
*/
/**
* Implementation of hook_requirements()
*
* Adapted from system_requirements()
*/
function panopoly_core_requirements($phase) {
// Kick us off
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
// Let's require more memory and force Drupal core to accept it
$memory_limit = ini_get('memory_limit');
$panopoly_memory_limit = '196M';
$requirements['panopoly_core_memory_limit'] = array(
'title' => $t('PHP memory limit'),
'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit,
'weight' => 0,
);
if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit) < parse_size($panopoly_memory_limit)) {
$description = '';
if ($phase == 'install') {
$description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => $panopoly_memory_limit));
}
elseif ($phase == 'update') {
$description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the update process.', array('%memory_minimum_limit' => $panopoly_memory_limit));
}
elseif ($phase == 'runtime') {
$description = $t('Depending on your configuration, Drupal can run with a %memory_limit PHP memory limit. However, a %memory_minimum_limit PHP memory limit or above is recommended, especially if your site uses additional custom or contributed modules.', array('%memory_limit' => $memory_limit, '%memory_minimum_limit' => $panopoly_memory_limit));
}
if (!empty($description)) {
if ($php_ini_path = get_cfg_var('cfg_file_path')) {
$description .= ' ' . $t('Increase the memory limit by editing the memory_limit parameter in the file %configuration-file and then restart your web server (or contact your system administrator or hosting provider for assistance).', array('%configuration-file' => $php_ini_path));
}
else {
$description .= ' ' . $t('Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.');
}
$requirements['panopoly_core_memory_limit']['description'] = $description . ' ' . $t('See the <a href="@url">Drupal requirements</a> for more information.', array('@url' => 'http://drupal.org/requirements'));
$requirements['panopoly_core_memory_limit']['severity'] = REQUIREMENT_WARNING;
}
}
return $requirements;
}
/**
* Implementation of hook_install()
*/
function panopoly_core_install() {
// Add login link for users to log in
$item = array(
'link_path' => 'user/login',
'link_title' => 'Log in',
'menu_name' => 'user-menu',
);
menu_link_save($item);
}
/**
* Implemenetation of hook_uninstall()
*/
function panopoly_core_uninstall() {
}
/**
* Panopoly Beta 5 Update: Correctly Setting install_task to "done"
*/
function panopoly_core_update_7001(&$sandbox) {
variable_set('install_task', 'done');
}
/**
* Ensure latest pathauto_update_7006() has run.
*/
function panopoly_core_update_7002() {
if (function_exists('pathauto_update_7006')) {
$res = pathauto_update_7006();
if (db_table_exists('pathauto')) {
db_query("INSERT INTO {pathauto_state} (entity_type, entity_id, pathauto) SELECT entity_type, entity_id, pathauto FROM {pathauto}");
db_drop_table('pathauto');
}
return $res;
}
}