Elgg  Version 5.1
ViewCacher.php
Go to the documentation of this file.
1 <?php
2 namespace Elgg\Cache;
3 
4 use Elgg\Includer;
7 use Elgg\Config;
8 
12 class ViewCacher {
13 
17  private $views;
18 
22  private $config;
23 
30  public function __construct(ViewsService $views, Config $config) {
31  $this->views = $views;
32  $this->config = $config;
33  }
34 
40  public function registerCoreViews() {
41  if ($this->config->system_cache_loaded) {
42  return;
43  }
44 
45  // Core view files in /views
46  $this->views->registerPluginViews(Paths::elgg());
47 
48  // Core view definitions in /engine/views.php
49  $file = Paths::elgg() . 'engine/views.php';
50  if (!is_file($file)) {
51  return;
52  }
53 
54  $spec = Includer::includeFile($file);
55  if (is_array($spec)) {
56  // check for uploaded fontawesome font
57  if (elgg_get_config('font_awesome_zip')) {
58  $spec['default']['font-awesome/'] = elgg_get_data_path() . 'fontawesome/webfont/';
59  }
60 
61  $this->views->mergeViewsSpec($spec);
62  }
63  }
64 }
static includeFile($file)
Include a file with as little context as possible.
Definition: Includer.php:18
Handles caching of views in the system cache.
Definition: ViewCacher.php:12
static elgg()
Get the Elgg codebase path with "/".
Definition: Paths.php:44
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
registerCoreViews()
Discover the core views if the system cache did not load.
Definition: ViewCacher.php:40
Views service.
elgg_get_data_path()
Get the data directory path for this installation, ending with slash.
__construct(ViewsService $views, Config $config)
Constructor.
Definition: ViewCacher.php:30