소스 검색

[AsseticBundle] added a simple cache to --watch so it picks up where it left off last time

Kris Wallsmith 14 년 전
부모
커밋
4816b9e711
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      src/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php

+ 7 - 1
src/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php

@@ -66,7 +66,12 @@ class DumpCommand extends Command
      */
     protected function watch(LazyAssetManager $am, $baseDir, OutputInterface $output, $debug = false)
     {
-        $previously = array();
+        $cache = sys_get_temp_dir().'/assetic_watch_'.substr(sha1($baseDir), 0, 7);
+        if (file_exists($cache)) {
+            $previously = unserialize(file_get_contents($cache));
+        } else {
+            $previously = array();
+        }
 
         while (true) {
             // reload formulae when in debug
@@ -80,6 +85,7 @@ class DumpCommand extends Command
                 }
             }
 
+            file_put_contents($cache, serialize($previously));
             sleep(1);
         }
     }