WebFioriAPI ReferenceLearnDownloadContributeLearn{{result.parent_page}} > {{result.title}}{{result.title}}Classes{{result.class_name}}{{result.summary}}Methods{{result.name}}{{result.summary}}

namespace \webfiori\framework\cron

class CronJob

Class Methods Summary

public function __construct(string$when, boolean$autoReg)Creates new instance of the class.public function afterExec()A method that does nothing.public function execute()Execute the job.public function getOnExecution()Returns a callable which represents the code that will be executed when its time to run the job.public function onFail()Run the closure which is set to execute if the job is failed.public function onSuccess()A method that does nothing.public function setOnExecution(callable$func, array$funcParams)Sets the event that will be fired in case it is time to execute the job.public function setOnFailure(callable$func, array$params)Sets a function to call in case the job function has returned false.

Class Methods Details

public function __construct(string$when, boolean$autoReg)Creates new instance of the class.

Parameters:

  • string $when A cron expression. An exception will be thrown if the given expression is invalid. Default is ' ' which means run the job every minute.
  • boolean $autoReg If set to true, the job will be scheduled without having to add it to jobs queue. Default is false.
public function afterExec()A method that does nothing. public function execute()Execute the job. Returns: null|booleanThe return value of the method will depend on the closure which is set to execute. If no closure is set, the method will return null. If it is set, the return value of the closure will be returned by this method.public function getOnExecution()Returns a callable which represents the code that will be executed when its time to run the job. Returns: Callable|nullA callable which represents the code that will be executed when its time to run the job.public function onFail()Run the closure which is set to execute if the job is failed. public function onSuccess()A method that does nothing. public function setOnExecution(callable$func, array$funcParams)Sets the event that will be fired in case it is time to execute the job.

Parameters:

  • callable $func The function that will be executed if it is the time to execute the job. This function can have a return value If the function returned null or true, then it means the job was successfully executed. If it returns false, this means the job did not execute successfully.
  • array $funcParams An array which can hold some parameters that can be passed to the function.
public function setOnFailure(callable$func, array$params)Sets a function to call in case the job function has returned false.

Parameters:

  • callable $func The function that will be executed.
  • array $params An array of parameters that will be passed to the function.
mdi-menuAll Classesmdi-chevron-leftAnchorBrCodeSnippetHTMLDocHTMLListHTMLNodeHTMLTableHeadNodeInputJsCodeLabelListItemOrderedListParagraphRadioGroupTableCellTableRowUnorderedListInvalidNodeNameExceptionTemplateNotFoundExceptionCaseConverterJsonJsonConverterJsonIJsonTypesPropertyAPIFilterAbstractWebServiceManagerInfoServiceParamTypesRequestRequestParameterResponseUriWebServicesManagerAccessAutoLoaderConfigConfigControllerDBEAbstractWebServiceExtendedWebServicesManagerFileLoggerPrivilegePrivilegesGroupThemeThemeLoaderUploadFileUploaderUserUtilWebFioriAppLanguageErrorBoxHTTPCodeViewMessageBoxServerErrViewStarterPageWebPageDatabaseSessionStorageDefaultSessionStorageMSSQLSessionDataTableMSSQLSessionsTableMySQLSessionDataTableMySQLSessionsTableSessionSessionOperationsSessionStorageSessionsManagerRouterRouterUriAbstractMiddlewareMiddlewareManagerEmailMessageSMTPAccountSMTPServerClassLoaderExceptionFileExceptionInitializationExceptionInvalidCRONExprExceptionMissingLangExceptionNoSuchThemeExceptionRoutingExceptionSMTPExceptionSessionExceptionUIExceptionAbstractJobCronCronEmailCronJobJobArgumentCronLoginViewCronTasksViewCronViewCronLoginServiceCronLogoutServiceCronServicesManagerForceCronExecutionServiceGetJobsServiceCLICLICommandInputStreamOutputStreamStdInStdOutClassWriterLangClassWriterQueryClassWriterServiceHolderThemeClassWriterWebServiceWriterCreateCLIClassHelperCreateCronJobCreateMiddlewareCreateTableCreateTableObjCreateThemeHelperCreateWebServiceAddCommandCreateCommandCronCommandHelpCommandListCronCommandListRoutesCommandListThemesCommandRunSQLQueryCommandSettingsCommandTestRouteCommandUpdateSettingsCommandUpdateTableCommandVersionCommandAbstractQueryColumnColumnFactoryConditionConnectionConnectionInfoDatabaseDatabaseExceptionDateTimeValidatorEntityMapperExpressionForeignKeyJoinTableResultSetSelectExpressionTableWhereExpressionMySQLColumnMySQLConnectionMySQLQueryMySQLTableMSSQLColumnMSSQLConnectionMSSQLQueryMSSQLTableAbstractCollectionComparableLinkedListNodeQueueStack
Powered By: WebFiori Framework, Vue and VuetifyAll Rights Reserved © 2018 - 2024