mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
Merge remote-tracking branch 'origin/1.0'
This commit is contained in:
commit
bb9e912fe1
@ -13,7 +13,7 @@ env:
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.4
|
||||
env: DB=MYSQL CORE_RELEASE=master
|
||||
env: DB=MYSQL CORE_RELEASE=3.0
|
||||
|
||||
before_script:
|
||||
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
|
||||
|
@ -12,17 +12,17 @@
|
||||
*/
|
||||
class MultiFormSession extends DataObject {
|
||||
|
||||
private static $db = array(
|
||||
public static $db = array(
|
||||
'Hash' => 'Varchar(40)', // cryptographic hash identification to this session
|
||||
'IsComplete' => 'Boolean' // flag to determine if this session is marked completed
|
||||
);
|
||||
|
||||
private static $has_one = array(
|
||||
public static $has_one = array(
|
||||
'Submitter' => 'Member',
|
||||
'CurrentStep' => 'MultiFormStep'
|
||||
);
|
||||
|
||||
private static $has_many = array(
|
||||
public static $has_many = array(
|
||||
'FormSteps' => 'MultiFormStep'
|
||||
);
|
||||
|
||||
|
@ -11,11 +11,11 @@
|
||||
*/
|
||||
class MultiFormStep extends DataObject {
|
||||
|
||||
private static $db = array(
|
||||
public static $db = array(
|
||||
'Data' => 'Text' // stores serialized maps with all session information
|
||||
);
|
||||
|
||||
private static $has_one = array(
|
||||
public static $has_one = array(
|
||||
'Session' => 'MultiFormSession'
|
||||
);
|
||||
|
||||
|
@ -5,8 +5,10 @@
|
||||
*
|
||||
* Setup Instructions:
|
||||
* You need to create an automated task for your system (cronjobs on unix)
|
||||
* which triggers the run() method through cli-script.php:
|
||||
* /your/path/sapphire/cli-script.php MultiFormPurgeTask/run
|
||||
* which triggers the process() method through cli-script.php:
|
||||
* `php framework/cli-script.php MultiFormPurgeTask`
|
||||
* or
|
||||
* `framework/sake MultiFormPurgeTask`
|
||||
*
|
||||
* @package multiform
|
||||
*/
|
||||
@ -27,11 +29,12 @@ class MultiFormPurgeTask extends DailyTask {
|
||||
* are older than the days specified in $session_expiry_days
|
||||
* and delete them.
|
||||
*/
|
||||
public function run() {
|
||||
public function process() {
|
||||
$sessions = $this->getExpiredSessions();
|
||||
$delCount = 0;
|
||||
if($sessions) foreach($sessions as $session) {
|
||||
if($session->delete()) $delCount++;
|
||||
$session->delete();
|
||||
$delCount++;
|
||||
}
|
||||
echo $delCount . ' session records deleted that were older than ' . self::$session_expiry_days . ' days.';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user