Source of file ClockworkController.php
Size: 0,814 Bytes - Last Modified: 2021-12-23T10:03:11+00:00
/var/www/docs.ssmods.com/process/src/src/ClockworkController.php
1234567891011121314151617181920212223242526272829 | <?php /** * This is the endpoint that serves json to the extension * * @author Mark Guinn <mark@adaircreative.com> * @date 11.07.2014 * @package clockwork */ namespace Clockwork\Support\Silverstripe; use Clockwork\Storage\FileStorage; use Controller; use SS_HTTPRequest; class ClockworkController extends Controller { private static $allowed_actions = array('retrieve'); private static $url_handlers = array('$ID!' => 'retrieve'); public function retrieve(SS_HTTPRequest $request) { $storage = new FileStorage(TEMP_FOLDER . '/clockwork'); $data = $storage->retrieve($request->param('ID')); $response = $this->getResponse(); $response->addHeader('Content-type', 'application/json'); $response->setBody($data->toJson()); return $response; } } |