Update: This seems to be an issue in 11.28.87 and 11.30.1
Hey, Ive been using the CustomEventHandler.pm to tap into various api and deny certain actions - in this example the cron::add_line call.
What im trying to achieve here is - if a user tries to add a cron which runs with a frequency less than 15 mins,
I want to throw an error on the page..
Heres the snippet
While the evenhandler works perfect, cron is prevented from being added, I don't get the message displayed on the page which Ive defined - $CPanel::CPERROR{$Cpanel::context} = "[fail]";if ( $module eq 'cron' && $event eq 'add_line' ){
my $logger = Cpanel::Logger->new({ alternate_logfile => "/var/tmp/cpanel_api_install.log" });
$logger->info("$apiv, $type, $module, $event");
my $cron_minute = $cfgref->{'minute'};
if ( $cron_minute =~ /\*/){
$logger->info(Dumper($cfgref->{'minute'}));
$CPanel::CPERROR{$Cpanel::context} = "[fail]";
return;
}
return 1;
}
Instead I see an error box with
- Am I missing something out?Error
JSON parse failed.
- Is there a better way to do what im trying to
- Is there any hack I could implement to display the message
Thanks,
Joel



LinkBack URL
About LinkBacks
Reply With Quote





