cache_handler.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Cache handler.
  4. *
  5. * External access to cached CSS and JavaScript views. The cached file URLS
  6. * should be of the form: cache/<ts>/<viewtype>/<name/of/view> where
  7. * ts is an identifier that is updated every time the cache is flushed.
  8. * The simplest way to maintain a unique identifier is to use the lastcache
  9. * timestamp in Elgg's config object.
  10. *
  11. * @see elgg_register_simplecache_view()
  12. *
  13. * @package Elgg.Core
  14. * @subpackage Cache
  15. */
  16. // we need to load a few Elgg classes, but this is much lighter than /vendor/autoload.php
  17. spl_autoload_register(function ($class) {
  18. $file = dirname(__DIR__) . '/classes/' . strtr(ltrim($class, '\\'), '_\\', '//') . '.php';
  19. is_readable($file) && (require $file);
  20. });
  21. require_once dirname(dirname(__FILE__)) . '/settings.php';
  22. /* @var \stdClass $CONFIG */
  23. // dataroot must have trailing slash
  24. // @todo need a lib with core functions that have no depedencies
  25. if (isset($CONFIG->dataroot)) {
  26. $CONFIG->dataroot = rtrim($CONFIG->dataroot, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
  27. }
  28. $handler = new \Elgg\CacheHandler($CONFIG);
  29. $handler->handleRequest($_GET, $_SERVER);