panels_content_cache.install in Panels Content Cache 7
Same filename and directory in other branches
Installation, schema and update hooks.
File
panels_content_cache.installView source
<?php
/**
* @file
* Installation, schema and update hooks.
*/
/**
* Implements hook_requirements().
*/
function panels_content_cache_requirements($phase) {
$requirements = array();
// Ensure translations don't break during installation.
$t = get_t();
if ($phase == 'runtime') {
// The module requires versions of the Panels module that include the cache
// table.
if (!db_table_exists('cache_panels')) {
$requirements['panels_content_cache'] = array(
'severity' => REQUIREMENT_ERROR,
'title' => 'Panels Content Cache',
'value' => $t('Panels v7.x-3.4 or newer is required'),
'description' => $t('The Panels module must be updated to v7.x-3.4 or newer.'),
);
}
// Warn about the core bug and the Cache Consistency module.
if (!empty($GLOBALS['conf']['cache_backends'])) {
foreach ($GLOBALS['conf']['cache_backends'] as $cache_backend) {
foreach (array(
'memcache',
'redis',
) as $cache_module) {
if (strpos($cache_backend, $cache_module)) {
if (!isset($GLOBALS['conf']['consistent_cache_default_class'])) {
$requirements['panels_content_cache'] = array(
'severity' => REQUIREMENT_WARNING,
'title' => 'Panels Content Cache',
'value' => $t('Installing the <a href="@url">Cache Consistency</a> module is recommended.', array(
'@url' => 'https://www.drupal.org/project/cache_consistent',
)),
'description' => $t('There is <a href="@bug">a bug in Drupal core</a> that results in race conditions when not using the database as the primary cache. To work around this issue, it is recommended to install the <a href="@cc">Cache Consistency</a> module until the core bug is fixed.', array(
'@bug' => 'https://www.drupal.org/node/1679344',
'@cc' => 'https://www.drupal.org/project/cache_consistent',
)),
);
continue;
}
}
}
}
}
}
return $requirements;
}
/**
* Implements hook_schema().
*/
function panels_content_cache_schema() {
$schema = array();
$schema['panels_content_cache'] = array(
'description' => 'Stores display IDs and content types for content cached panel displays.',
'fields' => array(
'did' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'pid' => array(
'type' => 'int',
'default' => NULL,
),
'type' => array(
'description' => 'The {node_type}.type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
),
'indexes' => array(
'did' => array(
'did',
),
'pid' => array(
'pid',
),
),
);
return $schema;
}
/**
* Implements hook_install().
*/
// function panels_content_cache_install() {
// }
/**
* Implements hook_uninstall().
*/
function panels_content_cache_uninstall() {
variable_del('panels_content_cache_types');
}
Functions
Name![]() |
Description |
---|---|
panels_content_cache_requirements | Implements hook_requirements(). |
panels_content_cache_schema | Implements hook_schema(). |
panels_content_cache_uninstall | Implements hook_uninstall(). |