Throw RuntimeException on invalid content dirs

This commit is contained in:
Daniel Rudolf 2015-11-19 04:48:22 +01:00
parent 3e4bcd4289
commit d252df4b98
2 changed files with 8 additions and 1 deletions

View file

@ -11,6 +11,7 @@ Released: -
want to parse the contents of a page, use the `content` filter instead
* [Changed] Improve documentation
* [Changed] Improve table styling in default theme
* [Changed] Throw a RuntimeException when the `content` dir isn't accessible
* [Changed] Reuse `ParsedownExtra` object; new `onParsedownRegistration` event
* [Fixed] `PicoDeprecated`: Sanitize `content_dir` and `base_url` options when
reading `config.php` in Picos root dir

View file

@ -266,7 +266,8 @@ class Pico
* meta headers, processes Markdown, does Twig processing and returns
* the rendered contents.
*
* @return string rendered Pico contents
* @return string rendered Pico contents
* @throws RuntimeException thrown when a not recoverable error occurs
*/
public function run()
{
@ -281,6 +282,11 @@ class Pico
$this->loadConfig();
$this->triggerEvent('onConfigLoaded', array(&$this->config));
// check content dir
if (!is_dir($this->getConfig('content_dir'))) {
throw new RuntimeException('Invalid content directory "' . $this->getConfig('content_dir') . '"');
}
// evaluate request url
$this->evaluateRequestUrl();
$this->triggerEvent('onRequestUrl', array(&$this->requestUrl));