bootstrap.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Symfony\Polyfill\Apcu as p;
  11. if (!extension_loaded('apc') && !extension_loaded('apcu')) {
  12. return;
  13. }
  14. if (\PHP_VERSION_ID >= 80000) {
  15. return require __DIR__.'/bootstrap80.php';
  16. }
  17. if (extension_loaded('Zend Data Cache')) {
  18. if (!function_exists('apcu_add')) {
  19. function apcu_add($key, $value = null, $ttl = 0) { return p\Apcu::apcu_add($key, $value, $ttl); }
  20. }
  21. if (!function_exists('apcu_delete')) {
  22. function apcu_delete($key) { return p\Apcu::apcu_delete($key); }
  23. }
  24. if (!function_exists('apcu_exists')) {
  25. function apcu_exists($key) { return p\Apcu::apcu_exists($key); }
  26. }
  27. if (!function_exists('apcu_fetch')) {
  28. function apcu_fetch($key, &$success = null) { return p\Apcu::apcu_fetch($key, $success); }
  29. }
  30. if (!function_exists('apcu_store')) {
  31. function apcu_store($key, $value = null, $ttl = 0) { return p\Apcu::apcu_store($key, $value, $ttl); }
  32. }
  33. } else {
  34. if (!function_exists('apcu_add')) {
  35. function apcu_add($key, $value = null, $ttl = 0) { return apc_add($key, $value, $ttl); }
  36. }
  37. if (!function_exists('apcu_delete')) {
  38. function apcu_delete($key) { return apc_delete($key); }
  39. }
  40. if (!function_exists('apcu_exists')) {
  41. function apcu_exists($key) { return apc_exists($key); }
  42. }
  43. if (!function_exists('apcu_fetch')) {
  44. function apcu_fetch($key, &$success = null) { return apc_fetch($key, $success); }
  45. }
  46. if (!function_exists('apcu_store')) {
  47. function apcu_store($key, $value = null, $ttl = 0) { return apc_store($key, $value, $ttl); }
  48. }
  49. }
  50. if (!function_exists('apcu_cache_info')) {
  51. function apcu_cache_info($limited = false) { return apc_cache_info('user', $limited); }
  52. }
  53. if (!function_exists('apcu_cas')) {
  54. function apcu_cas($key, $old, $new) { return apc_cas($key, $old, $new); }
  55. }
  56. if (!function_exists('apcu_clear_cache')) {
  57. function apcu_clear_cache() { return apc_clear_cache('user'); }
  58. }
  59. if (!function_exists('apcu_dec')) {
  60. function apcu_dec($key, $step = 1, &$success = false) { return apc_dec($key, $step, $success); }
  61. }
  62. if (!function_exists('apcu_inc')) {
  63. function apcu_inc($key, $step = 1, &$success = false) { return apc_inc($key, $step, $success); }
  64. }
  65. if (!function_exists('apcu_sma_info')) {
  66. function apcu_sma_info($limited = false) { return apc_sma_info($limited); }
  67. }
  68. if (!class_exists('APCuIterator', false) && class_exists('APCIterator', false)) {
  69. class APCuIterator extends APCIterator
  70. {
  71. public function __construct($search = null, $format = \APC_ITER_ALL, $chunk_size = 100, $list = \APC_LIST_ACTIVE)
  72. {
  73. parent::__construct('user', $search, $format, $chunk_size, $list);
  74. }
  75. }
  76. }