private function __construct() { // suffix $this->suffix = Kohana::config('webgrind.preprocessedSuffix'); // Get list of files matching the defined format $files = $this->getFiles(webgrind::xdebugOutputFormat(), webgrind::xdebugOutputDir()); // Get list of preprocessed files $prepFiles = $this->getPrepFiles('/\\' . $this->suffix . '$/', webgrind::storageDir()); // Loop over the preprocessed files. foreach ($prepFiles as $fileName => $prepFile) { $fileName = str_replace($this->suffix, '', $fileName); // If it is older than its corrosponding original: delete it. // If it's original does not exist: delete it if (!isset($files[$fileName]) || $files[$fileName]['mtime'] > $prepFile['mtime']) { unlink($prepFile['absoluteFilename']); } else { $files[$fileName]['preprocessed'] = true; } } // Sort by mtime uasort($files, array($this, 'mtimeCmp')); $this->files = $files; }