original_string: private function purgeRecursive( $dir, $limit, &$purgeCount )
      {
          $purgedIds = array();
  
          // Deal with files in the directory
          if ( ( $files = glob( "{$dir}*{$this->properties['options']->extension}" ) ) === false )
          {
              throw new ezcBaseFileNotFoundException(
                  $dir,
                  'cache location',
                  'Produced an error while globbing for files.'
              );
          }
  
          foreach ( $files as $file )
          {
              if ( $this->calcLifetime( $file ) == 0 )
              {
                  if ( @unlink( $file ) === false )
                  {
                      throw new ezcBaseFilePermissionException(
                          $file,
                          ezcBaseFileException::WRITE,
                          'Could not unlink cache file.'
                      );
                  }
                  $fileInfo    = $this->extractIdentifier( $file );
                  $purgedIds[] = $fileInfo['id'];
                  ++$purgeCount;
              }
              // Stop purging if limit is reached
              if ( $limit !== null && $purgeCount >= $limit )
              {
                  return $purgedIds;
              }
          }
  
          // Deal with sub dirs, this function expects them to be marked with a
          // slash because of the property $location
          if ( ( $dirs = glob( "$dir*", GLOB_ONLYDIR | GLOB_MARK ) ) === false )
          {
              throw new ezcBaseFileNotFoundException(
                  $dir,
                  'cache location',
                  'Produced an error while globbing for directories.'
              );
          }
          foreach ( $dirs as $dir )
          {
              $purgedIds = array_merge(
                  $purgedIds,
                  $this->purgeRecursive( $dir, $limit, $purgeCount )
              );
              // Stop purging if limit is reached
              if ( $limit !== null && $purgeCount >= $limit )
              {
                  return $purgedIds;
              }
          }
  
          // Finished purging, return IDs.
          return $purgedIds;
      }
code: private function purgeRecursive( $dir, $limit, &$purgeCount )
      {
          $purgedIds = array();
  
          // Deal with files in the directory
          if ( ( $files = glob( "{$dir}*{$this->properties['options']->extension}" ) ) === false )
          {
              throw new ezcBaseFileNotFoundException(
                  $dir,
                  'cache location',
                  'Produced an error while globbing for files.'
              );
          }
  
          foreach ( $files as $file )
          {
              if ( $this->calcLifetime( $file ) == 0 )
              {
                  if ( @unlink( $file ) === false )
                  {
                      throw new ezcBaseFilePermissionException(
                          $file,
                          ezcBaseFileException::WRITE,
                          'Could not unlink cache file.'
                      );
                  }
                  $fileInfo    = $this->extractIdentifier( $file );
                  $purgedIds[] = $fileInfo['id'];
                  ++$purgeCount;
              }
              // Stop purging if limit is reached
              if ( $limit !== null && $purgeCount >= $limit )
              {
                  return $purgedIds;
              }
          }
  
          // Deal with sub dirs, this function expects them to be marked with a
          // slash because of the property $location
          if ( ( $dirs = glob( "$dir*", GLOB_ONLYDIR | GLOB_MARK ) ) === false )
          {
              throw new ezcBaseFileNotFoundException(
                  $dir,
                  'cache location',
                  'Produced an error while globbing for directories.'
              );
          }
          foreach ( $dirs as $dir )
          {
              $purgedIds = array_merge(
                  $purgedIds,
                  $this->purgeRecursive( $dir, $limit, $purgeCount )
              );
              // Stop purging if limit is reached
              if ( $limit !== null && $purgeCount >= $limit )
              {
                  return $purgedIds;
              }
          }
  
          // Finished purging, return IDs.
          return $purgedIds;
      }
code_tokens: private function purgeRecursive ( $ dir , $ limit , & $ purgeCount ) { $ purgedIds = array ( ) ; // Deal with files in the directory if ( ( $ files = glob ( "{$dir}*{$this->properties['options']->extension}" ) ) === false ) { throw new ezcBaseFileNotFoundException ( $ dir , 'cache location' , 'Produced an error while globbing for files.' ) ; } foreach ( $ files as $ file ) { if ( $ this -> calcLifetime ( $ file ) == 0 ) { if ( @ unlink ( $ file ) === false ) { throw new ezcBaseFilePermissionException ( $ file , ezcBaseFileException :: WRITE , 'Could not unlink cache file.' ) ; } $ fileInfo = $ this -> extractIdentifier ( $ file ) ; $ purgedIds [ ] = $ fileInfo [ 'id' ] ; ++ $ purgeCount ; } // Stop purging if limit is reached if ( $ limit !== null && $ purgeCount >= $ limit ) { return $ purgedIds ; } } // Deal with sub dirs, this function expects them to be marked with a // slash because of the property $location if ( ( $ dirs = glob ( "$dir*" , GLOB_ONLYDIR | GLOB_MARK ) ) === false ) { throw new ezcBaseFileNotFoundException ( $ dir , 'cache location' , 'Produced an error while globbing for directories.' ) ; } foreach ( $ dirs as $ dir ) { $ purgedIds = array_merge ( $ purgedIds , $ this -> purgeRecursive ( $ dir , $ limit , $ purgeCount ) ) ; // Stop purging if limit is reached if ( $ limit !== null && $ purgeCount >= $ limit ) { return $ purgedIds ; } } // Finished purging, return IDs. return $ purgedIds ; }
docstring: Recursively purge cache items.
  
  Recursively purges $dir until $limit is reached. $purgeCount is the
  number of already purged items.
  
  @param string $dir
  @param int $limit
  @param int $purgeCount
docstring_tokens: Recursively purge cache items .