This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | * This file is part of EC-CUBE |
||
4 | * |
||
5 | * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. |
||
6 | * |
||
7 | * http://www.ec-cube.co.jp/ |
||
8 | * |
||
9 | * This program is free software; you can redistribute it and/or |
||
10 | * modify it under the terms of the GNU General Public License |
||
11 | * as published by the Free Software Foundation; either version 2 |
||
12 | * of the License, or (at your option) any later version. |
||
13 | * |
||
14 | * This program is distributed in the hope that it will be useful, |
||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
17 | * GNU General Public License for more details. |
||
18 | * |
||
19 | * You should have received a copy of the GNU General Public License |
||
20 | * along with this program; if not, write to the Free Software |
||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||
22 | */ |
||
23 | |||
24 | namespace Eccube\Util; |
||
25 | |||
26 | use Symfony\Component\Filesystem\Filesystem; |
||
27 | use Symfony\Component\Finder\Finder; |
||
28 | use Eccube\Application; |
||
29 | |||
30 | /** |
||
31 | * キャッシュ関連のユーティリティクラス. |
||
32 | */ |
||
33 | class Cache |
||
34 | { |
||
35 | |||
36 | /** |
||
37 | * キャッシュを削除する. |
||
38 | * |
||
39 | * doctrine, profiler, twig によって生成されたキャッシュディレクトリを削除する. |
||
40 | * キャッシュは $app['config']['root_dir'].'/app/cache' に生成されます. |
||
41 | * |
||
42 | * @param Application $app |
||
43 | * @param boolean $isAll .gitkeep を残してすべてのファイル・ディレクトリを削除する場合 true, 各ディレクトリのみを削除する場合 false |
||
44 | * @param boolean $isTwig Twigキャッシュファイルのみ削除する場合 true |
||
45 | * @return boolean 削除に成功した場合 true |
||
46 | */ |
||
47 | public static function clear($app, $isAll, $isTwig = false) |
||
48 | { |
||
49 | $cacheDir = $app['config']['root_dir'].'/app/cache'; |
||
50 | |||
51 | $filesystem = new Filesystem(); |
||
52 | if ($isAll) { |
||
53 | $finder = Finder::create()->in($cacheDir)->notName('.gitkeep'); |
||
54 | $filesystem->remove($finder); |
||
0 ignored issues
–
show
|
|||
55 | View Code Duplication | } elseif ($isTwig) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
56 | if (is_dir($cacheDir.'/twig')) { |
||
57 | $finder = Finder::create()->in($cacheDir.'/twig'); |
||
58 | $filesystem->remove($finder); |
||
0 ignored issues
–
show
$finder is of type object<Symfony\Component\Finder\Finder> , but the function expects a string|object<Symfony\Co...nt\Filesystem\iterable> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
59 | } |
||
60 | } else { |
||
61 | View Code Duplication | if (is_dir($cacheDir.'/doctrine')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
62 | $finder = Finder::create()->in($cacheDir.'/doctrine'); |
||
63 | $filesystem->remove($finder); |
||
0 ignored issues
–
show
$finder is of type object<Symfony\Component\Finder\Finder> , but the function expects a string|object<Symfony\Co...nt\Filesystem\iterable> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
64 | } |
||
65 | View Code Duplication | if (is_dir($cacheDir.'/profiler')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
66 | $finder = Finder::create()->in($cacheDir.'/profiler'); |
||
67 | $filesystem->remove($finder); |
||
0 ignored issues
–
show
$finder is of type object<Symfony\Component\Finder\Finder> , but the function expects a string|object<Symfony\Co...nt\Filesystem\iterable> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
68 | } |
||
69 | View Code Duplication | if (is_dir($cacheDir.'/twig')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
70 | $finder = Finder::create()->in($cacheDir.'/twig'); |
||
71 | $filesystem->remove($finder); |
||
0 ignored issues
–
show
$finder is of type object<Symfony\Component\Finder\Finder> , but the function expects a string|object<Symfony\Co...nt\Filesystem\iterable> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
72 | } |
||
73 | View Code Duplication | if (is_dir($cacheDir.'/translator')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
74 | $finder = Finder::create()->in($cacheDir.'/translator'); |
||
75 | $filesystem->remove($finder); |
||
0 ignored issues
–
show
$finder is of type object<Symfony\Component\Finder\Finder> , but the function expects a string|object<Symfony\Co...nt\Filesystem\iterable> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
76 | } |
||
77 | } |
||
78 | |||
79 | if (function_exists('opcache_reset')) { |
||
80 | opcache_reset(); |
||
81 | } |
||
82 | |||
83 | if (function_exists('apc_clear_cache')) { |
||
84 | apc_clear_cache('user'); |
||
85 | apc_clear_cache(); |
||
86 | } |
||
87 | |||
88 | if (function_exists('wincache_ucache_clear')) { |
||
89 | wincache_ucache_clear(); |
||
90 | } |
||
91 | |||
92 | return true; |
||
93 | } |
||
94 | } |
||
95 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: