Skip to content

Commit

Permalink
fixing race condition where we try to remove directories that might n…
Browse files Browse the repository at this point in the history
…ot be empty. fixes Open-Web-Analytics#301.
  • Loading branch information
padams committed Mar 17, 2011
1 parent adcf0df commit a56b3fd
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions modules/base/classes/fileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,16 @@ function flush() {

$sld = $this->readDir($dir);
$this->debug("Reading cache file list from: ". $dir);
if (array_key_exists('files', $sld)) {
$this->deleteFiles($sld['files']);

if ( array_key_exists( 'files', $sld ) ) {
$this->deleteFiles( $sld['files'] );
}
foreach ($sld['dirs'] as $sk => $sdir) {
$ssld = $this->readDir($sdir);
$this->debug("Reading cache file list from: ". $sdir);
$this->deleteFiles($ssld['files']);

rmdir($sdir);

foreach ( $sld['dirs'] as $sk => $sdir ) {
$ssld = $this->readDir( $sdir );
$this->debug( "Reading cache file list from: ". $sdir );
$this->deleteFiles( $ssld['files'] );
}

rmdir($dir);
}
}

Expand Down

0 comments on commit a56b3fd

Please sign in to comment.