Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
Apply misc patches to job plugins
Browse files Browse the repository at this point in the history
- Adds _JEXEC checks.
- Fixes phpdoc comments and typehints.
- Improves code-style.
  • Loading branch information
ditsuke committed Aug 14, 2021
1 parent e8db781 commit 152a319
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
12 changes: 10 additions & 2 deletions plugins/job/requests/requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
* A job plugin to make GET requests.
*
* @package Joomla.Plugins
* @subpackage System.testjob
* @subpackage Job.Requests
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GPL v3
*/

// Restrict direct access
defined('_JEXEC') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Http\HttpFactory;
use Joomla\CMS\Plugin\CMSPlugin;
Expand All @@ -19,6 +22,7 @@
use Joomla\Registry\Registry;

/**
* The plugin class
*
* @since __DEPLOY_VERSION__
*/
Expand Down Expand Up @@ -73,8 +77,9 @@ public static function getSubscribedEvents(): array
}

/**
* @param CronRunEvent $event
* @param CronRunEvent $event The onCronRun event
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
Expand All @@ -95,6 +100,8 @@ public function makeRequest(CronRunEvent $event): void
* @param Event $event The onContentPrepareForm event.
*
* @return void
*
* @throws Exception
* @since __DEPLOY_VERSION
*/
public function enhanceForm(Event $event): void
Expand All @@ -115,6 +122,7 @@ public function enhanceForm(Event $event): void
* @param CronRunEvent $event The onCronRun event
*
* @return integer The exit code
*
* @since __DEPLOY_VERSION__
*/
protected function makeGetRequest(CronRunEvent $event): int
Expand Down
9 changes: 7 additions & 2 deletions plugins/job/testjob/testjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
* A test plugin for com_cronjobs.
*
* @package Joomla.Plugins
* @subpackage System.testjob
* @subpackage System.TestJob
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GPL v3
*/

// Restrict direct access
defined('_JEXEC') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Component\Cronjobs\Administrator\Event\CronRunEvent;
Expand All @@ -17,7 +20,7 @@
use Joomla\Event\SubscriberInterface;

/**
* The PlgJobTestjob class
* The plugin class
*
* @since __DEPLOY__VERSION__
*/
Expand Down Expand Up @@ -100,6 +103,8 @@ public function cronSampleRoutine(CronRunEvent $event): void
* @param Event $event The onContentPrepareForm event.
*
* @return void
*
* @throws Exception
* @since __DEPLOY_VERSION__
*/
public function manipulateForms(Event $event): void
Expand Down
13 changes: 10 additions & 3 deletions plugins/job/toggleoffline/toggleoffline.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
* A job plugin to toggle the offline status of the site.
*
* @package Joomla.Plugins
* @subpackage System.testjob
* @subpackage Job.ToggleOffline
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GPL v3
*/

// Restrict direct access
defined('_JEXEC') or die;

use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Component\Cronjobs\Administrator\Event\CronRunEvent;
use Joomla\Component\Cronjobs\Administrator\Traits\CronjobPluginTrait;
Expand All @@ -29,6 +32,10 @@ class PlgJobToggleoffline extends CMSPlugin implements SubscriberInterface
{
use CronjobPluginTrait;

/**
* @var string[]
* @since __DEPLOY_VERSION__
*/
protected const JOBS_MAP = [
'plg_job_toggle_offline' => [
'langConstPrefix' => 'PLG_JOB_TOGGLE_OFFLINE'
Expand Down Expand Up @@ -105,7 +112,7 @@ public function toggleOffline(CronRunEvent $event): void
*
* @param Registry $config A Registry object containing all global config data.
*
* @return int The job exit code
* @return integer The job exit code
*
* @since __DEPLOY_VERSION__
*/
Expand Down

0 comments on commit 152a319

Please sign in to comment.