@@ -140,16 +140,34 @@ protected function execute(InputInterface $input, OutputInterface $output)
140
140
}
141
141
}
142
142
143
- $ containerDir = $ fs ->exists ($ warmupDir .'/ ' .$ containerDir ) ? false : $ containerDir ;
143
+ if (!$ fs ->exists ($ warmupDir .'/ ' .$ containerDir )) {
144
+ $ fs ->rename ($ realCacheDir .'/ ' .$ containerDir , $ warmupDir .'/ ' .$ containerDir );
145
+ touch ($ warmupDir .'/ ' .$ containerDir .'.legacy ' );
146
+ }
144
147
145
- $ fs ->rename ($ realCacheDir , $ oldCacheDir );
146
- $ fs ->rename ($ warmupDir , $ realCacheDir );
148
+ if ('/ ' === \DIRECTORY_SEPARATOR && $ mounts = @file ('/proc/mounts ' )) {
149
+ foreach ($ mounts as $ mount ) {
150
+ $ mount = array_slice (explode (' ' , $ mount ), 1 , -3 );
151
+ if (!\in_array (array_pop ($ mount ), array ('vboxfs ' , 'nfs ' ))) {
152
+ continue ;
153
+ }
154
+ $ mount = implode (' ' , $ mount ).'/ ' ;
147
155
148
- if ($ containerDir ) {
149
- $ fs ->rename ($ oldCacheDir .'/ ' .$ containerDir , $ realCacheDir .'/ ' .$ containerDir );
150
- touch ($ realCacheDir .'/ ' .$ containerDir .'.legacy ' );
156
+ if (0 === strpos ($ realCacheDir , $ mount )) {
157
+ $ io ->note ("For better performances, you should move the cache/ and log/ directories to a non-shared folder of your vm. " );
158
+ $ oldCacheDir = false ;
159
+ break ;
160
+ }
161
+ }
151
162
}
152
163
164
+ if ($ oldCacheDir ) {
165
+ $ fs ->rename ($ realCacheDir , $ oldCacheDir );
166
+ } else {
167
+ $ fs ->remove ($ realCacheDir );
168
+ }
169
+ $ fs ->rename ($ warmupDir , $ realCacheDir );
170
+
153
171
if ($ output ->isVerbose ()) {
154
172
$ io ->comment ('Removing old cache directory... ' );
155
173
}
0 commit comments