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?

 
hissy replied on at Permalink Reply
hissy
First of all, clear your override cache.
FuriousG3org3 replied on at Permalink Reply
Thanks for the reply,

Cache has been cleared.

I do get an error.

ReflectionException (-1)
Class \Concrete\Job\CreateRssPage does not exist
hissy replied on at Permalink Reply
hissy
OK, then, please share your code of the job. I need namespace, use statements, class name.
FuriousG3org3 replied on at Permalink Reply
<?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() {

}
}
hissy replied on at Permalink Reply
hissy
If you add a job to your application directory, use:

<?php
namespace Application\Job;
FuriousG3org3 replied on at Permalink Reply
Cleared the cache and still got the same error.

Could this be because it's not in the database?
FuriousG3org3 replied on at Permalink Reply
This is fixed by updating the core!