salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.27k stars 2.03k forks source link

$installdefs parameter `schedulers` in manifest.php is not respected as documented while installing a module #10403

Open isleshocky77 opened 2 months ago

isleshocky77 commented 2 months ago

Issue

The documentation Module Installer states that there is a key for schedulers which would be

An array of schedulers to be installed. Each entry is an array with a single key:

This means that these should be copied to the schedulers directory.

However, in practice, this functionality does not work.

If you look at the $manifestMap in ModuleInstall/ModuleScanner.php:51 as well $tasks ModuleInstall/ModuleInstaller.php:123 you'll see there isn't actually a definition for schedulers or a install_schedulers task.

The work around for this is you need to use the copy key like such

    'copy' => [
        [
            'from' => '<basepath>/schedulers/CustomModule.php',
            'to' => 'custom/Extension/modules/Schedulers/Ext/ScheduledTasks/CustomModule.php',
        ],
    ],

Expected Behavior

When installing a custom module with a manifest.php file that has a key for schedulers, it should install the Scheduler. as documented.

Actual Behavior

The key schedulers key in manifest is just ignored.

Possible Fix

Add the correct functionality to ModuleInstall/ModuleScanner.php:51 and ModuleInstall/ModuleInstaller.php:123

Steps to Reproduce

  1. Create a Custom module
  2. Update the manifest.php to have an array with a key of schedulers
  3. Create in the module a Scheduler
  4. Install the custom module through Module Loader
  5. Look at scheduled jobs

Context

The documentation is wrong and takes a bit of debugging to figure out. You then need to use the copy key instead of a cleaner schedulers key for what is actually going on.

Your Environment