Skip to content

Commit

Permalink
Improvements to fatal error page generation (joomla#31743)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Feb 25, 2021
1 parent cdea542 commit fdba1b1
Show file tree
Hide file tree
Showing 13 changed files with 215 additions and 161 deletions.
2 changes: 1 addition & 1 deletion administrator/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
die(
str_replace(
'{{PHP_VERSION}}',
'{{phpversion}}',
JOOMLA_MINIMUM_PHP,
file_get_contents(dirname(__FILE__) . '/../templates/system/incompatible.html')
)
Expand Down
36 changes: 18 additions & 18 deletions build/build-modules-js/error-pages.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ const srcPath = `${RootPath}/build/warning_page`;
module.exports.createErrorPages = async (options) => {
const iniFilesProcess = [];
const processPages = [];
this.incompleteObj = {};
this.unsupportedObj = {};
this.fatalObj = {};
this.noxmlObj = {};
global.incompleteObj = {};
global.unsupportedObj = {};
global.fatalObj = {};
global.noxmlObj = {};

const initTemplate = await readFile(`${srcPath}/template.html`, { encoding: 'utf8' });
let cssContent = await readFile(`${srcPath}/template.css`, { encoding: 'utf8' });
let jsContent = await readFile(`${srcPath}/template.js`, { encoding: 'utf8' });

const cssMin = await Postcss([Autoprefixer, CssNano]).process(cssContent, { from: undefined });
///

cssContent = cssMin.css;
jsContent = await minify(jsContent);

Expand All @@ -46,22 +46,22 @@ module.exports.createErrorPages = async (options) => {
// Build the variables into json for the unsupported page
if (languageStrings.MIN_PHP_ERROR_LANGUAGE) {
const name = dirname(file).replace(/.+\//, '').replace(/.+\\/, '');
this.unsupportedObj = {
...this.unsupportedObj,
global.unsupportedObj = {
...global.unsupportedObj,
[name]: {
language: languageStrings.MIN_PHP_ERROR_LANGUAGE,
header: languageStrings.MIN_PHP_ERROR_HEADER,
text1: languageStrings.MIN_PHP_ERROR_TEXT,
'help-url-text': languageStrings.MIN_PHP_ERROR_URL_TEXT,
language: languageStrings.BUILD_MIN_PHP_ERROR_LANGUAGE,
header: languageStrings.BUILD_MIN_PHP_ERROR_HEADER,
text1: languageStrings.BUILD_MIN_PHP_ERROR_TEXT,
'help-url-text': languageStrings.BUILD_MIN_PHP_ERROR_URL_TEXT,
},
};
}

// Build the variables into json for the build incomplete page
if (languageStrings.BUILD_INCOMPLETE_LANGUAGE) {
const name = dirname(file).replace(/.+\//, '').replace(/.+\\/, '');
this.incompleteObj = {
...this.incompleteObj,
global.incompleteObj = {
...global.incompleteObj,
[name]: {
language: languageStrings.BUILD_INCOMPLETE_LANGUAGE,
header: languageStrings.BUILD_INCOMPLETE_HEADER,
Expand All @@ -74,8 +74,8 @@ module.exports.createErrorPages = async (options) => {
// Build the variables into json for the fatal error page
if (languageStrings.BUILD_FATAL_LANGUAGE) {
const name = dirname(file).replace(/.+\//, '').replace(/.+\\/, '');
this.fatalObj = {
...this.fatalObj,
global.fatalObj = {
...global.fatalObj,
[name]: {
language: languageStrings.BUILD_FATAL_LANGUAGE,
header: languageStrings.BUILD_FATAL_HEADER,
Expand All @@ -88,8 +88,8 @@ module.exports.createErrorPages = async (options) => {
// Build the variables into json for the missing XML error page
if (languageStrings.BUILD_NOXML_LANGUAGE) {
const name = dirname(file).replace(/.+\//, '').replace(/.+\\/, '');
this.noxmlObj = {
...this.noxmlObj,
global.noxmlObj = {
...global.noxmlObj,
[name]: {
language: languageStrings.BUILD_NOXML_LANGUAGE,
header: languageStrings.BUILD_NOXML_HEADER,
Expand All @@ -112,7 +112,7 @@ module.exports.createErrorPages = async (options) => {
});

const processPage = async (name) => {
const jsonContent = `window.errorLocale=${JSON.stringify(this[`${name}Obj`])};`;
const jsonContent = `window.errorLocale=${JSON.stringify(global[`${name}Obj`])};`;

let template = initTemplate;

Expand Down
20 changes: 17 additions & 3 deletions build/build-modules-js/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,6 @@
},
"errorPages": {
"incomplete": {
"phpVersionReplaceble": "",
"title": "Joomla: Environment Setup Incomplete",
"header": "Environment Setup Incomplete",
"text": "It looks like you are trying to run Joomla! from our git repository. To do so requires you complete a couple of extra steps first.",
Expand All @@ -772,13 +771,28 @@
"destFile": "/templates/system/build_incomplete.html"
},
"unsupported": {
"phpVersionReplaceble": "data-php-version=\"{{PHP_VERSION}}\"",
"title": "Joomla: unsupported PHP version",
"header": "Sorry, your PHP version is not supported",
"text": "Your host needs to use PHP version {{PHP_VERSION}} or newer to run this version of Joomla!",
"text": "Your host needs to use PHP version {{phpversion}} or newer to run this version of Joomla!",
"link": "J4.x:Unsupported_PHP_Version",
"linkText": "Help me resolve this",
"destFile": "/templates/system/incompatible.html"
},
"noxml": {
"title": "Joomla: Missing PHP-XML library",
"header": "Sorry, your PHP is missing a vital library",
"text": "Your host needs to use PHP with support for the XML library to run this version of Joomla!",
"link": "J4.x:Missing_XML_Library",
"linkText": "Help me resolve this",
"destFile": "/media/system/html/noxml.html"
},
"fatal": {
"title": "An Error Occurred: {{statusText}}",
"header": "Sorry, there was a problem we could not recover from.",
"text": "The server returned a \"{{statusCode_statusText}}\"",
"link": "J4.x:FatalError",
"linkText": "Help me resolve this",
"destFile": "/templates/system/fatal-error.html"
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions build/warning_page/template.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
html {
background: #ee2a00;
background: -moz-radial-gradient(center, ellipse cover, rgba(241, 241, 241, 1) 0, rgb(238, 42, 0) 100%);
background: -webkit-radial-gradient(center, ellipse cover, rgba(241, 241, 241, 1) 0, rgb(238, 42, 0) 100%);
background: radial-gradient(ellipse at center, rgba(241, 241, 241, 1) 0, rgb(238, 42, 0) 100%);
background-repeat: no-repeat;
background-attachment: fixed
}

body {
margin: 0;
padding: 0;
Expand All @@ -6,15 +15,6 @@ body {
background-color: transparent
}

html {
background: rgb(241,241,241);
background: -moz-radial-gradient(center, ellipse cover, rgba(241,241,241,1) 0%, rgba(58,146,200,1) 100%);
background: -webkit-radial-gradient(center, ellipse cover, rgba(241,241,241,1) 0%,rgba(58,146,200,1) 100%);
background: radial-gradient(ellipse at center, rgba(241,241,241,1) 0%,rgba(58,146,200,1) 100%);
background-repeat: no-repeat;
background-attachment: fixed;
}

ol, ul {
padding: 0;
margin: 0;
Expand Down
61 changes: 30 additions & 31 deletions build/warning_page/template.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Language" content="en-GB">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{Title}}</title><!-- Sets the page title, IMPORTANT DO NOT REMOVE -->
<style>{{cssContents}}</style><!-- Sets the page styling, IMPORTANT DO NOT REMOVE -->
<script>{{jsonContents}}</script><!-- Sets the content of the translated text, IMPORTANT DO NOT REMOVE -->
<meta charset="utf-8">
<meta http-equiv="Content-Language" content="en-GB">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{Title}}</title><!-- Sets the page title, IMPORTANT DO NOT REMOVE -->
<style>{{cssContents}}</style><!-- Sets the page styling, IMPORTANT DO NOT REMOVE -->
<script>{{jsonContents}}</script><!-- Sets the content of the translated text, IMPORTANT DO NOT REMOVE -->
</head>
<body {{PHP_VERSION}}><!-- Sets the minimum PHP version, IMPORTANT DO NOT REMOVE -->
<body>
<div class="container">
<div class="container-main">
<div class="alert-main">
<h1 id="headerText">{{Header}}</h1><!-- Sets the page header, IMPORTANT DO NOT REMOVE -->
<p><span id="descText1">{{Description}}</span></p><!-- Sets the page description, IMPORTANT DO NOT REMOVE -->
<p><a id="linkHelp" class="link-help" target="_blank" rel="noreferrer noopener" href="https://docs.joomla.org/Special:MyLanguage/{{Link}}">{{LinkText}}</a></p><!-- Sets the help page link, IMPORTANT DO NOT REMOVE -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 74.8 74.8" enable-background="new 0 0 74.8 74.8" xml:space="preserve">
<g id="brandmark">
<path id="j-green" fill="#fff" d="M13.5,37.7L12,36.3c-4.5-4.5-5.8-10.8-4.2-16.5c-4.5-1-7.8-5-7.8-9.8c0-5.5,4.5-10,10-10 c5,0,9.1,3.6,9.9,8.4c5.4-1.3,11.3,0.2,15.5,4.4l0.6,0.6l-7.4,7.4l-0.6-0.6c-2.4-2.4-6.3-2.4-8.7,0c-2.4,2.4-2.4,6.3,0,8.7l1.4,1.4 l7.4,7.4l7.8,7.8l-7.4,7.4l-7.8-7.8L13.5,37.7L13.5,37.7z"/>
<path id="j-orange" fill="#fff" d="M21.8,29.5l7.8-7.8l7.4-7.4l1.4-1.4C42.9,8.4,49.2,7,54.8,8.6C55.5,3.8,59.7,0,64.8,0 c5.5,0,10,4.5,10,10c0,5.1-3.8,9.3-8.7,9.9c1.6,5.6,0.2,11.9-4.2,16.3l-0.6,0.6l-7.4-7.4l0.6-0.6c2.4-2.4,2.4-6.3,0-8.7 c-2.4-2.4-6.3-2.4-8.7,0l-1.4,1.4L37,29l-7.8,7.8L21.8,29.5L21.8,29.5z"/>
<path id="j-red" fill="#fff" d="M55,66.8c-5.7,1.7-12.1,0.4-16.6-4.1l-0.6-0.6l7.4-7.4l0.6,0.6c2.4,2.4,6.3,2.4,8.7,0 c2.4-2.4,2.4-6.3,0-8.7L53,45.1l-7.4-7.4l-7.8-7.8l7.4-7.4l7.8,7.8l7.4,7.4l1.5,1.5c4.2,4.2,5.7,10.2,4.4,15.7 c4.9,0.7,8.6,4.9,8.6,9.9c0,5.5-4.5,10-10,10C60,74.8,56,71.3,55,66.8L55,66.8z"/>
<path id="j-blue" fill="#fff" d="M52.2,46l-7.8,7.8L37,61.2l-1.4,1.4c-4.3,4.3-10.3,5.7-15.7,4.4c-1,4.5-5,7.8-9.8,7.8 c-5.5,0-10-4.5-10-10C0,60,3.3,56.1,7.7,55C6.3,49.5,7.8,43.5,12,39.2l0.6-0.6L20,46l-0.6,0.6c-2.4,2.4-2.4,6.3,0,8.7 c2.4,2.4,6.3,2.4,8.7,0l1.4-1.4l7.4-7.4l7.8-7.8L52.2,46L52.2,46z"/>
</g>
</svg>
</div>
<div class="footer">
<select id="translatedLanguagesSelect"></select>
<ul class="links">
<li><a href="https://www.joomla.org/">Joomla</a></li> -
<li><a href="https://docs.joomla.org/">Help</a></li>
</ul>
</div>
</div>
<div class="container-main">
<div class="alert-main">
<h1 id="headerText">{{Header}}</h1><!-- Sets the page header, IMPORTANT DO NOT REMOVE -->
<p><span id="descText1">{{Description}}</span></p><!-- Sets the page description, IMPORTANT DO NOT REMOVE -->
<p><a id="linkHelp" class="link-help" target="_blank" rel="noreferrer noopener" href="https://docs.joomla.org/Special:MyLanguage/{{Link}}">{{LinkText}}</a></p><!-- Sets the help page link, IMPORTANT DO NOT REMOVE -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 74.8 74.8" enable-background="new 0 0 74.8 74.8" xml:space="preserve">
<g id="brandmark">
<path id="j-green" fill="#fff" d="M13.5,37.7L12,36.3c-4.5-4.5-5.8-10.8-4.2-16.5c-4.5-1-7.8-5-7.8-9.8c0-5.5,4.5-10,10-10 c5,0,9.1,3.6,9.9,8.4c5.4-1.3,11.3,0.2,15.5,4.4l0.6,0.6l-7.4,7.4l-0.6-0.6c-2.4-2.4-6.3-2.4-8.7,0c-2.4,2.4-2.4,6.3,0,8.7l1.4,1.4 l7.4,7.4l7.8,7.8l-7.4,7.4l-7.8-7.8L13.5,37.7L13.5,37.7z"/>
<path id="j-orange" fill="#fff" d="M21.8,29.5l7.8-7.8l7.4-7.4l1.4-1.4C42.9,8.4,49.2,7,54.8,8.6C55.5,3.8,59.7,0,64.8,0 c5.5,0,10,4.5,10,10c0,5.1-3.8,9.3-8.7,9.9c1.6,5.6,0.2,11.9-4.2,16.3l-0.6,0.6l-7.4-7.4l0.6-0.6c2.4-2.4,2.4-6.3,0-8.7 c-2.4-2.4-6.3-2.4-8.7,0l-1.4,1.4L37,29l-7.8,7.8L21.8,29.5L21.8,29.5z"/>
<path id="j-red" fill="#fff" d="M55,66.8c-5.7,1.7-12.1,0.4-16.6-4.1l-0.6-0.6l7.4-7.4l0.6,0.6c2.4,2.4,6.3,2.4,8.7,0 c2.4-2.4,2.4-6.3,0-8.7L53,45.1l-7.4-7.4l-7.8-7.8l7.4-7.4l7.8,7.8l7.4,7.4l1.5,1.5c4.2,4.2,5.7,10.2,4.4,15.7 c4.9,0.7,8.6,4.9,8.6,9.9c0,5.5-4.5,10-10,10C60,74.8,56,71.3,55,66.8L55,66.8z"/>
<path id="j-blue" fill="#fff" d="M52.2,46l-7.8,7.8L37,61.2l-1.4,1.4c-4.3,4.3-10.3,5.7-15.7,4.4c-1,4.5-5,7.8-9.8,7.8 c-5.5,0-10-4.5-10-10C0,60,3.3,56.1,7.7,55C6.3,49.5,7.8,43.5,12,39.2l0.6-0.6L20,46l-0.6,0.6c-2.4,2.4-2.4,6.3,0,8.7 c2.4,2.4,6.3,2.4,8.7,0l1.4-1.4l7.4-7.4l7.8-7.8L52.2,46L52.2,46z"/>
</g>
</svg>
</div>
<div class="footer">
<select id="translatedLanguagesSelect"></select>
<ul class="links">
<li><a href="https://www.joomla.org/">Joomla</a></li> -
<li><a href="https://docs.joomla.org/">Help</a></li>
</ul>
</div>
</div>
</div>
<script>{{jsContents}}</script><!-- Sets the script, IMPORTANT DO NOT REMOVE -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
die(
str_replace(
'{{PHP_VERSION}}',
'{{phpversion}}',
JOOMLA_MINIMUM_PHP,
file_get_contents(dirname(__FILE__) . '/templates/system/incompatible.html')
)
Expand Down
4 changes: 2 additions & 2 deletions installation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
{
die(
str_replace(
array('{{PHP_VERSION}}', '{{BASEPATH}}'),
array(JOOMLA_MINIMUM_PHP, 'http://' . $_SERVER['SERVER_NAME'] . '/'),
'{{phpversion}}',
JOOMLA_MINIMUM_PHP,
file_get_contents(dirname(__FILE__) . '/../templates/system/incompatible.html')
)
);
Expand Down
22 changes: 18 additions & 4 deletions installation/language/en-GB/joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,33 @@
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

; Fatal error page
; These will be processed by the JavaScript Build
BUILD_FATAL_HEADER="Sorry, there was a problem we could not recover from."
BUILD_FATAL_LANGUAGE="English GB"
BUILD_FATAL_TEXT="The server returned a \"{{statusCode_statusText}}\""
BUILD_FATAL_URL_TEXT="Help me resolve this"

; Build incomplete error page
; These will be processed by the JavaScript Build
BUILD_INCOMPLETE_HEADER="Environment Setup Incomplete"
BUILD_INCOMPLETE_LANGUAGE="English GB"
BUILD_INCOMPLETE_TEXT="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."
BUILD_INCOMPLETE_URL_TEXT="More Details"

; No XML PHP error page
; These will be processed by the JavaScript Build
BUILD_NOXML_HEADER="Sorry, your PHP is missing a vital library"
BUILD_NOXML_LANGUAGE="English GB"
BUILD_NOXML_TEXT="Your host needs to use PHP with support for the XML library to run this version of Joomla!"
BUILD_NOXML_URL_TEXT="Help me resolve this"

; Minimum PHP error page
; These will be processed by the JavaScript Build
MIN_PHP_ERROR_HEADER="Sorry, your PHP version is not supported."
MIN_PHP_ERROR_LANGUAGE="English GB"
MIN_PHP_ERROR_TEXT="Your host needs to use PHP version {{phpversion}} or newer to run this version of Joomla."
MIN_PHP_ERROR_URL_TEXT="Help me resolve this"
BUILD_MIN_PHP_ERROR_HEADER="Sorry, your PHP version is not supported."
BUILD_MIN_PHP_ERROR_LANGUAGE="English GB"
BUILD_MIN_PHP_ERROR_TEXT="Your host needs to use PHP version {{phpversion}} or newer to run this version of Joomla."
BUILD_MIN_PHP_ERROR_URL_TEXT="Help me resolve this"

; Main Config
INSTL_SELECT_INSTALL_LANG="Select Installation Language"
Expand Down
23 changes: 19 additions & 4 deletions installation/language/en-US/joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

; Fatal error page
; These will be processed by the JavaScript Build
BUILD_FATAL_HEADER="Sorry, there was a problem we could not recover from."
BUILD_FATAL_LANGUAGE="English US"
BUILD_FATAL_TEXT="The server returned a \"{{statusCode_statusText}}\""
BUILD_FATAL_URL_TEXT="Help me resolve this"

; Build incomplete error page
; These will be processed by the JavaScript Build
BUILD_INCOMPLETE_HEADER="Environment Setup Incomplete"
Expand All @@ -12,10 +19,18 @@ BUILD_INCOMPLETE_URL_TEXT="More Details"

; Minimum PHP error page
; These will be processed by the JavaScript Build
MIN_PHP_ERROR_HEADER="Sorry, your PHP version is not supported."
MIN_PHP_ERROR_LANGUAGE="English US"
MIN_PHP_ERROR_TEXT="Your host needs to use PHP version {{phpversion}} or newer to run this version of Joomla."
MIN_PHP_ERROR_URL_TEXT="Help me resolve this"
BUILD_MIN_PHP_ERROR_HEADER="Sorry, your PHP version is not supported."
BUILD_MIN_PHP_ERROR_LANGUAGE="English US"
BUILD_MIN_PHP_ERROR_TEXT="Your host needs to use PHP version {{phpversion}} or newer to run this version of Joomla."
BUILD_MIN_PHP_ERROR_URL_TEXT="Help me resolve this"

; No XML PHP error page
; These will be processed by the JavaScript Build
BUILD_NOXML_HEADER="Sorry, your PHP is missing a vital library"
BUILD_NOXML_LANGUAGE="English US"
BUILD_NOXML_TEXT="Your host needs to use PHP with support for the XML library to run this version of Joomla!"
BUILD_NOXML_URL_TEXT="Help me resolve this"


; Main Config
INSTL_SELECT_INSTALL_LANG="Select Installation Language"
Expand Down
Loading

0 comments on commit fdba1b1

Please sign in to comment.