Completed
Push — master ( 62ba97...e9b6cb )
by Nazar
04:41 queued 29s
created

optimization::optimization_clean_public_cache()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @package    CleverStyle Framework
4
 * @subpackage System module
5
 * @category   modules
6
 * @author     Nazar Mokrynskyi <[email protected]>
7
 * @copyright  Copyright (c) 2016, Nazar Mokrynskyi
8
 * @license    MIT License, see license.txt
9
 */
10
namespace cs\modules\System\cli\Controller;
11
use
12
	cs\modules\System\api\Controller as Api_controller;
13
14
trait optimization {
15
	/**
16
	 * @return string
17
	 */
18
	public static function optimization_help () {
19
		return <<<HELP
20
<y>System optimization</y>
21
22
<y>Methods:</y>
23
  <g>clean_cache</g>  Clean system cache
24
  <g>clean_public_cache</g> Clear the cache of scripts and styles
25
26
<y>Arguments:</y>
27
  <g>prefix_path</g> If present, will clean only part of cache (<g>clean_cache</g> only)
28
29
<y>Examples:</y>
30
  Clean the whole system cache:
31
    <g>./cli clean_cache:System/optimization</g>
32
  Clean only languages cache:
33
    <g>./cli clean_cache:System/optimization prefix_path=languages</g>
34
  Clean the whole system public cache:
35
    <g>./cli clean_public_cache:System/optimization</g>
36
37
HELP;
38
	}
39
	/**
40
	 * Clean cache
41
	 *
42
	 * @param \cs\Request $Request
43
	 *
44
	 * @return string
45
	 *
46
	 * @throws \cs\ExitException
47
	 */
48
	public static function optimization_clean_cache ($Request) {
49
		Api_controller::admin_optimization_clean_cache($Request);
50
		return "<g>OK</g>cli\n";
51
	}
52
	/**
53
	 * Clean public cache (CSS/JS/HTML)
54
	 *
55
	 * @return string
56
	 *
57
	 * @throws \cs\ExitException
58
	 */
59
	public static function optimization_clean_public_cache () {
60
		Api_controller::admin_optimization_clean_public_cache();
61
		return "<g>OK</g>cli\n";
62
	}
63
}
64