Skip to content

feat(preflight): add an initial preflight check#988

Merged
JohnVillalovos merged 1 commit intodevelopfrom
jlvillal/preflight
Feb 10, 2026
Merged

feat(preflight): add an initial preflight check#988
JohnVillalovos merged 1 commit intodevelopfrom
jlvillal/preflight

Conversation

@JohnVillalovos
Copy link
Collaborator

Add composer preflight command that validates PHP version, extensions, configuration, writable directories, and database connectivity. Move bcmath from required to optional extensions (only needed for Active Directory authentication). Database failures are reported as warnings with guidance to run the installer at http:///Web/install/.

Copilot AI review requested due to automatic review settings February 10, 2026 02:00
@JohnVillalovos JohnVillalovos marked this pull request as draft February 10, 2026 02:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a standalone “preflight” CLI command to validate a LibreBooking installation’s runtime prerequisites (PHP environment, filesystem, config, and database reachability) before or during setup.

Changes:

  • Introduces lib/preflight.php runner with checks for PHP version/extensions, composer deps, config validity, writable dirs, and DB connectivity/schema presence.
  • Adds composer preflight script entry and documents the preflight workflow in installation docs.
  • Updates published requirements to move bcmath to optional and clarify required/optional PHP extensions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
lib/preflight.php New standalone preflight checker and CLI entrypoint.
docs/source/INSTALLATION.rst Documents preflight usage and updates composer install guidance.
composer.json Adds preflight composer script.
README.md Updates required/optional PHP extension lists.
Comments suppressed due to low confidence (1)

docs/source/INSTALLATION.rst:60

  • The installation instructions now use composer install without --no-dev. For production installs this will pull in dev-only tooling (phpunit/phpstan/phpcs), increasing install time and potentially widening the dependency surface without providing runtime value. Consider restoring guidance to use composer install --no-dev for deployments (and mention plain composer install only for contributors).
   .. code-block:: bash

       cd librebooking
       # Install without the developer dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 258 to 264
$config = @include $configPath;

if (!is_array($config)) {
return new CheckResult(
status: CheckStatus::Fail,
label: 'Configuration file: config/config.php did not return a valid array',
message: "Ensure the file returns an array with a 'settings' key. See config/config.dist.php for reference.",
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@include $configPath suppresses parse/runtime warnings from config.php, which can make it hard to diagnose why the config is considered invalid. Consider checking is_readable($configPath) and/or surfacing the underlying include error (e.g., capture error_get_last()) in the failure message.

Suggested change
$config = @include $configPath;
if (!is_array($config)) {
return new CheckResult(
status: CheckStatus::Fail,
label: 'Configuration file: config/config.php did not return a valid array',
message: "Ensure the file returns an array with a 'settings' key. See config/config.dist.php for reference.",
if (!is_readable($configPath)) {
return new CheckResult(
status: CheckStatus::Fail,
label: 'Configuration file: config/config.php is not readable',
message: "The configuration file at '{$configPath}' exists but is not readable. Check file permissions and ownership.",
);
}
$previousError = error_get_last();
$config = include $configPath;
$lastError = error_get_last();
$includeErrorMessage = null;
if ($lastError !== null && $lastError !== $previousError) {
$includeErrorMessage = $lastError['message'] ?? null;
}
if (!is_array($config)) {
$message = "Ensure the file returns an array with a 'settings' key. See config/config.dist.php for reference.";
if ($includeErrorMessage !== null) {
$message .= " Last PHP error while including config.php: {$includeErrorMessage}";
}
return new CheckResult(
status: CheckStatus::Fail,
label: 'Configuration file: config/config.php did not return a valid array',
message: $message,

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JohnVillalovos JohnVillalovos force-pushed the jlvillal/preflight branch 3 times, most recently from ea6810d to af64d0d Compare February 10, 2026 06:23
Add `composer preflight` command that validates PHP version, extensions,
configuration, writable directories, and database connectivity. Move
bcmath from required to optional extensions (only needed for Active
Directory authentication). Database failures are reported as
failures/warnings with guidance to run the installer at
http://<your-server>/Web/install/.
@JohnVillalovos JohnVillalovos merged commit 0d9b0ce into develop Feb 10, 2026
11 checks passed
@JohnVillalovos JohnVillalovos deleted the jlvillal/preflight branch February 10, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant