Permalink
Browse files

fix(core): view inspector now can use simplecache views again

fixes #8564
fixes #9667
  • Loading branch information...
jdalsem committed Apr 12, 2016
1 parent 3862ffc commit 6c39e57367231dbccf818b83ac8da655e7e55e15
Showing with 21 additions and 9 deletions.
  1. +16 −5 engine/classes/Elgg/Debug/Inspector.php
  2. +5 −4 engine/classes/Elgg/ViewsService.php
@@ -167,11 +167,22 @@ public function getActions() {
* @return array [views]
*/
public function getSimpleCache() {
- global $CONFIG;
-
- $tree = array();
- foreach ($CONFIG->views->simplecache as $view => $foo) {
- $tree[$view] = "";
+
+ $simplecache = elgg_extract('simplecache', $this->getViewsData(), []);
+ $locations = elgg_extract('locations', $this->getViewsData(), []);
+
+ $tree = [];
+ foreach ($simplecache as $view => $foo) {
+ $tree[$view] = '';
+ }
+
+ // add all static views
+ foreach ($locations as $viewtype) {
+ foreach ($viewtype as $view => $location) {
+ if (pathinfo($location, PATHINFO_EXTENSION) !== 'php') {
+ $tree[$view] = '';
+ }
+ }
}
ksort($tree);
@@ -97,9 +97,9 @@ public function __construct(\Elgg\PluginHooksService $hooks, \Elgg\Logger $logge
/**
* Takes a view name and returns the canonical name for that view.
- *
+ *
* @param string $alias The possibly non-canonical view name.
- *
+ *
* @return string The canonical view name.
*/
public function canonicalizeViewName(/*string*/ $alias) /*: string*/ {
@@ -189,7 +189,7 @@ private function findViewFile($view, $viewtype) {
* @param string $view Name of the view
* @param string $location Full path to the view file
* @param string $viewtype The viewtype to register this under
- *
+ *
* @access private
*/
public function setViewDir($view, $location, $viewtype = '') {
@@ -360,7 +360,7 @@ private function handlePageSetup($view) {
/**
* Includes view PHP or static file
- *
+ *
* @param string $view The view name
* @param array $vars Variables passed to view
* @param string $viewtype The viewtype
@@ -617,6 +617,7 @@ public function getInspectorData() {
'locations' => $this->locations,
'overrides' => $overrides,
'extensions' => $this->views->extensions,
+ 'simplecache' => $this->views->simplecache,
];
}

0 comments on commit 6c39e57

Please sign in to comment.