-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlushCache.php
More file actions
37 lines (34 loc) · 931 Bytes
/
FlushCache.php
File metadata and controls
37 lines (34 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* Definition of class FlushCache
*
* @copyright 2014-today Justso GmbH, Frankfurt, Germany
* @author j.schirrmacher@justso.de
*
* @package justso\service
*/
namespace justso\justgen;
use justso\justapi\Bootstrap;
use justso\justapi\RestService;
/**
* Flushes the page cache
*
* @package justso\service
*/
class FlushCache extends RestService
{
public function getAction()
{
$bootstrap = $this->environment->getBootstrap();
$config = $bootstrap->getConfiguration();
$website = $bootstrap->getAppRoot() . '/htdocs/';
$fs = $this->environment->getFileSystem();
foreach ($config['languages'] as $language) {
foreach ($fs->glob($website . $language . '/*') as $page) {
$fs->deleteFile($page);
}
$fs->removeDir($website . $language);
}
$this->environment->sendJSONResult("ok");
}
}