ClearCommand::fire()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
4
class ClearCommand extends SilverstripeCommand
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
5
{
6
    /**
7
     * The console command name.
8
     *
9
     * @var string
10
     */
11
    protected $name = 'clear:cache';
12
13
    /**
14
     * The console command description.
15
     *
16
     * @var string
17
     */
18
    protected $description = 'Clear the cache by deleting the files and rebuild the manifest';
19
20
    public function fire()
21
    {
22
        $this->info('Used cache location: ' . TEMP_FOLDER);
23
24
        SS_ClassLoader::instance()->getManifest()->regenerate();
25
        $this->info('regenerated manifest!');
26
27
        ClassInfo::reset_db_cache();
28
        $this->info('resetted db cache!');
29
    }
30
}
31