Skip to content

Commit bdb23b8

Browse files
MacJoomrichard67QuyTon
authored
[4.4] Postinstallation-Message htaccess.txt brotli change (#43173)
* [4.4] Postinstallation-Message htaccess.txt brotli change * Fix copyright year Co-authored-by: Quy <[email protected]> --------- Co-authored-by: Richard Fath <[email protected]> Co-authored-by: Quy <[email protected]>
1 parent 0439943 commit bdb23b8

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/**
4+
* @package Joomla.Administrator
5+
* @subpackage com_admin
6+
*
7+
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
8+
* @license GNU General Public License version 2 or later; see LICENSE.txt
9+
*
10+
* This file contains post-installation message handling for notifying users of a change
11+
* in the default .htaccess file regarding setting the Content-Encoding header.
12+
*/
13+
14+
// phpcs:disable PSR1.Files.SideEffects
15+
\defined('_JEXEC') or die;
16+
// phpcs:enable PSR1.Files.SideEffects
17+
18+
/**
19+
* Notifies users of a change in the default .htaccess file regarding setting for brotli to prevent double compression
20+
*
21+
* This check returns true regardless of condition.
22+
*
23+
* @return boolean
24+
*
25+
* @since 4.4.4
26+
*/
27+
function admin_postinstall_htaccessbrotli_condition()
28+
{
29+
return true;
30+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--
2+
-- Add post-installation message about setting the Content-Encoding header in .htaccess
3+
--
4+
INSERT IGNORE INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`)
5+
SELECT `extension_id`, 'COM_ADMIN_POSTINSTALL_MSG_HTACCESS_BROTLI_TITLE', 'COM_ADMIN_POSTINSTALL_MSG_HTACCESS_BROTLI_DESCRIPTION', '', 'com_admin', 1, 'message', '', '', 'admin://components/com_admin/postinstall/htaccessbrotli.php', 'admin_postinstall_htaccessbrotli_condition', '4.4.4', 1 FROM `#__extensions` WHERE `name` = 'files_joomla';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--
2+
-- Add post-installation message about setting the Content-Encoding header in .htaccess
3+
--
4+
INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled")
5+
SELECT "extension_id", 'COM_ADMIN_POSTINSTALL_MSG_HTACCESS_BROTLI_TITLE', 'COM_ADMIN_POSTINSTALL_MSG_HTACCESS_BROTLI_DESCRIPTION', '', 'com_admin', 1, 'message', '', '', 'admin://components/com_admin/postinstall/htaccessbrotli.php', 'admin_postinstall_htaccessbrotli_condition', '4.4.4', 1 FROM "#__extensions" WHERE "name" = 'files_joomla'
6+
ON CONFLICT DO NOTHING;

administrator/language/en-GB/com_admin.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ COM_ADMIN_POSTINSTALL_MSG_HTACCESS_AUTOINDEX_DESCRIPTION="<p>Before 3.9.22 the d
172172
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_AUTOINDEX_TITLE=".htaccess Update Concerning Directory Listings"
173173
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_SETCE_DESCRIPTION="<p>Before 4.2.9 the default htaccess.txt file contained erroneous code for appending the \"Content-Encoding\" HTTP header. This could result in double encoding errors when Joomla is installed in a subdirectory and both this directory and its parent directory contain an .htaccess file with this code. You should manually apply the necessary changes to any existing .htaccess file, as this file can not be updated automatically.</p><p>The old code:</p><pre>Header append Content-Encoding gzip</pre><p>The new code:</p><pre>Header set Content-Encoding gzip</pre>"
174174
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_SETCE_TITLE=".htaccess Update Concerning Setting the Content-Encoding Header"
175+
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_BROTLI_DESCRIPTION="<p>Before 4.4.4 the default htaccess.txt did not support Brotli compression. This could result in double compression errors when Joomla is installed on a server that uses Brotli compression. You should manually apply the necessary changes to any existing .htaccess file, as this file can not be updated automatically.</p><p>The old code:</p><pre>RewriteRule \"\.css\.gz$\" \"-\" [T=text/css,E=no-gzip:1]<br>RewriteRule \"\.js\.gz$\" \"-\" [T=text/javascript,E=no-gzip:1]</pre><p>The new code:</p><pre>RewriteRule \"\.css\.gz$\" \"-\" [T=text/css,E=no-gzip:1,E=no-brotli:1]<br>RewriteRule \"\.js\.gz$\" \"-\" [T=text/javascript,E=no-gzip:1,E=no-brotli:1]</pre>"
176+
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_BROTLI_TITLE=".htaccess Update Brotli Compression"
175177
COM_ADMIN_SAVE_SUCCESS="Profile saved."
176178
COM_ADMIN_SESSION_AUTO_START="Session Auto Start"
177179
COM_ADMIN_SESSION_SAVE_PATH="Session Save Path"

0 commit comments

Comments
 (0)