Passed
Push — master ( 5a7301...ba7877 )
by Nicolaas
02:31
created

MoveUnexpectedImages::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Sunnysideup\PerfectCmsImages\Tasks;
4
5
use SilverStripe\Control\Director;
6
use SilverStripe\Control\Controller;
7
use SilverStripe\Control\HTTPRequest;
8
use SilverStripe\Dev\BuildTask;
9
use SilverStripe\ORM\DB;
10
11
use SilverStripe\Assets\Image;
12
use SilverStripe\Assets\Folder;
13
14
use SilverStripe\Core\Config\Config;
15
16
use Sunnysideup\PerfectCmsImages\Api\SortOutFolders;
0 ignored issues
show
Bug introduced by
The type Sunnysideup\PerfectCmsImages\Api\SortOutFolders was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Sunnysideup\PerfectCmsImages\Api\PerfectCMSImages;
18
19
class MoveUnexpectedImages extends BuildTask
20
{
21
22
23
    public function getTitle(): string
24
    {
25
        return 'Careful: experimental - DELETE ALL IMAGES THAT ARE IN A FOLDER AND SHOULD NOT BE THERE';
26
    }
27
28
    public function getDescription(): string
29
    {
30
        return 'Goes through all the perfect cms images, checks what folder they write to and moves any images that should not be there.';
31
    }
32
33
    /**
34
     * Create test jobs for the purposes of testing.
35
     *
36
     * @param HTTPRequest $request
37
     */
38
    public function run($request) // phpcs:ignore
39
    {
40
        (new SortOutFolders())
41
            ->run(
42
                Config::inst()->get(PerfectCMSImages::class, 'unused_images_folder_name'),
43
                PerfectCMSImages::get_all_values_for_images()
44
            );
45
    }
46
47
}
48