Skip to content
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

[4.0] Redo the fatal error pages #31743

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

dgrammatiko
Copy link
Contributor

@dgrammatiko dgrammatiko commented Dec 20, 2020

Pull Request as a helping hand for #30056 and #31735.

Summary of Changes

  • The tool is now creating 4 pages, incompatible, noxml, fatal and incomplete
  • The files are moved to media/system as these are static files
  • Fixed all the paths for this change

Testing Instructions

Run npm install or node build/build.js --build-pages from the root path of your Joomla cloned repo
Check /templates/system for 4 html files: incompatible, noxml, fatal-error and build_incomplete
Open each in your browser (double click also works here)
You should have these:
Screenshot 2020-12-20 at 21 17 57
Screenshot 2020-12-20 at 21 18 07
Screenshot 2020-12-20 at 21 18 17
Screenshot 2020-12-20 at 21 18 26

Testing the actual php requires some editing of files (that's because it needs to kick the error):

  • Front end change < to >
    if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
    and check your front end (eg localhost/)
  • Back end change < to >
    if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
    and check your front end (eg localhost/)
  • Installation change < to >
    if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
    also rename your root configuration.php to configuration.back and check your front end (eg localhost/)
  • Installation change /media/vendor to /media/notexisting
    if (!file_exists(JPATH_LIBRARIES . '/vendor/autoload.php') || !is_dir(JPATH_ROOT . '/media/vendor'))
    also rename your root configuration.php to configuration.back and check your front end (eg localhost/)

There are also 2 more cases that require this PR to be merge, then pull #30056 and 31735 and follow the testing instructions on these PR's

That's all.

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators NPM Resource Changed This Pull Request can't be tested by Patchtester PR-4.0-dev labels Dec 20, 2020
@brianteeman
Copy link
Contributor

Just add your suggestion to this PR and I will close my pr

installation/index.php Outdated Show resolved Hide resolved
installation/includes/app.php Outdated Show resolved Hide resolved
index.php Outdated
Comment on lines 20 to 28
$output = 'Your host needs to use PHP version {{PHP_VERSION}} or newer to run this version of Joomla.';
$template = dirname(__FILE__) . '/media/system/html/incompatible.html';

if (file_exists($template))
{
$output = file_get_contents($template);
}

die(str_replace('{{PHP_VERSION}}', JOOMLA_MINIMUM_PHP, $output));
Copy link
Member

Choose a reason for hiding this comment

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

Is it really needed to make it more complex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, it's just a fallback for the fallback. The reason is that since the files were moved into the media folder these files (assuming that someone is working on a git clone) won't be there until composer + npm install...

Comment on lines 20 to 29
$output = 'It looks like you are trying to run Joomla! from our git repository. '
. 'To do so requires you to complete a couple of extra steps first.';
$template = JPATH_ROOT . '/media/system/html/build_incomplete.html';

if (file_exists($template))
{
$output = file_get_contents($template);
}

die($output);
Copy link
Member

Choose a reason for hiding this comment

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

based on the your comment this file can't exist or is unlikely that you only run npm i?

Whats the benefit to compile this files? I mean it's a error page when something fundamental is wrong and if looks like that creating this files could be one of the problems ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

based on the your comment this file can't exist or is unlikely that you only run npm I?

You can trigger this by cloning the repo and directly serving it (no composer/npm install). I guess not everyone is immediately aware what more needs to be executed before playing with the source (IIRC the Readme has all these infonaut people might skip it)

Whats the benefit to compile this files?

So the compile part essentially is adding some js for switching languages (the script collects all the different language strings from the installation folder creates an object with all the languages and then fills the select element with appropriate language names/tags). The reason for all these complicated steps is just to provide a better UX even when everything failed hardly

@PhilETaylor

This comment was marked as abuse.

@dgrammatiko
Copy link
Contributor Author

@PhilETaylor this PR has conflicts, I'll try to update it tomorrow

@PhilETaylor

This comment was marked as abuse.

@dgrammatiko dgrammatiko force-pushed the 4.0-dev_fatal_error_pages branch from cbb47ca to 90d5eeb Compare February 25, 2021 15:55
@joomla-cms-bot joomla-cms-bot removed the NPM Resource Changed This Pull Request can't be tested by Patchtester label Feb 25, 2021
@dgrammatiko
Copy link
Contributor Author

Commit 90d5eeb

  • resolves conflicts
  • reverts the moving of the produced pages to the media folder

@wilsonge wilsonge merged commit fdba1b1 into joomla:4.0-dev Feb 25, 2021
@wilsonge
Copy link
Contributor

This looks ok to me. Thanks!

@dgrammatiko dgrammatiko deleted the 4.0-dev_fatal_error_pages branch February 25, 2021 16:33
dgrammatiko added a commit to dgrammatiko/joomla-cms that referenced this pull request Feb 25, 2021
@zero-24 zero-24 added this to the Joomla 4.0 milestone Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants