-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.2] Add offline mode support in the API #34151
base: 5.2-dev
Are you sure you want to change the base?
Conversation
@wilsonge I assume you meant "offline mode" and not "API mode", or there is a new feature "API mode" in J4 of which I don't know yet. |
@wilsonge It seems you have to adjust the API tests to the changes in this PR. Currently they fail with:
|
Yup I did mean Offline mode - fixed that. Will look at tests tonight :) |
Tests fixed |
humm got 500 shoduln't be 503 ? {
"errors": [
{
"code": 500,
"title": "Internal server error",
"detail": "Joomla\\CMS\\Application\\Exception\\OfflineWebsiteException: This site is down for maintenance.<br />Please check back again soon. in /var/www/html/cloud/libraries/src/Application/ApiApplication.php:162\nStack trace:\n#0 /var/www/html/cloud/libraries/src/Application/CMSApplication.php(284): Joomla\\CMS\\Application\\ApiApplication->render()\n#1 /var/www/html/cloud/api/includes/app.php(54): Joomla\\CMS\\Application\\CMSApplication->execute()\n#2 /var/www/html/cloud/api/index.php(31): require_once('/var/www/html/c...')\n#3 {main}"
}
]
} |
163f7df
to
8501b40
Compare
Fixed |
something is going wrong in your merge
|
remove InstallLanguageExceptionHandler
i dunno if this was already there... my usual dirty hack wilsonge#67 |
That one is a bit hacky :) will debug when I’m in front of my laptop this evening. May be there’s nothing better but 🤷♂️ |
@@ -146,8 +146,32 @@ public function addFormatMap($contentHeader, $format) | |||
*/ | |||
protected function render() | |||
{ | |||
// Trigger the onBeforeRender event. | |||
PluginHelper::importPlugin('system'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this event triggering, so we can merge it in 4.3 and make a new pr on 5.0. I fear these events will have some undesired effect, so it is better to add it in 5.0 and document it properly.
// Render the document | ||
$this->setBody($this->document->render($this->allowCache())); | ||
|
||
// Trigger the onAfterRender event. | ||
$this->triggerEvent('onAfterRender'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as comment above.
@wilsonge any interest to move this one forward? |
This pull request has been automatically rebased to 5.0-dev. No new features will be merged into Joomla! 4.3 series. Joomla! 4.4 series is a bridge release to make migration from Joomla! 4 to 5 as smooth as possible. |
This pull request has been automatically rebased to 5.1-dev. |
This pull request has been automatically rebased to 5.2-dev. |
Pull Request for Issue # .
Summary of Changes
Adds support for the
onBeforeRender
andonAfterRender
events to the API. It should be noted our core plugin correctly checks for html document types or if in site/admin modes in most places. The only exception to this is the cache plugin. However I think this won't change much because we don't callonAfterRoute
in the API which does all the initialisation anyhow.Adds support for offline mode to the API - if the site is in offline mode the API now should not be made available to users who cannot access it alongside an appropriate 503 status code
Testing Instructions
Turn on Offline mode. Before this PR check that the API is accessible. After PR you get a 503 error code.
For the Plugin events this should be as easy as dropping some test functions into an existing plugin.
Documentation Changes Required
N/A