Skip to content

Commit

Permalink
Merge pull request #43760 from pe7er/5.2/upmerge/2024-07-09
Browse files Browse the repository at this point in the history
[5.2] Upmerge 2024-07-09
  • Loading branch information
bembelimen authored Jul 9, 2024
2 parents 3254a87 + df99cd3 commit dd397e5
Show file tree
Hide file tree
Showing 98 changed files with 527 additions and 273 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ steps:
environment:
CYPRESS_VERIFY_TIMEOUT: 100000
commands:
- mv cypress.config.dist.js cypress.config.js
- mv cypress.config.dist.mjs cypress.config.mjs
- npx cypress install
- npx cypress verify

Expand Down Expand Up @@ -414,6 +414,6 @@ trigger:

---
kind: signature
hmac: 8f1bbc362aaadc6b7506490a1ff865bc9ccc0aada27104646963e9b44ee22bef
hmac: bd41423d85abadb875c8fc911f87596ead88b62d26fabf6a283737c5a7b4c5b9

...
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ RoboFile.ini
!/tests/System/output/screenshots/.gitkeep
/tests/System/output/videos
!/tests/System/output/videos/.gitkeep
cypress.config.js
cypress.config.mjs

# WebAuthn FIDO metadata cache
/plugins/system/webauthn/fido.jwt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
echo ModuleHelper::renderModule($module, ['style' => 'well']);
}
?>
<?php if ($user->authorise('core.create', 'com_modules')) : ?>
<?php if ($user->authorise('core.admin', 'com_modules') && $user->authorise('core.create', 'com_modules')) : ?>
<div class="module-wrapper">
<div class="card">
<button type="button" class="cpanel-add-module"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function display($cachable = false, $urlparams = false)
$state = $model->getState();
$state->set('update_finished_with_error', $this->app->getUserState('com_joomlaupdate.update_finished_with_error'));
$state->set('update_errors', (array) $this->app->getUserState('com_joomlaupdate.update_errors', []));
$state->set('update_channel_reset', $this->app->getUserState('com_joomlaupdate.update_channel_reset'));
$state->set('installer_message', $this->app->getUserState('com_joomlaupdate.installer_message'));
$state->set('log_file', $this->app->get('log_path') . '/joomla_update.php');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ public function finalise()
$model->collectError('finaliseUpgrade', $e);
}

// Reset update source from "Joomla Next" to "Default"
$this->app->setUserState('com_joomlaupdate.update_channel_reset', $model->resetUpdateSource());

// Check for update errors
if ($model->getErrors()) {
// The errors already should be logged at this point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2027,4 +2027,73 @@ private function checkManifestXML(string $manifest, $packageName)
throw new \RuntimeException(Text::sprintf('COM_JOOMLAUPDATE_VIEW_UPLOAD_ERROR_DOWNGRADE', $packageName, $versionPackage, $currentVersion), 500);
}
}

/**
* Reset update source from "next" to "default"
*
* @return boolean True if update source is reset, false if reset failed with error,
* null if no reset was necessary.
*
* @since 5.1.2
*/
public function resetUpdateSource()
{
// Get current update source
$params = ComponentHelper::getParams('com_joomlaupdate');

// Do nothing if not "next"
if ($params->get('updatesource', 'default') !== 'next') {
return null;
}

$params->set('updatesource', 'default');

$params = $params->toString();
$db = $this->getDatabase();
$query = $db->getQuery(true)
->update($db->quoteName('#__extensions'))
->set($db->quoteName('params') . ' = :params')
->where($db->quoteName('type') . ' = ' . $db->quote('component'))
->where($db->quoteName('element') . ' = ' . $db->quote('com_joomlaupdate'))
->bind(':params', $params);

try {
$db->setQuery($query);
$db->execute();
} catch (\Exception $e) {
Log::add(
sprintf(
'An error has occurred while running "resetUpdateSource". Code: %s. Message: %s.',
$e->getCode(),
$e->getMessage()
),
Log::WARNING,
'Update'
);

Log::add(
Text::sprintf(
'COM_JOOMLAUPDATE_UPDATE_CHANGE_UPDATE_SOURCE_FAILED',
Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT'),
Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT')
),
Log::WARNING,
'Update'
);

return false;
}

Log::add(
Text::sprintf(
'COM_JOOMLAUPDATE_UPDATE_CHANGE_UPDATE_SOURCE_OK',
Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT'),
Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT')
),
Log::INFO,
'Update'
);

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

$hadErrors = $this->state->get('update_finished_with_error');
$errors = $this->state->get('update_errors');
$channelReset = $this->state->get('update_channel_reset');
$logFile = $this->state->get('log_file');
$installerMsg = $this->state->get('installer_message');
$forumLink = '<a href="https://forum.joomla.org/" target="_blank" rel="noopener noreferrer">https://forum.joomla.org/</a>';
Expand All @@ -27,6 +28,17 @@
<div class="card">
<h2 class="card-header"><?php echo Text::_('COM_JOOMLAUPDATE_VIEW_COMPLETE_HEADING'); ?></h2>
<div class="card-body">
<?php if ($channelReset) : ?>
<div class="alert alert-success">
<span class="icon-check-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('NOTICE'); ?></span>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_UPDATE_CHANGE_UPDATE_SOURCE_OK', Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT'), Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT')); ?>
</div>
<?php elseif ($channelReset !== null) : ?>
<div class="alert alert-warning">
<span class="icon-check-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::sprintf('COM_JOOMLAUPDATE_UPDATE_CHANGE_UPDATE_SOURCE_FAILED', Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT'), Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT')); ?>
</div>
<?php endif; ?>
<?php if (!$hadErrors) : ?>
<div class="alert alert-success">
<span class="icon-check-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('NOTICE'); ?></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public function hasDueTasks(Date $time): bool
* Check if we have right now any enabled due tasks and no locked tasks.
*
* @return boolean
* @since __DEPLOY_VERSION__
* @since 5.2.0
*/
public function getHasDueTasks()
{
Expand Down
4 changes: 3 additions & 1 deletion administrator/language/en-GB/com_joomlaupdate.ini
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ COM_JOOMLAUPDATE_SELF_EMPTYSTATE_CONTENT="You must update this component first b
COM_JOOMLAUPDATE_SELF_EMPTYSTATE_TITLE="A new version of the Joomla Update Component is available"
COM_JOOMLAUPDATE_SYSTEM_CHECK="System Check"
COM_JOOMLAUPDATE_TOOLBAR_CHECK="Check for Updates"
COM_JOOMLAUPDATE_UPDATE_CHANGE_UPDATE_SOURCE_FAILED="Failed to reset the update channel from \"%1$s\" to \"%2$s\". Please change it in the Joomla Update Component's options so you don't miss future updates."
COM_JOOMLAUPDATE_UPDATE_CHANGE_UPDATE_SOURCE_OK="The update channel has been reset from \"%1$s\" to \"%2$s\"."
COM_JOOMLAUPDATE_UPDATE_CHECK="Update Check"
COM_JOOMLAUPDATE_UPDATE_CONFIRM_BACKUP="I'm aware that a backup before any update is highly recommended."
COM_JOOMLAUPDATE_UPDATE_EMPTYSTATE_TITLE="Update your site to \"Joomla! %s\""
Expand Down Expand Up @@ -169,7 +171,7 @@ COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATE_NOTICE="Before you update Joomla, ensure th
COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATEFOUND="A Joomla update was found."
COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_CUSTOM="You are on the &quot;%s&quot; update channel. This is not an official Joomla update channel."
COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_DEFAULT="You are on the &quot;%s&quot; update channel. Through this channel you'll receive notifications for all updates of the current Joomla release (5.x)"
COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_NEXT="You are on the &quot;%s&quot; update channel. Through this channel you'll receive notifications for all updates of the current Joomla release (5.x) and you will also be notified when the future major release (6.x) will be available. Before upgrading to 6.x you'll need to assess its compatibility with your environment."
COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_NEXT="You are on the &quot;%s&quot; update channel. Through this channel you will be notified when the future major release (6.x) will be available. Before upgrading to 6.x you'll need to assess its compatibility with your environment. You will not be notified about updates of the current Joomla release (5.x)."
COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_TESTING="You are on the &quot;%s&quot; update channel. This channel is designed for testing new releases and fixes in Joomla.<br>It is only intended for JBS (Joomla Bug Squad&trade;) members and others within the Joomla community who are testing. Do not use this setting on a production site."
COM_JOOMLAUPDATE_VIEW_DEFAULT_UPLOAD_INTRO="You can use this feature to update Joomla if your server is behind a firewall or otherwise unable to contact the update servers. First download the Joomla <em><strong>Update Package</strong></em> in ZIP format from <a class='alert-link' href='%s' target='_blank' rel='noopener noreferrer'>the official Joomla download page</a>. Then use the fields below to upload and install it."
COM_JOOMLAUPDATE_VIEW_UPDATE_BYTESEXTRACTED="Bytes extracted"
Expand Down
2 changes: 1 addition & 1 deletion build/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ function clean_composer(string $dir)
'composer.json',
'composer.lock',
'crowdin.yml',
'cypress.config.dist.js',
'cypress.config.dist.mjs',
'package-lock.json',
'package.json',
'phpunit-pgsql.xml.dist',
Expand Down
65 changes: 41 additions & 24 deletions build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,47 +279,61 @@ class JoomlaFieldSubform extends HTMLElement {
const nameNew = name.replace(`[${group}][`, `[${groupnew}][`); // New name
let idNew = id.replace(group, groupnew).replace(/\W/g, '_'); // Count new id
let countMulti = 0; // count for multiple radio/checkboxes
let forOldAttr = id; // Fix "for" in the labels
const forOldAttr = $el.id; // Fix "for" in the labels

if ($el.type === 'checkbox' && name.match(/\[\]$/)) { // <input type="checkbox" name="name[]"> fix
// Recount id
countMulti = ids[id] ? ids[id].length : 0;
if (!countMulti) {
// Set the id for fieldset and group label
const fieldset = $el.closest('fieldset.checkboxes');

const elLbl = row.querySelector(`label[for="${id}"]`);
// Set the id for fieldset and group label
if (!countMulti) {
// Look for <fieldset class="checkboxes"></fieldset> or <fieldset><div class="checkboxes"></div></fieldset>
let fieldset = $el.closest('.checkboxes');
// eslint-disable-next-line no-nested-ternary
fieldset = fieldset.nodeName === 'FIELDSET' ? fieldset : (fieldset.parentElement.nodeName === 'FIELDSET' ? fieldset.parentElement : false);

if (fieldset) {
fieldset.setAttribute('id', idNew);
}
const oldSetId = fieldset.id;
fieldset.id = idNew;

const groupLbl = row.querySelector(`label[for="${oldSetId}"]`);

if (elLbl) {
elLbl.setAttribute('for', idNew);
elLbl.setAttribute('id', `${idNew}-lbl`);
if (groupLbl) {
groupLbl.setAttribute('for', idNew);

if (groupLbl.id) {
groupLbl.setAttribute('id', `${idNew}-lbl`);
}
}
}
}
forOldAttr += countMulti;

idNew += countMulti;
} else if ($el.type === 'radio') { // <input type="radio"> fix
// Recount id
countMulti = ids[id] ? ids[id].length : 0;
if (!countMulti) {
// Set the id for fieldset and group label
const fieldset = $el.closest('fieldset.radio');

const elLbl = row.querySelector(`label[for="${id}"]`);
// Set the id for fieldset and group label
if (!countMulti) {
// Look for <fieldset class="radio"></fieldset> or <fieldset><div class="radio"></div></fieldset>
let fieldset = $el.closest('.radio');
// eslint-disable-next-line no-nested-ternary
fieldset = fieldset.nodeName === 'FIELDSET' ? fieldset : (fieldset.parentElement.nodeName === 'FIELDSET' ? fieldset.parentElement : false);

if (fieldset) {
fieldset.setAttribute('id', idNew);
}
const oldSetId = fieldset.id;
fieldset.id = idNew;

const groupLbl = row.querySelector(`label[for="${oldSetId}"]`);

if (groupLbl) {
groupLbl.setAttribute('for', idNew);

if (elLbl) {
elLbl.setAttribute('for', idNew);
elLbl.setAttribute('id', `${idNew}-lbl`);
if (groupLbl.id) {
groupLbl.setAttribute('id', `${idNew}-lbl`);
}
}
}
}
forOldAttr += countMulti;

idNew += countMulti;
}

Expand All @@ -344,7 +358,10 @@ class JoomlaFieldSubform extends HTMLElement {
const lbl = row.querySelector(`label[for="${forOldAttr}"]`);
if (lbl) {
lbl.setAttribute('for', idNew);
lbl.setAttribute('id', `${idNew}-lbl`);

if (lbl.id) {
lbl.setAttribute('id', `${idNew}-lbl`);
}
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions cypress.config.dist.js → cypress.config.dist.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { defineConfig } = require('cypress');
const setupPlugins = require('./tests/System/plugins/index');
import { defineConfig } from 'cypress';
import setupPlugins from './tests/System/plugins/index.mjs';

module.exports = defineConfig({
export default defineConfig({
fixturesFolder: 'tests/System/fixtures',
videosFolder: 'tests/System/output/videos',
screenshotsFolder: 'tests/System/output/screenshots',
Expand Down
2 changes: 1 addition & 1 deletion installation/language/af-ZA/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Afrikaans (Suid-Afrika)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Afrikaans Translation Team</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/ar-AA/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Arabic (اللغة العربية)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Dr. Ashraf Damra</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/be-BY/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Belarusian (Belarus)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Joomla Belarus Community</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/bg-BG/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Bulgarian (bg-BG)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Joomla! Bulgaria</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/ca-ES/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Catalan (ca-ES)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Catalan [ca-ES] Translation Team</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/cs-CZ/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Czech (Čeština)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Czech Translation Team</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/cy-GB/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Welsh (United Kingdom)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Joomla! Project - Welsh Translation Team</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/da-DK/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Danish (Danmark)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Danish Translation Team (Transl.: Ronny Buelund)</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/el-GR/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>Greek (el-GR)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Ομάδα Μετάφρασης: joomla. gr</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/en-AU/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>English (Australia)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Joomla! Project</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
2 changes: 1 addition & 1 deletion installation/language/en-CA/langmetadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<metafile client="installation">
<name>English (Canada)</name>
<version>5.1.2</version>
<creationDate>2024-05</creationDate>
<creationDate>2024-07</creationDate>
<author>Joomla! Project</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
Loading

0 comments on commit dd397e5

Please sign in to comment.