Skip to content

Conversation

@ditsuke
Copy link
Contributor

@ditsuke ditsuke commented Dec 27, 2021

Summary of Changes

Replace the ExecRuleHelper class with Task::computeNextExecution().

Testing Instructions

  • Creating new tasks and modifying existing tasks works as expected.
  • Triggered tasks computer next execution date as expected from configuration.

Actual result BEFORE applying this Pull Request

ExecRuleHelper exists, for little reason.

Expected result AFTER applying this Pull Request

ExecRuleHelper is safely replaced by Task::computeNextExecution()

Documentation Changes Required

-

- Task::computeNextExecution() replaces ExecRuleHelper::nextExec().
- Replaces ExecRuleHelper() usages.
ExecRuleHelper is made redundant with the addition of
Task::computeNextExecution(). Given all its usages have been replaced,
this commit safely removes the class.
@chmst
Copy link
Contributor

chmst commented Dec 31, 2021

I applied this patch and tried to change settings of a task:
settings-task

When saving this settings:
error-task

PHP 8.0, win11 and xampp

@richard67
Copy link
Member

The removed helper PHP will have to be added to the list of files to be deleted on update in script.php. I will do that when this PR has been merged.

@richard67
Copy link
Member

richard67 commented Dec 31, 2021

@ditsuke I think @chmst indeed found an issue with your changed code, possibly here: https://github.com/joomla/joomla-cms/pull/36439/files#diff-b9f75ae33fad36d7a8968d12a2b78ec972c5e6d2c6fd7ed0024d764191ec48ecR572 .

Possibly a type cast to object is not sufficient. I don't have looked up now what the constructor expects.

Fixes issue identified with creating/saving tasks. Since Task objects
are also now created by TaskModel::save(), the parameter resolution in
the constructor must accommodate for records from both the database and
form submissions (both cast to object). This commit adds the necessary
check, so we can deal with both possible types.
@ditsuke
Copy link
Contributor Author

ditsuke commented Jan 1, 2022

@chmst @richard67 thanks for identifying the issue and the source! The latest commit should solve it. Please test.

@chmst
Copy link
Contributor

chmst commented Jan 1, 2022

You fixed the code error, but I don't understand why the Task Params are twice. First in tab "New Task" and in tab "Advanced"?

@ditsuke
Copy link
Contributor Author

ditsuke commented Jan 1, 2022

You fixed the code error, but I don't understand why the Task Params are twice. First in tab "New Task" and in tab "Advanced"?

@chmst I addressed that in #36515 (needs test). We need the routine parameter fieldset to have a showFront="true" attribute at the moment. Although I don't think that's ideal, this PR should work for now. Let's try to work on removing this requirement in the future!

@ditsuke
Copy link
Contributor Author

ditsuke commented Jan 15, 2022

Could we please get a couple tests on this 😃

…lper

Conflicts:
	administrator/components/com_scheduler/src/Task/Task.php
@HLeithner HLeithner changed the base branch from 4.1-dev to 4.2-dev June 27, 2022 13:06
@HLeithner
Copy link
Member

This pull request has automatically rebased to 4.2-dev.

@chmst
Copy link
Contributor

chmst commented Oct 22, 2022

@ditsuke this PR is still open. could you please resolve the conflicts so that we can re-test?

@Hackwar Hackwar added the Feature label Apr 6, 2023
@HLeithner HLeithner changed the base branch from 4.2-dev to 5.0-dev May 2, 2023 16:42
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.0-dev.

@HLeithner HLeithner changed the base branch from 5.0-dev to 5.1-dev September 30, 2023 22:52
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.1-dev.

@HLeithner HLeithner changed the base branch from 5.1-dev to 5.2-dev April 24, 2024 09:09
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.2-dev.

@HLeithner HLeithner changed the title [4.1] Remove ExecRuleHelper [5.2] Remove ExecRuleHelper Apr 24, 2024
@cybersalt
Copy link

I have tested this item 🔴 unsuccessfully on 4f91c6a

I opened an existing task, changed a setting, saved and closed and got a 500 error:

An error has occurred.
0 Class "Joomla\Component\Scheduler\Administrator\Model\ExecRuleHelper" not found
Call Stack

Function Location

1 () JROOT/administrator/components/com_scheduler/src/Model/TaskModel.php:571
2 Joomla\Component\Scheduler\Administrator\Model\TaskModel->save() JROOT/libraries/src/MVC/Controller/FormController.php:689
3 Joomla\CMS\MVC\Controller\FormController->save() JROOT/libraries/src/MVC/Controller/BaseController.php:730
4 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
5 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
6 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:150
7 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:195
8 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:306
9 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:58
10 require_once() JROOT/administrator/index.php:32


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36439.

@ghost
Copy link

ghost commented Sep 2, 2024

@cybersalt same as this comment

@HLeithner HLeithner changed the base branch from 5.2-dev to 5.3-dev September 2, 2024 08:54
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.3-dev.

@HLeithner HLeithner changed the title [5.2] Remove ExecRuleHelper [5.3] Remove ExecRuleHelper Sep 2, 2024
@Hackwar Hackwar removed the PR-5.2-dev label Sep 3, 2024
@HLeithner HLeithner changed the base branch from 5.3-dev to 6.0-dev March 4, 2025 17:23
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 6.0-dev.

@HLeithner HLeithner changed the title [5.3] Remove ExecRuleHelper [6.0] Remove ExecRuleHelper Mar 4, 2025
@rdeutz rdeutz removed the PR-5.3-dev label Mar 5, 2025
@MacJoom MacJoom marked this pull request as draft March 31, 2025 19:01
Hackwar added 3 commits March 31, 2025 21:21
# Conflicts:
#	administrator/components/com_scheduler/src/Helper/ExecRuleHelper.php
#	administrator/components/com_scheduler/src/Model/TaskModel.php
#	administrator/components/com_scheduler/src/Task/Task.php
*
* @return ?Date|string Next due execution.
*
* @since 4.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 4.1.0
* @since __DEPLOY_VERSION__

@MacJoom MacJoom marked this pull request as ready for review April 1, 2025 09:08
@HLeithner HLeithner changed the base branch from 6.0-dev to 6.1-dev August 31, 2025 12:01
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 6.1-dev.

@HLeithner HLeithner changed the title [6.0] Remove ExecRuleHelper [6.1] Remove ExecRuleHelper Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.