Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/4.0-dev' into 4.0-dev-fix-utf8…
Browse files Browse the repository at this point in the history
…mb4-conversion-after-pr-29117-upmerge
  • Loading branch information
richard67 committed May 29, 2020
2 parents 9061af4 + 400b4a2 commit 331b385
Show file tree
Hide file tree
Showing 91 changed files with 936 additions and 807 deletions.
3 changes: 1 addition & 2 deletions .appveyor.yml
Expand Up @@ -71,8 +71,7 @@ install:
- IF %PHP%==1 echo opcache.enable_cli=1 >> php.ini
- IF %PHP%==1 echo extension=php_ldap.dll >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor-retry appveyor DownloadFile https://getcomposer.org/download/1.10.5/composer.phar
- appveyor-retry composer self-update
- IF %PHP%==1 php -r "readfile('http://getcomposer.org/installer');" | php
- cd C:\projects\joomla-cms
- appveyor-retry composer install --no-progress --profile
before_test:
Expand Down
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/rfc.md
@@ -0,0 +1,13 @@
---
name: Start a Request for Comment
about: Start a Request for Comment discussion

---

### Problem identified


### Proposed solution


### Open questions
16 changes: 8 additions & 8 deletions administrator/components/com_admin/script.php
Expand Up @@ -6576,7 +6576,7 @@ private function contactItems(Table $tableItem): array
'parent_id' => $parentId,
'level' => 2,
'component_id' => $componentId,
'checked_out' => 0,
'checked_out' => null,
'checked_out_time' => null,
'browserNav' => 0,
'access' => 0,
Expand All @@ -6601,7 +6601,7 @@ private function contactItems(Table $tableItem): array
'parent_id' => $parentId,
'level' => 2,
'component_id' => $componentId,
'checked_out' => 0,
'checked_out' => null,
'checked_out_time' => null,
'browserNav' => 0,
'access' => 0,
Expand All @@ -6626,7 +6626,7 @@ private function contactItems(Table $tableItem): array
'parent_id' => $parentId,
'level' => 2,
'component_id' => $componentId,
'checked_out' => 0,
'checked_out' => null,
'checked_out_time' => null,
'browserNav' => 0,
'access' => 0,
Expand Down Expand Up @@ -6686,7 +6686,7 @@ private function finderItems(Table $tableItem): array
'parent_id' => $parentId,
'level' => 2,
'component_id' => $componentId,
'checked_out' => 0,
'checked_out' => null,
'checked_out_time' => null,
'browserNav' => 0,
'access' => 0,
Expand All @@ -6711,7 +6711,7 @@ private function finderItems(Table $tableItem): array
'parent_id' => $parentId,
'level' => 2,
'component_id' => $componentId,
'checked_out' => 0,
'checked_out' => null,
'checked_out_time' => null,
'browserNav' => 0,
'access' => 0,
Expand All @@ -6736,7 +6736,7 @@ private function finderItems(Table $tableItem): array
'parent_id' => $parentId,
'level' => 2,
'component_id' => $componentId,
'checked_out' => 0,
'checked_out' => null,
'checked_out_time' => null,
'browserNav' => 0,
'access' => 0,
Expand All @@ -6761,7 +6761,7 @@ private function finderItems(Table $tableItem): array
'parent_id' => $parentId,
'level' => 2,
'component_id' => $componentId,
'checked_out' => 0,
'checked_out' => null,
'checked_out_time' => null,
'browserNav' => 0,
'access' => 0,
Expand All @@ -6786,7 +6786,7 @@ private function finderItems(Table $tableItem): array
'parent_id' => $parentId,
'level' => 2,
'component_id' => $componentId,
'checked_out' => 0,
'checked_out' => null,
'checked_out_time' => null,
'browserNav' => 0,
'access' => 0,
Expand Down
@@ -0,0 +1,39 @@
ALTER TABLE `#__extensions` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__menu` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__modules` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__tags` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__update_sites` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__user_notes` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__workflows` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__workflow_stages` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__workflow_transitions` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__banners` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__banner_clients` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__contact_details` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__content` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__finder_filters` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__newsfeeds` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__categories` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__fields` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__fields_groups` MODIFY `checked_out` INT(10) UNSIGNED;
ALTER TABLE `#__ucm_content` MODIFY `core_checked_out_user_id` INT(10) UNSIGNED;

UPDATE `#__extensions` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__menu` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__modules` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__tags` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__update_sites` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__user_notes` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__workflows` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__workflow_stages` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__workflow_transitions` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__banners` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__banner_clients` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__contact_details` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__content` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__finder_filters` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__newsfeeds` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__categories` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__fields` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__fields_groups` SET `checked_out` = null WHERE `checked_out` = 0;
UPDATE `#__ucm_content` SET `core_checked_out_user_id` = null WHERE `checked_out` = 0;
@@ -0,0 +1,58 @@
ALTER TABLE "#__extensions" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__extensions" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__menu" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__menu" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__modules" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__modules" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__tags" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__tags" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__update_sites" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__update_sites" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__user_notes" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__user_notes" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__workflows" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__workflows" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__workflow_stages" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__workflow_stages" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__workflow_transitions" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__workflow_transitions" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__banners" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__banners" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__banner_clients" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__banner_clients" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__contact_details" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__contact_details" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__content" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__content" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__finder_filters" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__finder_filters" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__newsfeeds" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__newsfeeds" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__categories" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__categories" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__fields" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__fields" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__fields_groups" ALTER COLUMN "checked_out" DROP DEFAULT;
ALTER TABLE "#__fields_groups" ALTER COLUMN "checked_out" DROP NOT NULL;
ALTER TABLE "#__ucm_content" ALTER COLUMN "core_checked_out_user_id" DROP DEFAULT;
ALTER TABLE "#__ucm_content" ALTER COLUMN "core_checked_out_user_id" DROP NOT NULL;

UPDATE "#__extensions" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__menu" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__modules" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__tags" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__update_sites" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__user_notes" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__workflows" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__workflow_stages" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__workflow_transitions" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__banners" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__banner_clients" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__contact_details" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__content" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__finder_filters" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__newsfeeds" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__categories" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__fields" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__fields_groups" SET "checked_out" = null WHERE "checked_out" = 0;
UPDATE "#__ucm_content" SET "core_checked_out_user_id" = null WHERE "checked_out" = 0;
Expand Up @@ -53,7 +53,7 @@ public static function updateReset()
->extendWhere(
'AND',
[
$db->quoteName('checked_out') . ' = 0',
$db->quoteName('checked_out') . ' IS NULL',
$db->quoteName('checked_out') . ' = :userId',
],
'OR'
Expand Down
Expand Up @@ -352,11 +352,11 @@ public function stick($pks = null, $state = 1, $userId = 0)
}

// Verify checkout
if ($table->checked_out == 0 || $table->checked_out == $userId)
if (is_null($table->checked_out) || $table->checked_out == $userId)
{
// Change the state
$table->sticky = $state;
$table->checked_out = 0;
$table->checked_out = null;
$table->checked_out_time = null;

// Check the row
Expand Down
Expand Up @@ -100,7 +100,7 @@ public function publish($pks = null, $state = 1, $userId = 0)
$query->extendWhere(
'AND',
[
$this->_db->quoteName('checked_out') . ' = 0',
$this->_db->quoteName('checked_out') . ' IS NULL',
$this->_db->quoteName('checked_out') . ' = :userId',
],
'OR'
Expand Down
Expand Up @@ -98,7 +98,7 @@ protected function addToolbar(): void
$user = Factory::getUser();
$userId = $user->id;
$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);

// Since we don't track these assets at the item level, use the category id.
$canDo = ContentHelper::getActions('com_banners', 'category', $this->item->catid);
Expand Down
Expand Up @@ -108,7 +108,7 @@ protected function addToolbar(): void

$user = Factory::getUser();
$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->id);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $user->id);
$canDo = $this->canDo;

ToolbarHelper::title(
Expand Down
Expand Up @@ -95,7 +95,7 @@
$item->cat_link = Route::_('index.php?option=com_categories&extension=com_banners&task=edit&type=other&cid[]=' . $item->catid);
$canCreate = $user->authorise('core.create', 'com_banners.category.' . $item->catid);
$canEdit = $user->authorise('core.edit', 'com_banners.category.' . $item->catid);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canChange = $user->authorise('core.edit.state', 'com_banners.category.' . $item->catid) && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>" data-dragable-group="<?php echo $item->catid; ?>">
Expand Down
Expand Up @@ -96,7 +96,7 @@
<?php foreach ($this->items as $i => $item) :
$canCreate = $user->authorise('core.create', 'com_banners');
$canEdit = $user->authorise('core.edit', 'com_banners');
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || is_null($item->checked_out);
$canChange = $user->authorise('core.edit.state', 'com_banners') && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>">
Expand Down
Expand Up @@ -135,7 +135,7 @@ protected function addToolbar()
$userId = $user->id;

$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);

// Avoid nonsense situation.
if ($extension == 'com_categories')
Expand Down
Expand Up @@ -129,7 +129,7 @@
<?php foreach ($this->items as $i => $item) : ?>
<?php
$canEdit = $user->authorise('core.edit', $extension . '.category.' . $item->id);
$canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canEditOwn = $user->authorise('core.edit.own', $extension . '.category.' . $item->id) && $item->created_user_id == $userId;
$canChange = $user->authorise('core.edit.state', $extension . '.category.' . $item->id) && $canCheckin;

Expand Down
Expand Up @@ -153,6 +153,7 @@ public function save()
break;

case 'save':
$this->app->enqueueMessage(Text::_('COM_CONFIG_SAVE_SUCCESS'), 'message');
default:
$redirect = 'index.php?option=' . $option;

Expand Down
Expand Up @@ -123,7 +123,7 @@ public static function edit($contact, $params, $attribs = array(), $legacy = fal
// Show checked_out icon if the contact is checked out by a different user
if (property_exists($contact, 'checked_out')
&& property_exists($contact, 'checked_out_time')
&& $contact->checked_out > 0
&& !is_null($contact->checked_out)
&& $contact->checked_out !== $user->get('id'))
{
$checkoutUser = Factory::getUser($contact->checked_out);
Expand Down
Expand Up @@ -101,7 +101,7 @@ protected function addToolbar()
$user = Factory::getUser();
$userId = $user->id;
$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);

// Since we don't track these assets at the item level, use the category id.
$canDo = ContentHelper::getActions('com_contact', 'category', $this->item->catid);
Expand Down
Expand Up @@ -94,7 +94,7 @@
foreach ($this->items as $i => $item) :
$canCreate = $user->authorise('core.create', 'com_contact.category.' . $item->catid);
$canEdit = $user->authorise('core.edit', 'com_contact.category.' . $item->catid);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canEditOwn = $user->authorise('core.edit.own', 'com_contact.category.' . $item->catid) && $item->created_by == $userId;
$canChange = $user->authorise('core.edit.state', 'com_contact.category.' . $item->catid) && $canCheckin;

Expand Down
Expand Up @@ -125,7 +125,7 @@ public function edit($article, $params, $attribs = array(), $legacy = false)
// Show checked_out icon if the article is checked out by a different user
if (property_exists($article, 'checked_out')
&& property_exists($article, 'checked_out_time')
&& $article->checked_out > 0
&& !is_null($article->checked_out)
&& $article->checked_out != $user->get('id'))
{
$checkoutUser = Factory::getUser($article->checked_out);
Expand Down
Expand Up @@ -126,7 +126,7 @@ protected function addToolbar()
$user = Factory::getUser();
$userId = $user->id;
$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
$checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId);

// Built the actions for new and existing records.
$canDo = $this->canDo;
Expand Down
Expand Up @@ -159,7 +159,7 @@
<?php foreach ($this->items as $i => $item) :
$item->max_ordering = 0;
$canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId;
$canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin;
$canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid);
Expand Down
Expand Up @@ -153,7 +153,7 @@
$assetId = 'com_content.article.' . $item->id;
$canCreate = $user->authorise('core.create', 'com_content.category.' . $item->catid);
$canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
$canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin;
$canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid);
$canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId;
Expand Down
Expand Up @@ -135,7 +135,7 @@ public function delete(&$pks)
{
if ($table->load($pk))
{
if ($table->keep_forever === "1")
if ((int) $table->keep_forever === 1)
{
unset($pks[$i]);
continue;
Expand Down
8 changes: 7 additions & 1 deletion administrator/components/com_fields/src/Model/FieldModel.php
Expand Up @@ -225,8 +225,14 @@ public function save($data)
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__fields_values'))
->where($db->quoteName('field_id') . ' = :fieldid')
->whereNotIn($db->quoteName('value'), $names, ParameterType::STRING)
->bind(':fieldid', $fieldId, ParameterType::INTEGER);

// If new values are set, delete only old values. Otherwise delete all values.
if ($names)
{
$query->whereNotIn($db->quoteName('value'), $names, ParameterType::STRING);
}

$db->setQuery($query);
$db->execute();
}
Expand Down

0 comments on commit 331b385

Please sign in to comment.