summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-03-02 19:02:26 +0000
committerGreg Roach <fisharebest@gmail.com>2015-03-02 19:02:26 +0000
commita6a5bd50f03bb91f5892b69d48bfe0f20b742638 (patch)
tree611afc5ab35bfedce63e18ca93daec2c629859ec
parent33e1e30b97c6a8846bb1b86dafcfc632368c0d4d (diff)
downloadwebtrees-a6a5bd50f03bb91f5892b69d48bfe0f20b742638.tar.gz
webtrees-a6a5bd50f03bb91f5892b69d48bfe0f20b742638.tar.bz2
webtrees-a6a5bd50f03bb91f5892b69d48bfe0f20b742638.zip
Need 'include' instead of 'require' so we can catch errors
-rw-r--r--app/Module.php6
-rw-r--r--app/Theme.php12
2 files changed, 11 insertions, 7 deletions
diff --git a/app/Module.php b/app/Module.php
index a17135316a..99b12e8da5 100644
--- a/app/Module.php
+++ b/app/Module.php
@@ -191,9 +191,9 @@ abstract class Module {
$modules = array();
foreach ($module_names as $module_name) {
try {
- $module = require WT_ROOT . WT_MODULES_DIR . $module_name . '/module.php';
+ $module = include WT_ROOT . WT_MODULES_DIR . $module_name . '/module.php';
$modules[$module->getName()] = $module;
- } catch (\Exception $ex) {
+ } catch (\ErrorException $ex) {
// Module has been deleted or is broken? Disable it.
Log::addConfigurationLog("Module {$module_name} is missing or broken - disabling it");
Database::prepare(
@@ -368,7 +368,7 @@ abstract class Module {
foreach (glob(WT_ROOT . WT_MODULES_DIR . '*/module.php') as $file) {
try {
- $module = require $file;
+ $module = include $file;
$modules[$module->getName()] = $module;
Database::prepare("INSERT IGNORE INTO `##module` (module_name, status, menu_order, sidebar_order, tab_order) VALUES (?, ?, ?, ?, ?)")
->execute(array(
diff --git a/app/Theme.php b/app/Theme.php
index 3144830a69..57a18d7ed8 100644
--- a/app/Theme.php
+++ b/app/Theme.php
@@ -36,10 +36,14 @@ class Theme {
if (self::$installed_themes === null) {
self::$installed_themes = array();
foreach (glob(WT_ROOT . '/themes/*/theme.php') as $theme_path) {
- $theme = require $theme_path;
- // Themes beginning with an underscore are reserved for special use.
- if (substr_compare($theme->themeId(), '_', 0, 1) !== 0) {
- self::$installed_themes[] = $theme;
+ try {
+ $theme = include $theme_path;
+ // Themes beginning with an underscore are reserved for special use.
+ if (substr_compare($theme->themeId(), '_', 0, 1) !== 0) {
+ self::$installed_themes[] = $theme;
+ }
+ } catch (\Exception $ex) {
+ // Broken theme? Ignore it.
}
}
}