The update includes the addition of a new '/config' endpoint in index.php, which returns the application's configuration as a JSON response. A corresponding link to this new endpoint has also been added to the 404 error page.
In the Dockerfile, a new command has been added to install git. This allows for more flexibility in managing code versions within the container. In addition, a new endpoint '/version' has been introduced in index.php which returns JSON data about the last commit, its timestamp and the current branch. This provides an easy way to check versioning information directly from the application.
The code changes include an update to the response handling in index.php. Now, it checks if the request URI is '/metrics'. If so, it continues with the previous behavior of executing a script and outputting its result. If not, it loads a new 404 error page using Twig templating engine.
A new file '404.twig' has been added under templates directory which serves as a custom 404 error page. It displays the requested URI and provides a link back to '/metrics'.
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.
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.
- 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