I'm trying to set up regular tasks for my website using the Cron job feature from my web provider. The problem I have is that I have an extension class (code copied below) which works perfectly when browsing the website, but produces a class not found error when code is run by the cron job command line. I've spent a long time doing basic checks, and I have another extension class in the same folder which is added in the same config file and has no problems. I used the class_exists function to output to an e-mail through the cron job and to one of my web pages, and confirmed that it returns true to the web, but false to my e-mail!
Is there any difference in the way the code is built when run through command line compared to being accessed through a browser? Any reason why the code for this particular class would be ignored by my cron job even through the website finds it, builds it and uses the function it contains? Any suggestions on further tests I could run?
In the code below the two php files are in the same folder. When I remove the first add_extension everything works fine, so it is building the VerificationExtension class fine, but FormFieldExtension causes the fatal error.
In config.php
Object::add_extension('FormField', 'FormFieldExtension');
Object::add_extension('Page_Controller', 'VerificationExtension');
In FormFieldExtension.php
<?php
class FormFieldExtension extends Extension {
public function hasNoLabelClass() {
if($self = $this->owner) {
if($self->hasClass("nolabel")) {
return true;
}
}
return false;
}
}
In VerificationExtension.php
<?php
class VerificationExtension extends Extension {
public function Verified() {
if($member = Member::CurrentMember()){
if($member->RegistrationStatus > 1) {
return true;
}
}
return false;
}
}