mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2024-12-22 10:58:58 +00:00
commit
684a17b6c9
@ -17,6 +17,7 @@ use Joomla\Component\Patchtester\Administrator\Github\Exception\UnexpectedRespon
|
|||||||
use Joomla\Component\Patchtester\Administrator\GithubCredentialsTrait;
|
use Joomla\Component\Patchtester\Administrator\GithubCredentialsTrait;
|
||||||
use Joomla\Component\Patchtester\Administrator\Helper\Helper;
|
use Joomla\Component\Patchtester\Administrator\Helper\Helper;
|
||||||
use Joomla\Database\DatabaseQuery;
|
use Joomla\Database\DatabaseQuery;
|
||||||
|
use Joomla\Database\ParameterType;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
// phpcs:disable PSR1.Files.SideEffects
|
// phpcs:disable PSR1.Files.SideEffects
|
||||||
@ -210,20 +211,15 @@ class PullsModel extends ListModel
|
|||||||
. ' ON ' . $db->quoteName('tests.pull_id') . ' = '
|
. ' ON ' . $db->quoteName('tests.pull_id') . ' = '
|
||||||
. $db->quoteName('pulls.pull_id')
|
. $db->quoteName('pulls.pull_id')
|
||||||
);
|
);
|
||||||
$search = $this->getState()->get('filter.search');
|
|
||||||
|
|
||||||
if (!empty($search)) {
|
if ($search = $this->getState()->get('filter.search')) {
|
||||||
if (stripos($search, 'id:') === 0) {
|
if (stripos($search, 'id:') === 0) {
|
||||||
$query->where(
|
$search = (int) substr($search, 3);
|
||||||
$db->quoteName('pulls.pull_id') . ' = ' . (int)substr(
|
$query->where($db->quoteName('pulls.pull_id') . ' = :pullid')
|
||||||
$search,
|
->bind(':pullid', $search);
|
||||||
3
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} elseif (is_numeric($search)) {
|
} elseif (is_numeric($search)) {
|
||||||
$query->where(
|
$query->where($db->quoteName('pulls.pull_id') . ' = :pullid')
|
||||||
$db->quoteName('pulls.pull_id') . ' = ' . (int)$search
|
->bind(':pullid', $search);
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
$query->where(
|
$query->where(
|
||||||
'(' . $db->quoteName('pulls.title') . ' LIKE ' . $db->quote(
|
'(' . $db->quoteName('pulls.title') . ' LIKE ' . $db->quote(
|
||||||
@ -234,40 +230,33 @@ class PullsModel extends ListModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
$applied = $this->getState()->get('filter.applied');
|
$applied = $this->getState()->get('filter.applied');
|
||||||
if (!empty($applied)) {
|
if (is_numeric($applied)) {
|
||||||
// Not applied patches have a NULL value, so build our value part of the query based on this
|
// Not applied patches have a NULL value, so build our value part of the query based on this
|
||||||
$value = $applied === 'no' ? ' IS NULL' : ' = 1';
|
$value = $applied === '0' ? ' IS NULL' : ' = 1';
|
||||||
$query->where($db->quoteName('applied') . $value);
|
$query->where($db->quoteName('applied') . $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$branch = $this->getState()->get('filter.branch');
|
$branch = $this->getState()->get('filter.branch');
|
||||||
if (!empty($branch)) {
|
if (!empty($branch)) {
|
||||||
$query->where(
|
$query->whereIn($db->quoteName('pulls.branch'), (array) $branch, ParameterType::STRING);
|
||||||
$db->quoteName('pulls.branch') . ' IN (' . implode(
|
|
||||||
',',
|
|
||||||
$db->quote($branch)
|
|
||||||
) . ')'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$applied = $this->getState()->get('filter.rtc');
|
$rtc = $this->getState()->get('filter.rtc');
|
||||||
if (!empty($applied)) {
|
if (is_numeric($rtc)) {
|
||||||
// Not applied patches have a NULL value, so build our value part of the query based on this
|
$query->where($db->quoteName('pulls.is_rtc') . ' = :rtc')
|
||||||
$value = $applied === 'no' ? '0' : '1';
|
->bind(':rtc', $rtc);
|
||||||
$query->where($db->quoteName('pulls.is_rtc') . ' = ' . $value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$npm = $this->getState()->get('filter.npm', '');
|
$npm = $this->getState()->get('filter.npm', '');
|
||||||
|
if (is_numeric($npm)) {
|
||||||
if (strlen($npm) === 1) {
|
$query->where($db->quoteName('pulls.is_npm') . ' = :npm')
|
||||||
$query->where($db->quoteName('pulls.is_npm') . ' = ' . (int) $npm);
|
->bind(':npm', $npm);
|
||||||
}
|
}
|
||||||
|
|
||||||
$draft = $this->getState()->get('filter.draft');
|
$draft = $this->getState()->get('filter.draft');
|
||||||
if (!empty($draft)) {
|
if (is_numeric($draft)) {
|
||||||
// Not applied patches have a NULL value, so build our value part of the query based on this
|
$query->where($db->quoteName('pulls.is_draft') . ' = :draft')
|
||||||
$value = $draft === 'no' ? '0' : '1';
|
->bind(':draft', $draft);
|
||||||
$query->where($db->quoteName('pulls.is_draft') . ' = ' . $value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$labels = $this->getState()->get('filter.label');
|
$labels = $this->getState()->get('filter.label');
|
||||||
|
Loading…
Reference in New Issue
Block a user