File tree Expand file tree Collapse file tree 1 file changed +20
-15
lines changed
Expand file tree Collapse file tree 1 file changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -89,23 +89,28 @@ public function init()
8989 public function clearAllCaches ()
9090 {
9191 $ transcoderPaths = Transcoder::$ plugin ->getSettings ()->transcoderPaths ;
92- foreach ($ transcoderPaths as $ key => $ value ) {
93- $ dir = Craft::getAlias ($ value );
94- try {
95- FileHelper::clearDirectory ($ dir );
96- Craft::info (
97- Craft::t (
98- 'transcoder ' ,
99- '{name} cache directory cleared ' ,
100- ['name ' => $ key ]
101- ),
102- __METHOD__
103- );
104- } catch (ErrorException $ e ) {
105- // the directory doesn't exist
106- Craft::error ($ e ->getMessage (), __METHOD__ );
92+ $ clearCaches = Transcoder::$ plugin ->getSettings ()->clearCaches ;
93+
94+ if ($ clearCaches ) {
95+ foreach ($ transcoderPaths as $ key => $ value ) {
96+ $ dir = Craft::getAlias ($ value );
97+ try {
98+ FileHelper::clearDirectory ($ dir );
99+ Craft::info (
100+ Craft::t (
101+ 'transcoder ' ,
102+ '{name} cache directory cleared ' ,
103+ ['name ' => $ key ]
104+ ),
105+ __METHOD__
106+ );
107+ } catch (ErrorException $ e ) {
108+ // the directory doesn't exist
109+ Craft::error ($ e ->getMessage (), __METHOD__ );
110+ }
107111 }
108112 }
113+
109114 }
110115
111116 // Protected Methods
You can’t perform that action at this time.
0 commit comments