X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/0155525945bb030ae2265279dca8014c8cdcb2af..refs/pull/3391/head:/app/Theming/ThemeService.php diff --git a/app/Theming/ThemeService.php b/app/Theming/ThemeService.php index 6fe80559e..275dc9d8c 100644 --- a/app/Theming/ThemeService.php +++ b/app/Theming/ThemeService.php @@ -3,6 +3,9 @@ namespace BookStack\Theming; use BookStack\Auth\Access\SocialAuthService; +use Illuminate\Console\Application; +use Illuminate\Console\Application as Artisan; +use Symfony\Component\Console\Command\Command; class ThemeService { @@ -43,13 +46,23 @@ class ThemeService return null; } + /** + * Register a new custom artisan command to be available. + */ + public function registerCommand(Command $command) + { + Artisan::starting(function (Application $application) use ($command) { + $application->addCommands([$command]); + }); + } + /** * Read any actions from the set theme path if the 'functions.php' file exists. */ public function readThemeActions() { $themeActionsFile = theme_path('functions.php'); - if (file_exists($themeActionsFile)) { + if ($themeActionsFile && file_exists($themeActionsFile)) { require $themeActionsFile; } }