clean() static public method

Flushes a directory
static public clean ( string $dir ) : boolean
$dir string The path of the directory
return boolean True: the directory has been flushed, false: flushing failed
Example #1
0
 static function flush()
 {
     $root = c::get('root.cache');
     if (!is_dir($root)) {
         return $root;
     }
     dir::clean($root);
 }
Example #2
0
 public function testClean()
 {
     dir::make($this->tmpDir);
     f::write($this->tmpDir . DS . 'testfile.txt', '');
     $this->assertTrue(dir::clean($this->tmpDir));
     $files = dir::read($this->tmpDir);
     $this->assertEquals(0, count($files));
     dir::remove($this->tmpDir);
 }
Example #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($this->isInstalled() === false) {
         throw new RuntimeException('Invalid Kirby installation');
     }
     // get the thumbs folder and bootstrap kirby
     $thumbs = $this->kirby()->roots()->thumbs();
     // flush the thumbs folder
     dir::clean($thumbs);
     $output->writeln('<comment>The thumbs folder has been emptied</comment>');
     $output->writeln('');
 }
Example #4
0
 protected function removeAccounts()
 {
     dir::clean($this->roots->dummy . DS . 'site' . DS . 'accounts');
 }
Example #5
0
 static function killCache()
 {
     if (c::get('cache.autoupdate')) {
         return false;
     }
     if (!is_dir(c::get('root.cache'))) {
         return false;
     }
     return dir::clean(c::get('root.cache'));
 }
Example #6
0
 static function killCache()
 {
     return dir::clean(c::get('root.cache'));
 }
Example #7
0
 /**
  * Flush the entire cache directory
  *
  * @return boolean
  */
 public function flush()
 {
     return dir::clean($this->options['root']);
 }