apc.install

  1. cis7 sites/all/modules/ulmus/apc/apc.install
  2. cle7 sites/all/modules/ulmus/apc/apc.install
  3. ecd7 sites/all/modules/ulmus/apc/apc.install
  4. elmsmedia7 sites/all/modules/ulmus/apc/apc.install
  5. harmony7 sites/all/modules/ulmus/apc/apc.install
  6. icor7 sites/all/modules/ulmus/apc/apc.install
  7. meedjum_blog7 sites/all/modules/ulmus/apc/apc.install
  8. mooc7 sites/all/modules/ulmus/apc/apc.install

Functions

Namesort descending Description
apc_requirements Implements hook_requirements().

File

sites/all/modules/ulmus/apc/apc.install
View source
  1. <?php
  2. /**
  3. * Implements hook_requirements().
  4. */
  5. function apc_requirements($phase) {
  6. $requirements = array();
  7. // Ensure translations don't break at install time
  8. $t = get_t();
  9. // Test APC.
  10. $apc_enabled = (function_exists('apc_cache_info') && ($cache = @apc_cache_info('user', TRUE)));
  11. $meets_version = version_compare(phpversion('apc'), '3.1.1')>= 0;
  12. $requirements['apc'] = array(
  13. 'title' => $t('APC'),
  14. 'value' => $apc_enabled ? ($meets_version ? phpversion('apc') : $t('APC needs version >=3.1.1')) : $t('Not available'),
  15. 'severity' => $apc_enabled && $meets_version ? ($cache['num_entries'] ? REQUIREMENT_OK : REQUIREMENT_WARNING) : REQUIREMENT_ERROR,
  16. );
  17. if ($apc_enabled) {
  18. $requirements['apc']['description'] = $t('APC has been running for !duration. Currently caching !num_entries entries (!memory_size).',
  19. array(
  20. '!duration' => format_interval(time() - $cache['start_time']),
  21. '!num_entries' => $cache['num_entries'],
  22. '!memory_size' => format_size($cache['mem_size']),
  23. )
  24. );
  25. }
  26. elseif (drupal_is_cli() && function_exists('drush_log')) {
  27. $requirements['apc']['severity'] = REQUIREMENT_WARNING;
  28. drupal_set_message($t('The APC module needs the apc extension see: <a href="!link">!link</a>.', array('!link' => 'http://www.php.net/apc')), 'warning');
  29. }
  30. else {
  31. $requirements['apc']['description'] = $t('The APC module needs the apc extension see: <a href="!link">!link</a>.', array('!link' => 'http://www.php.net/apc'));
  32. }
  33. return $requirements;
  34. }