Language Change ? ? PR-4.3-dev ? Pending

User tests: Successful: Unsuccessful:

avatar wilsonge
wilsonge
23 May 2021

Pull Request for Issue # .

Summary of Changes

Adds support for the onBeforeRender and onAfterRender 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 call onAfterRoute 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

avatar wilsonge wilsonge - open - 23 May 2021
avatar wilsonge wilsonge - change - 23 May 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 May 2021
Category Libraries Front End Plugins
avatar wilsonge wilsonge - change - 23 May 2021
Title
Add offline mode support in the API
[4.0] Add offline mode support in the API
avatar wilsonge wilsonge - edited - 23 May 2021
avatar richard67
richard67 - comment - 24 May 2021

Testing instructions
Turn on API mode.

@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.

avatar richard67
richard67 - comment - 24 May 2021

@wilsonge It seems you have to adjust the API tests to the changes in this PR. Currently they fail with:

1) BasicCest: Test route not found
 Test  tests/Codeception/api/BasicCest.php:testRouteNotFound
 Step  See response code is 404
 Fail  Expected HTTP Status Code: 404 (Not Found). Actual Status Code: 503 (Service Unavailable)
Failed asserting that 503 matches expected 404.
avatar wilsonge wilsonge - change - 24 May 2021
The description was changed
avatar wilsonge wilsonge - edited - 24 May 2021
avatar wilsonge
wilsonge - comment - 24 May 2021

Yup I did mean Offline mode - fixed that. Will look at tests tonight :)

avatar wilsonge wilsonge - change - 25 May 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 25 May 2021
Category Libraries Front End Plugins Libraries
avatar wilsonge wilsonge - change - 25 May 2021
The description was changed
avatar wilsonge wilsonge - edited - 25 May 2021
avatar wilsonge
wilsonge - comment - 25 May 2021

Tests fixed

avatar alikon
alikon - comment - 25 May 2021

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}"
        }
    ]
}
avatar wilsonge
wilsonge - comment - 29 May 2021

Fixed

avatar zero-24 zero-24 - change - 30 May 2021
Labels Added: ?
avatar zero-24 zero-24 - change - 30 May 2021
Labels Added: ?
Removed: ?
avatar alikon
alikon - comment - 4 Jun 2021

something is going wrong in your merge

$errors->registerHandler(new InstallLanguageExceptionHandler);

fe93f16

avatar wilsonge wilsonge - change - 4 Jun 2021
Labels Added: ?
Removed: ?
avatar alikon
alikon - comment - 5 Jun 2021

i dunno if this was already there...
anyway with
core.login.offline = false and wrong request articlesx
got this from postman

Screenshot from 2021-06-05 11-07-57

my usual dirty hack wilsonge#67

avatar wilsonge
wilsonge - comment - 5 Jun 2021

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 ?‍♂️

avatar wilsonge wilsonge - change - 19 Aug 2021
Labels Added: ? ?
Removed: ? ?
avatar wilsonge wilsonge - change - 19 Aug 2021
Labels Added: ?
Removed: ?
avatar chmst chmst - change - 31 Jan 2022
Labels Added: ? ?
Removed: ? ?
avatar HLeithner
HLeithner - comment - 27 Jun 2022

This pull request has automatically rebased to 4.2-dev.

avatar joomla-bot
joomla-bot - comment - 27 Jun 2022

This pull requests has been automatically converted to the PSR-12 coding standard.

avatar laoneo laoneo - change - 21 Oct 2022
Labels Added: ? ?
Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 21 Oct 2022
Category Libraries Administration com_categories com_content com_fields com_users Language & Strings
avatar laoneo laoneo - change - 22 Oct 2022
Labels Added: Language Change PR-4.3-dev
avatar joomla-cms-bot joomla-cms-bot - change - 22 Oct 2022
Category Administration com_categories com_content com_fields com_users Language & Strings Libraries
avatar laoneo
laoneo - comment - 27 Oct 2022

@wilsonge any interest to move this one forward?

avatar HLeithner
HLeithner - comment - 8 May 2023

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.

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar HLeithner
HLeithner - comment - 24 Apr 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
[4.0] Add offline mode support in the API
[5.2] Add offline mode support in the API
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] Add offline mode support in the API
[5.3] Add offline mode support in the API
avatar HLeithner HLeithner - edited - 2 Sep 2024

Add a Comment

Login with GitHub to post a comment