Adding new Automated Jobs
Permalink 1 user found helpful
Hello all,
There is no documentation yet for adding new automated jobs. I have tried the 5.6 docs but no luck. I want to add a new automated job to the dashboard. Here is what I have tried so far.
Making a directory in my applications folder called jobs with a class file inside that extends AbstractJob.
I have also tried adding it directly to the core to see if it would work.
No luck on these.
Any suggestions?
There is no documentation yet for adding new automated jobs. I have tried the 5.6 docs but no luck. I want to add a new automated job to the dashboard. Here is what I have tried so far.
Making a directory in my applications folder called jobs with a class file inside that extends AbstractJob.
I have also tried adding it directly to the core to see if it would work.
No luck on these.
Any suggestions?
First of all, clear your override cache.
Thanks for the reply,
Cache has been cleared.
I do get an error.
ReflectionException (-1)
Class \Concrete\Job\CreateRssPage does not exist
Cache has been cleared.
I do get an error.
ReflectionException (-1)
Class \Concrete\Job\CreateRssPage does not exist
OK, then, please share your code of the job. I need namespace, use statements, class name.
<?php
namespace Concrete\Job;
use Core;
use Config;
use \Job as AbstractJob;
use Loader;
use PermissionKey;
use Group;
use CollectionAttributeKey;
use Page;
use Events;
class CreateRssPage extends AbstractJob {
/** The end-of-line terminator.
* @var string
*/
const EOL = "\n";
/** Returns the job name.
* @return string
*/
public function getJobName() {
return t('Create new RSS Pages');
}
/** Returns the job description.
* @return string
*/
public function getJobDescription() {
return t('Create New RSS Pages');
}
public function run() {
$parentPage = \Page::getByPath('/sitrep');
$pageType = \PageType::getByHandle('blank');
$entry = $parentPage->add($pageType, array(
'cName' => 'Hello World!',
'cDescription' => 'Just a quick feed post.',
'cHandle ' => 'hello-all'
), $template);
}
private static function addPage() {
}
}
namespace Concrete\Job;
use Core;
use Config;
use \Job as AbstractJob;
use Loader;
use PermissionKey;
use Group;
use CollectionAttributeKey;
use Page;
use Events;
class CreateRssPage extends AbstractJob {
/** The end-of-line terminator.
* @var string
*/
const EOL = "\n";
/** Returns the job name.
* @return string
*/
public function getJobName() {
return t('Create new RSS Pages');
}
/** Returns the job description.
* @return string
*/
public function getJobDescription() {
return t('Create New RSS Pages');
}
public function run() {
$parentPage = \Page::getByPath('/sitrep');
$pageType = \PageType::getByHandle('blank');
$entry = $parentPage->add($pageType, array(
'cName' => 'Hello World!',
'cDescription' => 'Just a quick feed post.',
'cHandle ' => 'hello-all'
), $template);
}
private static function addPage() {
}
}
If you add a job to your application directory, use:
<?php namespace Application\Job;
Cleared the cache and still got the same error.
Could this be because it's not in the database?
Could this be because it's not in the database?
This is fixed by updating the core!