diff --git a/deploy-config.orig.php b/deploy-config.orig.php index d17ddfd..2ce17a0 100644 --- a/deploy-config.orig.php +++ b/deploy-config.orig.php @@ -116,9 +116,19 @@ */ define('CLEANUP_WORK_TREE', false); -/* CALLBACK_FILE: - * Filename of a PHP script containing callback functions to +/* CALLBACK_CLASSES: + * Classnames containing callback functions to * be triggered at the end of the script on success or failure. * Useful to connect to your preferred notification system. + * Note: + * - Classes must implement Plugin Interface + * - Class names have to match their file-name (case-sensitive), e.g. "Discord.class.php" has class "Discord" + * - The array keys contain only the class name, e.g. array("Discord") */ -define('CALLBACK_FILE', ''); +define('CALLBACK_CLASSES', array( +)); + +/* PLUGINS_FOLDER: + * Folder containing all webhook plugins/classes, default: 'plugins/' + */ +define('PLUGINS_FOLDER','plugins/'); \ No newline at end of file diff --git a/deploy.php b/deploy.php index 84e9823..a877fd1 100644 --- a/deploy.php +++ b/deploy.php @@ -8,6 +8,14 @@ // Measure execution time $time = -microtime(true); +// Autoloader for plugin classes +spl_autoload_register(function($className){ + $namespace=str_replace("\\","/",__NAMESPACE__); + $className=str_replace("\\","/",$className); + $class=(!defined("PLUGINS_FOLDER") ? "plugins/" : PLUGINS_FOLDER).(empty($namespace)?"":$namespace."/")."{$className}.class.php"; + include_once($class); +}); + /* Functions */ // Output buffering handler @@ -29,36 +37,59 @@ function errorPage($msg) { } // Command to execute at the end of the script -function endScript($msg = "") { +function endScript($msg = "",$display = false) { // Remove lock file unlink(__DIR__ . '/deploy.lock'); + // Flush buffer and prepare output for log and email ob_end_flush(); global $output; + // Remove
,