commit 83ef23587da832fe59c61bac3f9f783b919a03e7
parent 95f166cb32a3bc875aa79ede34f7e58f1540f3c8
Author: markseu <mark2011@mayberg.se>
Date: Sat, 31 Oct 2020 17:00:32 +0100
Updated API, more information for troubleshooting
Diffstat:
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/system/extensions/core.php b/system/extensions/core.php
@@ -2,7 +2,7 @@
// Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
class YellowCore {
- const VERSION = "0.8.27";
+ const VERSION = "0.8.28";
const RELEASE = "0.8.16";
public $page; // current page
public $content; // content files
@@ -1907,11 +1907,11 @@ class YellowExtension {
$this->yellow = $yellow;
$this->modified = 0;
$this->data = array();
- register_shutdown_function(array($this, "handleFatalError"));
}
// Load extensions
public function load($path) {
+ if (empty($this->data)) register_shutdown_function(array($this, "processExtensionError"));
foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.php$/", true, false) as $entry) {
if (defined("DEBUG") && DEBUG>=3) echo "YellowExtension::load file:$entry<br/>\n";
$this->modified = max($this->modified, filemtime($entry));
@@ -1928,6 +1928,19 @@ class YellowExtension {
}
}
+ // Process extension error
+ public function processExtensionError() {
+ $error = error_get_last();
+ if (!is_null($error)) {
+ $type = $error["type"];
+ $fileName = $error["file"];
+ if (($type==E_ERROR || $type==E_PARSE) && $this->yellow->toolbox->getFileType($fileName)=="php") {
+ $fileName = substru($fileName, strlenu($this->yellow->system->get("coreServerInstallDirectory")));
+ $this->yellow->log("error", "Can't run extension file '$fileName'!");
+ }
+ }
+ }
+
// Register extension
public function register($key, $class) {
if (!$this->isExisting($key) && class_exists($class)) {
@@ -1939,19 +1952,6 @@ class YellowExtension {
}
}
- // Handle fatal extension error
- public function handleFatalError() {
- $error = error_get_last();
- $type = $error["type"];
- $fileName = $error["file"];
- if ($type==E_ERROR || $type==E_PARSE) {
- if ($this->yellow->toolbox->getFileType($fileName)=="php") {
- $fileName = substru($fileName, strlenu($this->yellow->system->get("coreServerInstallDirectory")));
- $this->yellow->log("error", "Can't run extension file '$fileName'!");
- }
- }
- }
-
// Return extension
public function get($key) {
return $this->data[$key]["object"];
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -21,11 +21,11 @@ Tag: feature
system/extensions/command.php: command.php, create, update
Extension: Core
-Version: 0.8.27
+Version: 0.8.28
Description: Core functionality of the website.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/core.zip
-Published: 2020-10-29 20:49:27
+Published: 2020-10-31 16:55:28
Developer: Datenstrom
Tag: feature
system/extensions/core.php: core.php, create, update