public function restoreAllDefinitionFilesFromHistory() { FileSystem::removeContent($this->directory); $definitionFilesWildcard = WP_PLUGIN_DIR . '/*/.versionpress/actions.yml'; $modifications = $this->gitRepository->getFileModifications($definitionFilesWildcard); $modifications = array_filter($modifications, function ($modification) { return $modification['status'] !== 'D'; }); $lastModifications = ArrayUtils::unique($modifications, function ($modification) { return $modification['path']; }); foreach ($lastModifications as $modification) { $fileContent = $this->gitRepository->getFileInRevision($modification['path'], $modification['commit']); $plugin = basename(dirname(dirname($modification['path']))); $targetFile = $this->getDefinitionFileName($plugin); file_put_contents($targetFile, $fileContent); } $this->saveDefinitionForPlugin('versionpress/versionpress.php'); }