Commit 743efdfe authored by Jos Schellevis's avatar Jos Schellevis

(cron) Add model implementation

parent b7856e38
<?php
/**
* Copyright (C) 2015 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Cron;
use OPNsense\Base\BaseModel;
class Cron extends BaseModel
{
}
<model>
<mount>//OPNsense/cron</mount>
<description>
(minicron) cron settings
</description>
<items>
<jobs>
<job type="ArrayField">
<origin type="TextField">
<Required>Y</Required>
<mask>/^([a-z,A-Z,1-9]){0,30}$/</mask>
<ValidationMessage>Origin should be regular text of max 30 characters</ValidationMessage>
</origin>
<enabled type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enabled>
<minutes type="TextField">
<default>0</default>
<Required>Y</Required>
<mask>/^((?:\*|[1-5][0-9]|0[0-9]|[0-9])(,{1}|-{1}|$))+$/</mask>
<ValidationMessage>Value needs to be between 0 and 59, multiple values, ranges and * are supported (ex. 1,10,20,30 or 1-30 )</ValidationMessage>
</minutes>
<hours type="TextField">
<default>0</default>
<Required>Y</Required>
<mask>/^((?:\*|[1-2][0-3]|0[0-9]|[0-9])(,{1}|-{1}|$))+$/</mask>
<ValidationMessage>Value needs to be between 0 and 23, multiple values, ranges and * are supported (ex. 1,2,8 or 0-8 )</ValidationMessage>
</hours>
<days type="TextField">
<default>*</default>
<Required>Y</Required>
<mask>/^(((?:\*|[1-2][0-9]|0[1-9]|[1-9]|[3][0-1])(,{1}|-{1}|$))+|L)$/</mask>
<ValidationMessage>Value needs to be between 1 and 31, multiple values, ranges, L (last day of month) and * are supported (ex. 1,2,8 or 1-28 )</ValidationMessage>
</days>
<months type="TextField">
<default>*</default>
<Required>Y</Required>
<mask>/^(((?:\*|[1][0-2]|0[1-9]|[1-9]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(,{1}|-{1}|$))+)$/</mask>
<ValidationMessage>Value needs to be between 1 and 12 or JAN to DEC, multiple values, ranges and * are supported (ex. JAN,2,10 or 3-8 )</ValidationMessage>
</months>
<weekdays type="TextField">
<default>*</default>
<Required>Y</Required>
<mask>/^(((?:\*|[0-6])(,{1}|-{1}|$))+)$/</mask>
<ValidationMessage>Value needs to be between 0 and 6 ( Sunday to Saturday), multiple values, ranges and * are supported (ex. 1,2,4 or 0-4 ) </ValidationMessage>
</weekdays>
<who type="TextField">
<default>root</default>
<Required>Y</Required>
</who>
<command type="ConfigdActionsField">
<filters>
<description>/(.){1,255}/</description>
</filters>
<ValidationMessage>Select a command from the list.</ValidationMessage>
<Required>Y</Required>
</command>
<parameters type="TextField">
<mask>/^([^;|`]){1,255}$/</mask>
<ValidationMessage>Enter valid parameter(s) for the chosen command (Found illegal characters).</ValidationMessage>
<Required>N</Required>
</parameters>
<description type="TextField">
<mask>/^(.){1,255}$/</mask>
<ValidationMessage>Enter a description.</ValidationMessage>
<Required>Y</Required>
</description>
</job>
</jobs>
</items>
</model>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment