protected function cleanup($fileToRotate)
    {

        // load the maximum number of files to keep
        $maxFiles = $this->getMaxFiles();

        // skip GC of old logs if files are unlimited
        if (0 === $maxFiles) {
            return;
        }

        // load the rotated log files
        $logFiles = glob($this->getGlobPattern($fileToRotate, 'gz'));

        // query whether we've the maximum number of files reached
        if ($maxFiles >= count($logFiles)) {
            return;
        }

        // iterate over the files we want to clean-up
        foreach (array_slice($logFiles, $maxFiles) as $fileToDelete) {
            unlink($fileToDelete);
        }
    }
protected function cleanup($fileToRotate)
    {

        // load the maximum number of files to keep
        $maxFiles = $this->getMaxFiles();

        // skip GC of old logs if files are unlimited
        if (0 === $maxFiles) {
            return;
        }

        // load the rotated log files
        $logFiles = glob($this->getGlobPattern($fileToRotate, 'gz'));

        // query whether we've the maximum number of files reached
        if ($maxFiles >= count($logFiles)) {
            return;
        }

        // iterate over the files we want to clean-up
        foreach (array_slice($logFiles, $maxFiles) as $fileToDelete) {
            unlink($fileToDelete);
        }
    }
protected function cleanup ( $ fileToRotate ) { // load the maximum number of files to keep $ maxFiles = $ this -> getMaxFiles ( ) ; // skip GC of old logs if files are unlimited if ( 0 === $ maxFiles ) { return ; } // load the rotated log files $ logFiles = glob ( $ this -> getGlobPattern ( $ fileToRotate , 'gz' ) ) ; // query whether we've the maximum number of files reached if ( $ maxFiles >= count ( $ logFiles ) ) { return ; } // iterate over the files we want to clean-up foreach ( array_slice ( $ logFiles , $ maxFiles ) as $ fileToDelete ) { unlink ( $ fileToDelete ) ; } }
Will cleanup log files based on the value set for their maximal number

@param string $fileToRotate The file to be rotated

@return void
Will cleanup log files based on the value set for their maximal number