From ce46c8b6f50651843e678984343c2193e1652da9 Mon Sep 17 00:00:00 2001 From: purple Date: Thu, 31 Aug 2023 10:51:44 +0200 Subject: [PATCH] Add yet even more comments and tell what a lot of things do. Improves readability a ton, trust me. --- .../Extensions/Blueprint/BlueprintExtensionController.php | 5 +++++ blueprint.sh | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php b/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php index 6a1cf05..8147000 100644 --- a/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php +++ b/app/Http/Controllers/Admin/Extensions/Blueprint/BlueprintExtensionController.php @@ -75,13 +75,18 @@ class BlueprintExtensionController extends Controller $this->settings->set('blueprint::' . $key, $value); } + // Confirm that the database value changes have been applied. $this->bplib->notify("Your changes have been saved."); + // Redirect back to the page the user was on. return redirect()->route('admin.extensions.blueprint.index'); } } class BlueprintAdminFormRequest extends AdminFormRequest { + // Form validation for settings on the Blueprint admin page. + // This is included in the controller directly as that + // simplifies my work. public function rules(): array { return [ 'placeholder' => 'string', diff --git a/blueprint.sh b/blueprint.sh index 30eaefd..069b862 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -811,6 +811,8 @@ fi if [[ $2 == "-init" ]]; then VCMD="y" if [[ $(cat .blueprint/data/internal/db/developer) != "true"* ]]; then quit_red "[FATAL] Developer mode is not enabled.";exit 1;fi + # To prevent accidental wiping of your dev directory, you are unable to initialize another extension + # until you wipe the contents of the .blueprint/dev directory. if [[ -n $(find .blueprint/dev -maxdepth 1 -type f -not -name "README.md" -print -quit) ]]; then quit_red "[FATAL] Your development directory contains files. To protect you against accidental data loss, you are unable to initialize another extension unless you clear your .blueprint/dev folder." fi @@ -828,6 +830,7 @@ if [[ $2 == "-init" ]]; then VCMD="y" fi if [[ $REDO_NAME == true ]]; then + # Ask again if response does not pass validation. ask_name fi } @@ -853,6 +856,7 @@ if [[ $2 == "-init" ]]; then VCMD="y" fi if [[ $REDO_IDENTIFIER == true ]]; then + # Ask again if response does not pass validation. ask_identifier fi } @@ -870,6 +874,7 @@ if [[ $2 == "-init" ]]; then VCMD="y" fi if [[ $REDO_DESCRIPTION == true ]]; then + # Ask again if response does not pass validation. ask_description fi } @@ -887,6 +892,7 @@ if [[ $2 == "-init" ]]; then VCMD="y" fi if [[ $REDO_VERSION == true ]]; then + # Ask again if response does not pass validation. ask_version fi } @@ -904,6 +910,7 @@ if [[ $2 == "-init" ]]; then VCMD="y" fi if [[ $REDO_AUTHOR == true ]]; then + # Ask again if response does not pass validation. ask_author fi }