Skip to content

Commit

Permalink
Merge branch 'joomla:4.4-dev' into 4.4-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
conseilgouz committed Apr 7, 2024
2 parents 3791be1 + b8d58e7 commit 6fa19c3
Show file tree
Hide file tree
Showing 36 changed files with 233 additions and 129 deletions.
12 changes: 8 additions & 4 deletions .drone.yml
Expand Up @@ -309,6 +309,10 @@ steps:
- phpmin-system-mysql8
- phpmin-system-postgres
environment:
WEB_SERVER:
from_secret: webserver
FTP_SERVER:
from_secret: ftpserver
FTP_USERNAME:
from_secret: ftpusername
FTP_PASSWORD:
Expand All @@ -317,11 +321,11 @@ steps:
from_secret: github_token
commands:
- export PLUGIN_DEST_DIR=/artifacts/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
- echo https://ci.joomla.org$PLUGIN_DEST_DIR
- rclone config create artifacts ftp host ci.joomla.org user $FTP_USERNAME port 21 pass $FTP_PASSWORD
- echo https://$WEB_SERVER$PLUGIN_DEST_DIR
- rclone config create artifacts ftp host $FTP_SERVER user $FTP_USERNAME port 21 pass $FTP_PASSWORD
- rclone mkdir artifacts:$PLUGIN_DEST_DIR
- rclone copy tests/System/output/ artifacts:$PLUGIN_DEST_DIR
- 'curl -X POST "https://api.github.com/repos/$DRONE_REPO/statuses/$DRONE_COMMIT" -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" -d "{\"state\":\"failure\", \"context\": \"Artifacts from Failure\", \"description\": \"You can find artifacts from the failure of the build here:\", \"target_url\": \"https://ci.joomla.org$PLUGIN_DEST_DIR\"}" > /dev/null'
- 'curl -X POST "https://api.github.com/repos/$DRONE_REPO/statuses/$DRONE_COMMIT" -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" -d "{\"state\":\"failure\", \"context\": \"Artifacts from Failure\", \"description\": \"You can find artifacts from the failure of the build here:\", \"target_url\": \"https://$WEB_SERVER$PLUGIN_DEST_DIR\"}" > /dev/null'
when:
status:
- failure
Expand Down Expand Up @@ -492,6 +496,6 @@ trigger:

---
kind: signature
hmac: 2b23d4286790b54215c985c85304ddd24818802bab49b3afec2144d28dce1f5f
hmac: ca3d5f3a6e39270f147f8f02ca4bc4cca7050f7ab2bcaf0258426e0089cfef5b

...
30 changes: 30 additions & 0 deletions administrator/components/com_admin/postinstall/htaccessbrotli.php
@@ -0,0 +1,30 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* This file contains post-installation message handling for notifying users of a change
* in the default .htaccess file regarding setting the Content-Encoding header.
*/

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Notifies users of a change in the default .htaccess file regarding setting for brotli to prevent double compression
*
* This check returns true regardless of condition.
*
* @return boolean
*
* @since 4.4.4
*/
function admin_postinstall_htaccessbrotli_condition()
{
return true;
}
@@ -0,0 +1,5 @@
--
-- Add post-installation message about setting the Content-Encoding header in .htaccess
--
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`)
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';
@@ -0,0 +1,6 @@
--
-- Add post-installation message about setting the Content-Encoding header in .htaccess
--
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")
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'
ON CONFLICT DO NOTHING;
Expand Up @@ -71,9 +71,9 @@ public function __construct($name, array $arguments = [])
}

/**
* Set used parameter to true
* Set abort and reason parameters.
*
* @param bool $value The value to set
* @param string $reason Abort reason
*
* @return void
*
Expand Down
36 changes: 35 additions & 1 deletion administrator/components/com_finder/src/Service/HTML/Filter.php
Expand Up @@ -297,7 +297,7 @@ public function select($idxQuery, $options)
->where('t.rgt < :rgt')
->where('t.state = 1')
->whereIn('t.access', $user->getAuthorisedViewLevels())
->order('t.title')
->order('t.level, t.parent_id, t.title')
->bind(':lft', $bv->lft, ParameterType::INTEGER)
->bind(':rgt', $bv->rgt, ParameterType::INTEGER);

Expand Down Expand Up @@ -327,6 +327,7 @@ public function select($idxQuery, $options)

// Translate branch nodes if possible.
$language = Factory::getLanguage();
$root = [];

foreach ($branches[$bk]->nodes as $node_id => $node) {
if (trim($node->parent_title, '*') === 'Language') {
Expand All @@ -340,9 +341,19 @@ public function select($idxQuery, $options)
$branches[$bk]->nodes[$node_id]->title = str_repeat('-', $node->level - 2) . $title;
} else {
$branches[$bk]->nodes[$node_id]->title = $title;
$root[] = $branches[$bk]->nodes[$node_id];
}

if ($node->parent_id && isset($branches[$bk]->nodes[$node->parent_id])) {
if (!isset($branches[$bk]->nodes[$node->parent_id]->children)) {
$branches[$bk]->nodes[$node->parent_id]->children = [];
}
$branches[$bk]->nodes[$node->parent_id]->children[] = $node;
}
}

$branches[$bk]->nodes = $this->reduce($root);

// Add the Search All option to the branch.
array_unshift($branches[$bk]->nodes, ['id' => null, 'title' => Text::_('COM_FINDER_FILTER_SELECT_ALL_LABEL')]);
}
Expand Down Expand Up @@ -487,4 +498,27 @@ public function dates($idxQuery, $options)

return $html;
}

/**
* Method to flatten a tree to a sorted array
*
* @param \stdClass[] $array
*
* @return \stdClass[] Flat array of all nodes of a tree with the children after each parent
*
* @since 4.4.4
*/
private function reduce(array $array)
{
$return = [];

foreach ($array as $item) {
$return[] = $item;
if (isset($item->children)) {
$return = array_merge($return, $this->reduce($item->children));
}
}

return $return;
}
}
148 changes: 75 additions & 73 deletions administrator/components/com_guidedtours/src/Model/TourModel.php
Expand Up @@ -313,7 +313,7 @@ public function duplicate(&$pks)
// Reset the id to create a new record.
$table->id = 0;

$table->published = 0;
$table->published = 0;

if (!$table->check() || !$table->store()) {
throw new \Exception($table->getError());
Expand Down Expand Up @@ -349,82 +349,84 @@ public function duplicate(&$pks)
$db->setQuery($query);
$rows = $db->loadObjectList();

$query = $db->getQuery(true)
->insert($db->quoteName('#__guidedtour_steps'))
->columns(
[
$db->quoteName('tour_id'),
$db->quoteName('title'),
$db->quoteName('description'),
$db->quoteName('ordering'),
$db->quoteName('position'),
$db->quoteName('target'),
$db->quoteName('type'),
$db->quoteName('interactive_type'),
$db->quoteName('url'),
$db->quoteName('created'),
$db->quoteName('created_by'),
$db->quoteName('modified'),
$db->quoteName('modified_by'),
$db->quoteName('language'),
$db->quoteName('note'),
]
);

foreach ($rows as $step) {
$dataTypes = [
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::STRING,
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::STRING,
ParameterType::INTEGER,
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::STRING,
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::STRING,
];

$query->values(
implode(
',',
$query->bindArray(
[
$table->id,
$step->title,
$step->description,
$step->ordering,
$step->position,
$step->target,
$step->type,
$step->interactive_type,
$step->url,
$date,
$user->id,
$date,
$user->id,
$step->language,
$step->note,
],
$dataTypes
if ($rows) {
$query = $db->getQuery(true)
->insert($db->quoteName('#__guidedtour_steps'))
->columns(
[
$db->quoteName('tour_id'),
$db->quoteName('title'),
$db->quoteName('description'),
$db->quoteName('ordering'),
$db->quoteName('position'),
$db->quoteName('target'),
$db->quoteName('type'),
$db->quoteName('interactive_type'),
$db->quoteName('url'),
$db->quoteName('created'),
$db->quoteName('created_by'),
$db->quoteName('modified'),
$db->quoteName('modified_by'),
$db->quoteName('language'),
$db->quoteName('note'),
]
);

foreach ($rows as $step) {
$dataTypes = [
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::STRING,
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::STRING,
ParameterType::INTEGER,
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::STRING,
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::STRING,
];

$query->values(
implode(
',',
$query->bindArray(
[
$table->id,
$step->title,
$step->description,
$step->ordering,
$step->position,
$step->target,
$step->type,
$step->interactive_type,
$step->url,
$date,
$user->id,
$date,
$user->id,
$step->language,
$step->note,
],
$dataTypes
)
)
)
);
}
);
}

$db->setQuery($query);
$db->setQuery($query);

try {
$db->execute();
} catch (\RuntimeException $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
try {
$db->execute();
} catch (\RuntimeException $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');

return false;
return false;
}
}
} else {
throw new \Exception($table->getError());
Expand Down
Expand Up @@ -127,6 +127,7 @@ public function formatRelative(?string $dateTimeText): string
$utcTimeZone = new \DateTimeZone('UTC');
$jDate = new Date($dateTimeText, $utcTimeZone);
$unixStamp = $jDate->toUnix();
$app = Factory::getApplication();

// I'm pretty sure we didn't have MFA in Joomla back in 1970 ;)
if ($unixStamp < 0) {
Expand All @@ -135,7 +136,7 @@ public function formatRelative(?string $dateTimeText): string

// I need to display the date in the user's local timezone. That's how you do it.
$user = $this->getCurrentUser();
$userTZ = $user->getParam('timezone', 'UTC');
$userTZ = $user->getParam('timezone', $app->get('offset', 'UTC'));
$tz = new \DateTimeZone($userTZ);
$jDate->setTimezone($tz);

Expand Down
2 changes: 2 additions & 0 deletions administrator/language/en-GB/com_admin.ini
Expand Up @@ -170,6 +170,8 @@ COM_ADMIN_POSTINSTALL_MSG_BEHIND_LOAD_BALANCER_DESCRIPTION="<p>For Joomla sites
COM_ADMIN_POSTINSTALL_MSG_BEHIND_LOAD_BALANCER_TITLE="New Server Setting \"Behind Load Balancer\""
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_AUTOINDEX_DESCRIPTION="<p>Before 3.9.22 the default htaccess.txt file contained erroneous code meant for disabling directory listings. The security team recommends to 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>&lt;IfModule autoindex&gt;\n IndexIgnore *\n&lt;/IfModule&gt;</pre><p>The new code:</p><pre>&lt;IfModule mod_autoindex.c&gt;\n IndexIgnore *\n&lt;/IfModule&gt;</pre>"
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_AUTOINDEX_TITLE=".htaccess Update Concerning Directory Listings"
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>"
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_BROTLI_TITLE=".htaccess Update Brotli Compression"
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>"
COM_ADMIN_POSTINSTALL_MSG_HTACCESS_SETCE_TITLE=".htaccess Update Concerning Setting the Content-Encoding Header"
COM_ADMIN_SAVE_SUCCESS="Profile saved."
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/install.xml
Expand Up @@ -3,7 +3,7 @@
<name>English (en-GB)</name>
<tag>en-GB</tag>
<version>4.4.4</version>
<creationDate>2024-02</creationDate>
<creationDate>2024-04</creationDate>
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/langmetadata.xml
Expand Up @@ -2,7 +2,7 @@
<metafile client="administrator">
<name>English (en-GB)</name>
<version>4.4.4</version>
<creationDate>2024-02</creationDate>
<creationDate>2024-04</creationDate>
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
Expand Down
4 changes: 2 additions & 2 deletions administrator/manifests/files/joomla.xml
Expand Up @@ -6,8 +6,8 @@
<authorUrl>www.joomla.org</authorUrl>
<copyright>(C) 2019 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>4.4.4-dev</version>
<creationDate>2024-02</creationDate>
<version>4.4.4-rc2-dev</version>
<creationDate>2024-04</creationDate>
<description>FILES_JOOMLA_XML_DESCRIPTION</description>

<scriptfile>administrator/components/com_admin/script.php</scriptfile>
Expand Down
2 changes: 1 addition & 1 deletion administrator/manifests/packages/pkg_en-GB.xml
Expand Up @@ -3,7 +3,7 @@
<name>English (en-GB) Language Pack</name>
<packagename>en-GB</packagename>
<version>4.4.4.1</version>
<creationDate>2024-02</creationDate>
<creationDate>2024-04</creationDate>
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
Expand Down
2 changes: 1 addition & 1 deletion api/language/en-GB/install.xml
Expand Up @@ -3,7 +3,7 @@
<name>English (en-GB)</name>
<tag>en-GB</tag>
<version>4.4.4</version>
<creationDate>2024-02</creationDate>
<creationDate>2024-04</creationDate>
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
Expand Down

0 comments on commit 6fa19c3

Please sign in to comment.