File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * Clears log files.
5
+ *
6
+ * @package symfony
7
+ * @subpackage task
8
+ * @author Fabien Potencier <[email protected] >
9
+ * @version SVN: $Id: sfLogClearTask.class.php 23922 2009-11-14 14:58:38Z fabien $
10
+ */
11
+ class logClearTask extends sfBaseTask
12
+ {
13
+ /**
14
+ * @see sfTask
15
+ */
16
+ protected function configure ()
17
+ {
18
+ $ this ->namespace = 'crew ' ;
19
+ $ this ->name = 'clear-log ' ;
20
+ $ this ->aliases = array ('ccl ' );
21
+ $ this ->briefDescription = 'Complete removal of log files (.gitignore file is not erased) ' ;
22
+ }
23
+
24
+ /**
25
+ * @see sfTask
26
+ */
27
+ protected function execute ($ arguments = array (), $ options = array ())
28
+ {
29
+ if (!sfConfig::get ('sf_log_dir ' ) || !is_dir (sfConfig::get ('sf_log_dir ' )))
30
+ {
31
+ throw new sfException (sprintf ('Log directory "%s" does not exist. ' , sfConfig::get ('sf_log_dir ' )));
32
+ }
33
+
34
+ try
35
+ {
36
+ $ this ->getFilesystem ()->remove (sfFinder::type ('any ' )
37
+ ->discard ('.gitignore ' )
38
+ ->in (sfConfig::get ('sf_log_dir ' ))
39
+ );
40
+ }
41
+ catch (Exception $ e )
42
+ {
43
+ return 1 ;
44
+ }
45
+
46
+ return 0 ;
47
+ }
48
+ }
Original file line number Diff line number Diff line change
1
+ *
You can’t perform that action at this time.
0 commit comments