The code has been refactored to improve readability and maintainability. The main changes include removing unnecessary condition checks, simplifying the flow of control, and reorganizing the code blocks for better logical grouping. This should make it easier to understand and modify in the future.
The shell_exec command in index.php has been updated to include the document root in the script path. This change ensures that the correct script is executed regardless of the current working directory.
The cache directory name for the Twig environment has been updated. The previous hyphen-separated name 'twig-cache' has been replaced with an underscore-separated one, 'twig_cache'. This change ensures consistency in naming conventions across the project.
This commit introduces a new Dockerfile that sets up a PHP 8.3 environment with Apache. It includes the following significant changes:
- Sets the working directory to /var/www/html
- Copies current directory contents into the container
- Installs Composer and activates mod_rewrite
- Installs Process Control extension using curl command
- Runs composer install to fetch dependencies
- Exposes port 9050 and modifies Apache configuration to listen on this port
- Adds environment variables to Apache configuration
- Changes ownership of /var/www/html to www-data user
- Starts the Apache server using apache2-foreground command
A new .htaccess file has been added to handle URL rewriting. The index.php file has been significantly refactored for improved readability and performance. A large portion of the original code was moved to a separate script.php file, which is now executed from within index.php. This change simplifies the main entry point of the application and separates concerns more effectively. Additionally, minor changes were made to cache handling in script.php.
A newline has been added to the metrics.twig template to improve code readability. This change separates different sections of the code, making it easier to understand and maintain.
- Implement parallel processing using pcntl_fork for HTTP requests
- Handle different types of HTTP data retrieval and response codes
- Set fallback values if necessary based on configuration
- Added a condition to check for an empty array before accessing its elements in the getArrayValue function. This prevents potential errors when trying to access values from an empty array.
Improved handling of submetrics for better data organization and presentation. Updated metric values based on retrieved data, ensuring accurate representation in the metrics template file.
The code now checks if the request URI is '/metrics' or if the PHP script is running from the command line interface (CLI). This change allows for proper handling of CLI requests in addition to web requests.
- Refactored HTTP handling to use nested arrays for options
- Updated Guzzle requests based on new array structure
- Adjusted Twig cache configuration in the code