silverstripe-framework/control/FlushRequestFilter.php

44 lines
856 B
PHP
Raw Normal View History

<?php
/**
* Triggers a call to flush() on all implementors of Flushable.
*
* @package framework
2015-11-13 23:44:49 +01:00
*
* @subpackage control
*/
class FlushRequestFilter implements RequestFilter {
2015-11-13 23:44:49 +01:00
/**
* @inheritdoc
*
* @param SS_HTTPRequest $request
* @param Session $session
* @param DataModel $model
*
* @return bool
*/
public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model) {
if(array_key_exists('flush', $request->getVars())) {
foreach(ClassInfo::implementorsOf('Flushable') as $class) {
$class::flush();
}
}
return true;
2015-08-06 01:47:17 +02:00
}
2015-11-13 23:44:49 +01:00
/**
* @inheritdoc
*
* @param SS_HTTPRequest $request
* @param SS_HTTPResponse $response
* @param DataModel $model
*
* @return bool
*/
public function postRequest(SS_HTTPRequest $request, SS_HTTPResponse $response, DataModel $model) {
return true;
}
}