Skip to content

Commit

Permalink
2.0.1
Browse files Browse the repository at this point in the history
PHP error if category list is empty
  • Loading branch information
conseilgouz committed Feb 14, 2024
1 parent c74ac0a commit 8edd44c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cgautoarchive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="4.1" type="plugin" group="task" method="upgrade">
<name>plg_task_cgautoarchive</name>
<author>conseilgouz</author>
<creationDate>2024-02-13</creationDate>
<creationDate>2024-02-14</creationDate>
<copyright>Copyright (C) 2024 ConseilGouz. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
<authorUrl>www.conseilgouz.com</authorUrl>
<version>2.0.0</version>
<version>2.0.1</version>
<description>PLG_TASK_CGAUTOARCHIVE_DESC</description>
<namespace path="src">ConseilGouz\Plugin\Task\CGAutoArchive</namespace>
<files>
Expand Down
12 changes: 12 additions & 0 deletions cgautoarchive_changelog.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<changelogs>
<changelog>
<element>cgautoarchive</element>
<type>plugin</type>
<group>task</group>
<version>2.0.1</version>
<note>
<item>14/02/2024</item>
</note>
<fix>
<item>PHP error if category list is empty</item>
</fix>
</changelog>
<changelog>
<element>cgautoarchive</element>
<type>plugin</type>
Expand Down
5 changes: 3 additions & 2 deletions src/Extension/Cgautoarchive.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/** CG Auto Archive
*
* Version : 2.0.0
* Version : 2.0.1
* Package : Joomla 4.x/5.x
* copyright : Copyright (C) 2024 ConseilGouz. All rights reserved.
* license : https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
Expand Down Expand Up @@ -71,12 +71,13 @@ protected function cgautoarchive(ExecuteTaskEvent $event): int {
}
if (($params->task_choice == 'EOL') || ($params->task_choice == 'BOTH')) {
$cats = $params->categories;
if (!is_array($cats)) $cats = [];
try {
$query = $db->getQuery(true);
$query->update("#__content")
->set('state =2')
->where('publish_up <= DATE_SUB(now(),INTERVAL '.$params->sqlinterval.' '.$params->sqldatetype.') AND state IN (0, 1)');
if (sizeOf($cats)) $query->where('catid in ('.implode(",",$cats).')');
if (sizeof($cats)) $query->where('catid in ('.implode(",",$cats).')');
$db->setQuery($query);
$db->execute();
} catch ( RuntimeException $e ) {
Expand Down

0 comments on commit 8edd44c

Please sign in to comment.