Skip to content

Commit 0eee31d

Browse files
authored
[6.0] Upmerges - 2025-11-18
Merge pull request #46463 from Bodge-IT/upmerges/2025-11-18
2 parents 10d106a + 18a6c49 commit 0eee31d

File tree

4 files changed

+2
-143
lines changed

4 files changed

+2
-143
lines changed

administrator/components/com_finder/src/Model/FilterModel.php

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
namespace Joomla\Component\Finder\Administrator\Model;
1212

1313
use Joomla\CMS\Factory;
14-
use Joomla\CMS\Filter\OutputFilter;
1514
use Joomla\CMS\Form\Form;
1615
use Joomla\CMS\MVC\Model\AdminModel;
1716
use Joomla\Component\Finder\Administrator\Table\FilterTable;
18-
use Joomla\String\StringHelper;
1917

2018
// phpcs:disable PSR1.Files.SideEffects
2119
\defined('_JEXEC') or die;
@@ -151,137 +149,4 @@ public function getTotal()
151149

152150
return $db->setQuery($query)->loadResult();
153151
}
154-
155-
/**
156-
* Method to save the form data.
157-
*
158-
* Overrides the parent to correctly handle the 'save2copy' task for Finder filters.
159-
*
160-
* @param array $data The form data.
161-
*
162-
* @return boolean True on success, false on failure.
163-
*
164-
* @since 6.0.1
165-
*/
166-
public function save($data)
167-
{
168-
$app = Factory::getApplication();
169-
$task = $app->getInput()->get('task', '', 'cmd');
170-
171-
if ($task === 'save2copy') {
172-
$data['filter_id'] = 0;
173-
174-
$title = trim((string) ($data['title'] ?? ''));
175-
$alias = trim((string) ($data['alias'] ?? ''));
176-
177-
if ($alias === '') {
178-
$alias = OutputFilter::stringURLSafe($title);
179-
}
180-
181-
// Generate unique title + alias
182-
list($title, $alias) = $this->generateNewTitleAndAlias($title, $alias);
183-
184-
$data['title'] = $title;
185-
$data['alias'] = $alias;
186-
}
187-
188-
return parent::save($data);
189-
}
190-
191-
/**
192-
* Generate a new unique title and alias for a copied filter.
193-
* Follows the same logic as Joomla's core content models.
194-
*
195-
* @param string $title The original title.
196-
* @param string $alias The original alias.
197-
*
198-
* @return array Array with [newTitle, newAlias].
199-
*
200-
* @since 6.0.1
201-
*/
202-
protected function generateNewTitleAndAlias(string $title, string $alias): array
203-
{
204-
$db = $this->getDatabase();
205-
206-
if (preg_match('/^(.*?)(?:\s\((\d+)\))?$/', $title, $matches)) {
207-
$baseTitle = trim($matches[1]);
208-
} else {
209-
$baseTitle = trim($title);
210-
}
211-
212-
$baseAlias = trim($alias ?: OutputFilter::stringURLSafe($title));
213-
214-
$likeTitle = $db->quote($db->escape($baseTitle, true) . '%', false);
215-
216-
$query = $db->getQuery(true)
217-
->select($db->quoteName('title'))
218-
->from($db->quoteName('#__finder_filters'))
219-
->where($db->quoteName('title') . ' LIKE ' . $likeTitle);
220-
221-
$existingTitles = $db->setQuery($query)->loadColumn();
222-
223-
$maxNum = 0;
224-
foreach ($existingTitles as $existing) {
225-
if (preg_match('/^\Q' . $baseTitle . '\E(?:\s\((\d+)\))?$/', $existing, $matches)) {
226-
$num = isset($matches[1]) ? (int) $matches[1] : 1;
227-
if ($num > $maxNum) {
228-
$maxNum = $num;
229-
}
230-
}
231-
}
232-
233-
$nextNum = $maxNum + 1;
234-
235-
$newTitle = $baseTitle;
236-
if ($nextNum > 1) {
237-
$newTitle .= ' (' . $nextNum . ')';
238-
}
239-
240-
// Build a unique alias
241-
$newAlias = $this->getUniqueAlias($baseAlias);
242-
243-
return [$newTitle, $newAlias];
244-
}
245-
246-
/**
247-
* Ensure a unique alias in the table by incrementing with dash style.
248-
*
249-
*
250-
* @param string $base The starting alias (already URL-safe).
251-
*
252-
* @return string A unique alias.
253-
*
254-
* @since 6.0.1
255-
*/
256-
protected function getUniqueAlias(string $base): string
257-
{
258-
$alias = $base !== '' ? $base : OutputFilter::stringURLSafe(uniqid('filter-', true));
259-
260-
while ($this->aliasExists($alias)) {
261-
$alias = StringHelper::increment($alias, 'dash');
262-
}
263-
264-
return $alias;
265-
}
266-
267-
/**
268-
* Check whether an alias exists in the table.
269-
*
270-
* @param string $alias The alias to test.
271-
*
272-
* @return boolean True if it exists, false otherwise.
273-
*
274-
* @since 6.0.1
275-
*/
276-
protected function aliasExists(string $alias): bool
277-
{
278-
$db = $this->getDatabase();
279-
$query = $db->getQuery(true)
280-
->select('COUNT(*)')
281-
->from($db->quoteName('#__finder_filters'))
282-
->where($db->quoteName('alias') . ' = :alias')
283-
->bind(':alias', $alias);
284-
285-
return (int) $db->setQuery($query)->loadResult() > 0;
286-
}
287152
}

administrator/components/com_finder/tmpl/filters/default.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
<th scope="col">
6060
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
6161
</th>
62-
<th scope="col">
63-
<?php echo HTMLHelper::_('searchtools.sort', 'JALIAS', 'a.alias', $listDirn, $listOrder); ?>
64-
</th>
6562
<th scope="col" class="w-10 d-none d-md-table-cell">
6663
<?php echo HTMLHelper::_('searchtools.sort', 'COM_FINDER_HEADING_CREATED_BY', 'a.created_by_alias', $listDirn, $listOrder); ?>
6764
</th>
@@ -106,9 +103,6 @@
106103
<?php echo $escapedTitle; ?>
107104
<?php endif; ?>
108105
</th>
109-
<td class="d-none d-md-table-cell">
110-
<?php echo $item->alias; ?>
111-
</td>
112106
<td class="d-none d-md-table-cell">
113107
<?php echo $item->created_by_alias ?: $item->user_name; ?>
114108
</td>

installation/src/Model/ChecksModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public function getForm($view = null)
260260
*
261261
* @return boolean
262262
*
263-
* @since 6.0.1
263+
* @since 5.4.1
264264
*/
265265
public function getAutoUpdatesDisabled(): bool
266266
{

installation/src/View/Remove/HtmlView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class HtmlView extends BaseHtmlView
7070
* If updates are disabled, we hide the box
7171
*
7272
* @var boolean
73-
* @since 6.0.1
73+
* @since 5.4.1
7474
*/
7575
protected $autoUpdatesDisabled = false;
7676

0 commit comments

Comments
 (0)