Skip to content

Commit

Permalink
Merge branch '4.2-dev' of https://github.com/joomla/joomla-cms into 4…
Browse files Browse the repository at this point in the history
….2-nightly

# Conflicts:
#	.drone.yml
  • Loading branch information
Hackwar committed May 19, 2022
2 parents 3f568d3 + 2069ac3 commit 4a2e833
Show file tree
Hide file tree
Showing 186 changed files with 2,883 additions and 777 deletions.
2 changes: 1 addition & 1 deletion .drone.yml
Expand Up @@ -24,7 +24,7 @@ steps:
- echo $(date)

- name: npm
image: node:14-alpine
image: node:16-alpine
depends_on: [ phpcs ]
commands:
- npm ci --unsafe-perm
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -5,7 +5,7 @@ Build Status
---------------------
| Drone-CI | AppVeyor | PHP | Node | npm |
| ------------- | ------------- | ------------- | ------------- | ------------- |
| [![Build Status](https://ci.joomla.org/api/badges/joomla/joomla-cms/status.svg?branch=4.1-dev)](https://ci.joomla.org/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/ru6sxal8jmfckvjc/branch/4.1-dev?svg=true)](https://ci.appveyor.com/project/release-joomla/joomla-cms) | [![PHP](https://img.shields.io/badge/PHP-V7.2.5-green)](https://www.php.net/) | [![node-lts](https://img.shields.io/badge/Node-V12.0-green)](https://nodejs.org/en/) | [![npm](https://img.shields.io/badge/npm-v6.13.4-green)](https://nodejs.org/en/) |
| [![Build Status](https://ci.joomla.org/api/badges/joomla/joomla-cms/status.svg?branch=4.1-dev)](https://ci.joomla.org/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/ru6sxal8jmfckvjc/branch/4.1-dev?svg=true)](https://ci.appveyor.com/project/release-joomla/joomla-cms) | [![PHP](https://img.shields.io/badge/PHP-V7.2.5-green)](https://www.php.net/) | [![node-lts](https://img.shields.io/badge/Node-V16.0-green)](https://nodejs.org/en/) | [![npm](https://img.shields.io/badge/npm-v8.6.0-green)](https://nodejs.org/en/) |

Overview
---------------------
Expand Down
Expand Up @@ -158,19 +158,13 @@ public static function loadTranslationFiles($extension)
* @return mixed An object contains content type parameters, or null if not found
*
* @since 3.9.0
*
* @deprecated 5.0 Use the action log config model instead
*/
public static function getLogContentTypeParams($context)
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('a.*')
->from($db->quoteName('#__action_log_config', 'a'))
->where($db->quoteName('a.type_alias') . ' = :context')
->bind(':context', $context);

$db->setQuery($query);

return $db->loadObject();
return Factory::getApplication()->bootComponent('actionlogs')->getMVCFactory()
->createModel('ActionlogConfig', 'Administrator')->getLogContentTypeParams($context);
}

/**
Expand Down
@@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Actionlogs\Administrator\Model;

\defined('_JEXEC') or die;

use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use stdClass;

/**
* Model to interact with the action log configuration.
*
* @since __DEPLOY_VERSION__
*/
class ActionlogConfigModel extends BaseDatabaseModel
{
/**
* Returns the action logs config for the given context.
*
* @param string $context The context of the content
*
* @return stdClass|null An object contains content type parameters, or null if not found
*
* @since __DEPLOY_VERSION__
*/
public function getLogContentTypeParams(string $context): ?stdClass
{
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select('a.*')
->from($db->quoteName('#__action_log_config', 'a'))
->where($db->quoteName('a.type_alias') . ' = :context')
->bind(':context', $context);

$db->setQuery($query);

return $db->loadObject();
}
}
6 changes: 2 additions & 4 deletions administrator/components/com_admin/script.php
Expand Up @@ -6387,6 +6387,8 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/administrator/components/com_users/src/Field/PrimaryauthprovidersField.php',
// From 4.1.2 to 4.1.3
'/libraries/vendor/webmozart/assert/.php_cs',
// From 4.1 to 4.2.0
'/libraries/src/Service/Provider/ApiRouter.php',
);

$folders = array(
Expand Down Expand Up @@ -7720,10 +7722,6 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/libraries/vendor/tobscure/json-api/.git/hooks',
'/libraries/vendor/tobscure/json-api/.git/branches',
'/libraries/vendor/tobscure/json-api/.git',
// From 4.1.1 to 4.1.2
'/administrator/components/com_users/src/Field/PrimaryauthprovidersField.php',
// From 4.1.1 to 4.2.0
'/libraries/src/Service/Provider/ApiRouter.php'
);

$status['files_checked'] = $files;
Expand Down
Expand Up @@ -115,7 +115,7 @@ class ContentComponent extends MVCComponent implements
public function boot(ContainerInterface $container)
{
$this->getRegistry()->register('contentadministrator', new AdministratorService);
$this->getRegistry()->register('contenticon', new Icon($container->get(SiteApplication::class)));
$this->getRegistry()->register('contenticon', new Icon);

// The layout joomla.content.icons does need a general icon service
$this->getRegistry()->register('icon', $this->getRegistry()->getService('contenticon'));
Expand Down
25 changes: 2 additions & 23 deletions administrator/components/com_content/src/Service/HTML/Icon.php
Expand Up @@ -29,27 +29,6 @@
*/
class Icon
{
/**
* The application
*
* @var CMSApplication
*
* @since 4.0.0
*/
private $application;

/**
* Service constructor
*
* @param CMSApplication $application The application
*
* @since 4.0.0
*/
public function __construct(CMSApplication $application)
{
$this->application = $application;
}

/**
* Method to generate a link to the create item page for the given category
*
Expand Down Expand Up @@ -115,13 +94,13 @@ public function edit($article, $params, $attribs = array(), $legacy = false)
// Ignore if in a popup window.
if ($params && $params->get('popup'))
{
return;
return '';
}

// Ignore if the state is negative (trashed).
if (!in_array($article->state, [Workflow::CONDITION_UNPUBLISHED, Workflow::CONDITION_PUBLISHED]))
{
return;
return '';
}

// Show checked_out icon if the article is checked out by a different user
Expand Down
Expand Up @@ -228,6 +228,9 @@
echo (new TransitionButton($options))
->render(0, $i);
?>
<div class="small">
<?php echo Text::_($item->stage_title); ?>
</div>
</td>
<?php endif; ?>
<td class="text-center d-none d-md-table-cell">
Expand Down
Expand Up @@ -232,6 +232,9 @@
echo (new TransitionButton($options))
->render(0, $i);
?>
<div class="small">
<?php echo Text::_($item->stage_title); ?>
</div>
</td>
<?php endif; ?>
<td class="text-center d-none d-md-table-cell">
Expand Down
48 changes: 24 additions & 24 deletions administrator/components/com_media/src/Controller/ApiController.php
Expand Up @@ -105,24 +105,24 @@ public function execute($task)
* index.php?option=com_media&task=api.files
* /api/files
* - GET a list of files and subfolders of a given folder:
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop
* /api/files/sampledata/fruitshop
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia
* /api/files/sampledata/cassiopeia
* - GET a list of files and subfolders of a given folder for a given search term:
* use recursive=1 to search recursively in the working directory
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop&search=apple
* /api/files/sampledata/fruitshop?search=apple
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia&search=nasa5
* /api/files/sampledata/cassiopeia?search=nasa5
* To look up in same working directory set flag recursive=0
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop&search=apple&recursive=0
* /api/files/sampledata/fruitshop?search=apple&recursive=0
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia&search=nasa5&recursive=0
* /api/files/sampledata/cassiopeia?search=nasa5&recursive=0
* - GET file information for a specific file:
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop/test.jpg
* /api/files/sampledata/fruitshop/test.jpg
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg
* /api/files/sampledata/cassiopeia/test.jpg
* - GET a temporary URL to a given file
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop/test.jpg&url=1&temp=1
* /api/files/sampledata/fruitshop/test.jpg&url=1&temp=1
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg&url=1&temp=1
* /api/files/sampledata/cassiopeia/test.jpg&url=1&temp=1
* - GET a temporary URL to a given file
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop/test.jpg&url=1
* /api/files/sampledata/fruitshop/test.jpg&url=1
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg&url=1
* /api/files/sampledata/cassiopeia/test.jpg&url=1
*
* @return array The data to send with the response
*
Expand All @@ -147,11 +147,11 @@ public function getFiles()
* Examples:
*
* - DELETE an existing folder in a specific folder:
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop/test
* /api/files/sampledata/fruitshop/test
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test
* /api/files/sampledata/cassiopeia/test
* - DELETE an existing file in a specific folder:
* index.php?option=com_media&task=api.files&path=/sampledata/fruitshop/test.jpg
* /api/files/sampledata/fruitshop/test.jpg
* index.php?option=com_media&task=api.files&path=/sampledata/cassiopeia/test.jpg
* /api/files/sampledata/cassiopeia/test.jpg
*
* @return null
*
Expand All @@ -176,8 +176,8 @@ public function deleteFiles()
* Examples:
*
* - POST a new file or folder into a specific folder, the file or folder information is returned:
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop
* /api/files/sampledata/fruitshop
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia
* /api/files/sampledata/cassiopeia
*
* New file body:
* {
Expand Down Expand Up @@ -233,8 +233,8 @@ public function postFiles()
* Examples:
*
* - PUT a media file, the file or folder information is returned:
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop/test.jpg
* /api/files/sampledata/fruitshop/test.jpg
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg
* /api/files/sampledata/cassiopeia/test.jpg
*
* Update file body:
* {
Expand All @@ -243,8 +243,8 @@ public function postFiles()
*
* - PUT move a file, folder to another one
* path : will be taken as the source
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop/test.jpg
* /api/files/sampledata/fruitshop/test.jpg
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg
* /api/files/sampledata/cassiopeia/test.jpg
*
* JSON body:
* {
Expand All @@ -254,8 +254,8 @@ public function postFiles()
*
* - PUT copy a file, folder to another one
* path : will be taken as the source
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/fruitshop/test.jpg
* /api/files/sampledata/fruitshop/test.jpg
* index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg
* /api/files/sampledata/cassiopeia/test.jpg
*
* JSON body:
* {
Expand Down
9 changes: 9 additions & 0 deletions administrator/components/com_menus/presets/alternate.xml
Expand Up @@ -348,6 +348,7 @@
class="class:component"
permission="core.manage;com_joomlaupdate"
/>

<menuitem
title="COM_POSTINSTALL"
type="component"
Expand All @@ -363,6 +364,14 @@
link="index.php?option=com_redirect&amp;view=links"
permission="core.manage;com_redirect"
/>

<menuitem
title="MOD_MENU_MANAGE_SCHEDULED_TASKS"
type="component"
element="com_scheduler"
link="index.php?option=com_scheduler&amp;view=tasks"
permission="core.manage;com_scheduler"
/>
</menuitem>

<menuitem
Expand Down
25 changes: 18 additions & 7 deletions administrator/components/com_menus/src/Model/ItemModel.php
Expand Up @@ -1433,8 +1433,8 @@ public function rebuild()
*/
public function save($data)
{
$pk = isset($data['id']) ? $data['id'] : (int) $this->getState('item.id');
$isNew = true;
$pk = isset($data['id']) ? $data['id'] : (int) $this->getState('item.id');
$isNew = true;
$db = $this->getDbo();
$query = $db->getQuery(true);
$table = $this->getTable();
Expand Down Expand Up @@ -1512,13 +1512,24 @@ public function save($data)
return false;
}

// Alter the title & alias for save as copy. Also, unset the home record.
if (!$isNew && $data['id'] == 0)
// Alter the title & alias for save2copy when required. Also, unset the home record.
if (Factory::getApplication()->input->get('task') === 'save2copy' && $data['id'] === 0)
{
list($title, $alias) = $this->generateNewTitle($table->parent_id, $table->alias, $table->title);
$origTable = $this->getTable();
$origTable->load($this->getState('item.id'));

if ($table->title === $origTable->title)
{
list($title, $alias) = $this->generateNewTitle($table->parent_id, $table->alias, $table->title);
$table->title = $title;
$table->alias = $alias;
}

if ($table->alias === $origTable->alias)
{
$table->alias = '';
}

$table->title = $title;
$table->alias = $alias;
$table->published = 0;
$table->home = 0;
}
Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_scheduler/forms/filter_tasks.xml
Expand Up @@ -40,13 +40,12 @@
</fields>

<fields name="list">
<!-- @todo: Add options for execution date(s) -->
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="a.title DESC"
default="a.title ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
Expand All @@ -58,6 +57,8 @@
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="j.type_title ASC">COM_SCHEDULER_TASK_TYPE_ASC</option>
<option value="j.type_title DESC">COM_SCHEDULER_TASK_TYPE_DESC</option>
<option value="a.last_execution ASC">COM_SCHEDULER_LAST_RUN_ASC</option>
<option value="a.last_execution DESC">COM_SCHEDULER_LAST_RUN_DESC</option>
<option value="a.priority ASC">COM_SCHEDULER_TASK_PRIORITY_ASC</option>
<option value="a.priority DESC">COM_SCHEDULER_TASK_PRIORITY_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
Expand Down
Expand Up @@ -351,7 +351,7 @@ static function (TaskOption $taskOption): string
if (!$multiOrdering || !\is_array($multiOrdering))
{
$orderCol = $this->state->get('list.ordering', 'a.title');
$orderDir = $this->state->get('list.direction', 'desc');
$orderDir = $this->state->get('list.direction', 'asc');

// Type title ordering is handled exceptionally in _getList()
if ($orderCol !== 'j.type_title')
Expand Down Expand Up @@ -390,10 +390,9 @@ static function (TaskOption $taskOption): string
*/
protected function _getList($query, $limitstart = 0, $limit = 0): array
{

// Get stuff from the model state
$listOrder = $this->getState('list.ordering', 'a.title');
$listDirectionN = strtolower($this->getState('list.direction', 'desc')) == 'desc' ? -1 : 1;
$listDirectionN = strtolower($this->getState('list.direction', 'asc')) == 'desc' ? -1 : 1;

// Set limit parameters and get object list
$query->setLimit($limit, $limitstart);
Expand Down Expand Up @@ -465,7 +464,7 @@ private function attachTaskOptions(array $items): void
* @return void
* @since 4.1.0
*/
protected function populateState($ordering = 'a.id', $direction = 'ASC'): void
protected function populateState($ordering = 'a.title', $direction = 'ASC'): void
{
// Call the parent method
parent::populateState($ordering, $direction);
Expand Down

0 comments on commit 4a2e833

Please sign in to comment.