View source
<?php
define('ACQUIA_DRUPAL_MINIMUM_PHP_MEMORY', '32M');
if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update' && isset($_POST['start'])) {
acquia_agent_alter_module_updates($_POST['start']);
}
function acquia_agent_uninstall() {
variable_del('acquia_identifier');
variable_del('acquia_key');
variable_del('acquia_network_address');
variable_del('acquia_subscription_data');
}
function acquia_agent_disable() {
$mlid = db_query("SELECT mlid FROM {menu_links} WHERE link_title = 'acquia_subscription_status' AND menu_name = 'admin_menu'")
->fetchField();
if ($mlid) {
menu_link_delete($mlid);
}
}
function acquia_agent_alter_module_updates(&$updates) {
uksort($updates, '_acquia_agent_alter_module_updates_cmp');
}
function _acquia_agent_alter_module_updates_cmp($a, $b) {
if ($a == 'system' || $b == 'system') {
return $a == 'system' ? -1 : 1;
}
elseif ($a == 'acquia_agent' || $b == 'acquia_agent') {
return $a == 'acquia_agent' ? -1 : 1;
}
return 0;
}
function acquia_agent_requirements($phase) {
include_once 'acquia_agent.module';
acquia_agent_load_versions();
$requirements = array();
$has_credentials = acquia_agent_has_credentials();
$is_active = acquia_agent_subscription_is_active();
$memory_limit = ini_get('memory_limit');
switch ($phase) {
case 'runtime':
if ($is_active) {
$requirements['acquia_subscription_status'] = array(
'title' => t('Acquia Network subscription status'),
'severity' => REQUIREMENT_OK,
'value' => t('Active'),
'description' => t('You can also <a href="@refresh-status">manually refresh the subscription status</a>.', array(
'@refresh-status' => url('admin/config/system/acquia-agent/refresh-status', array(
'query' => drupal_get_destination(),
)),
)),
);
}
elseif (!$has_credentials) {
$requirements['acquia_subscription_status'] = array(
'title' => t('Acquia Network subscription status'),
'severity' => REQUIREMENT_WARNING,
'value' => t('Unknown'),
'description' => t('You did not complete your signup to the Acquia Network. You can provide the subscription identifier and the subscription key at the <a href="@settings">Acquia settings</a> page or try to <a href="@refresh-status">manually refresh the subscription status</a>.', array(
'@settings' => url('admin/config/system/acquia-agent'),
'@refresh-status' => url('admin/config/system/acquia-agent/refresh-status', array(
'query' => drupal_get_destination(),
)),
)),
);
}
else {
$subscription = variable_get('acquia_subscription_data', array(
'active' => FALSE,
));
$href = isset($subscription['href']) ? $subscription['href'] . '/health' : 'http://acquia.com/network';
$requirements['acquia_subscription_status'] = array(
'title' => t('Acquia Network subscription status'),
'severity' => REQUIREMENT_WARNING,
'value' => t('Inactive'),
'description' => t('Your subscription is expired or you are using an invalid identifier and key pair. You can check the subscription identifier and the subscription key at the <a href="@settings">Acquia settings</a> page. Check <a href="@acquia-network">your subscription on the Acquia Network</a> for further status information.', array(
'@settings' => url('admin/config/system/acquia-agent'),
'@acquia-network' => $href,
)),
);
}
if (IS_ACQUIA_DRUPAL && $memory_limit && parse_size($memory_limit) < parse_size(ACQUIA_DRUPAL_MINIMUM_PHP_MEMORY)) {
$description = t('Drupal core requires @drupal_php_memory_limit, but to take advantage of all the features of Acquia Drupal, we recommend @acquia_php_memory_limit (or more).', array(
'@drupal_php_memory_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT,
'@acquia_php_memory_limit' => ACQUIA_DRUPAL_MINIMUM_PHP_MEMORY,
));
if (parse_size($memory_limit) >= parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)) {
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['acquia_php_memory_limit'] = array(
'title' => t('PHP memory limit (Acquia Drupal)'),
'description' => $description,
'severity' => REQUIREMENT_WARNING,
'value' => t('@memory_minimum_limit (or more) is recommended', array(
'@memory_minimum_limit' => ACQUIA_DRUPAL_MINIMUM_PHP_MEMORY,
)),
);
}
break;
case 'install':
$t = get_t();
if (IS_ACQUIA_DRUPAL && $memory_limit && parse_size($memory_limit) < parse_size(ACQUIA_DRUPAL_MINIMUM_PHP_MEMORY)) {
$description = $t('Your PHP memory limit is currently set at %current_memory_limit. Increasing this to %memory_minimum_limit (or more) is recommended to help prevent errors in the installation process and later during operation of the site.', array(
'%current_memory_limit' => $memory_limit,
'%memory_minimum_limit' => ACQUIA_DRUPAL_MINIMUM_PHP_MEMORY,
));
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['php_memory_limit'] = array(
'description' => $description,
'severity' => REQUIREMENT_WARNING,
);
}
if (version_compare(phpversion(), 5.0) < 0) {
$requirements['acquia_php_version'] = array(
'description' => $t('The Acquia Network Connector modules require a PHP version of at least 5.0.'),
'severity' => REQUIREMENT_ERROR,
);
}
break;
}
return $requirements;
}