Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PicoZCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PicoZCache extends AbstractPicoPlugin
private $cacheXHTML = false;
private $cacheFileName;

public function onConfigLoaded(array &$settings)
public function onConfigLoaded(array &$config)
{
if (isset($config['cache_dir'])) {

Expand All @@ -45,7 +45,7 @@ public function onConfigLoaded(array &$settings)
public function onRequestUrl(&$url)
{
//replace any character except numbers and digits with a '-' to form valid file names
$this->cacheFileName = $this->cacheDir . preg_replace('/[^A-Za-z0-9_\-]/', '_', $url) . '.html';
$this->cacheFileName = $this->cacheDir . (empty($url) ? 'index' : preg_replace('/[^A-Za-z0-9_\-]/', '_', $url)) . '.html';

//if a cached file exists and the cacheTime is not expired, load the file and exit
if ($this->doCache && file_exists($this->cacheFileName) && (time() - filemtime($this->cacheFileName)) < $this->cacheTime) {
Expand Down