public getChangedFiles ( ) : array | ||
Résultat | array | Array of things like `array("status" => "M", "path" => "wp-content/vpdb/something.ini" )` |
/** * @param Commit $commit * @param bool $skipVpdbFiles * @return array */ private function getFileChanges(Commit $commit, $skipVpdbFiles) { $changedFiles = $commit->getChangedFiles(); if ($skipVpdbFiles) { $changedFiles = array_filter($changedFiles, function ($changedFile) { $path = str_replace('\\', '/', realpath(VP_PROJECT_ROOT) . '/' . $changedFile['path']); $vpdbPath = str_replace('\\', '/', realpath(VP_VPDB_DIR)); return !Strings::startsWith($path, $vpdbPath); }); } $fileChanges = array_map(function ($changedFile) { $status = $changedFile['status']; $filename = $changedFile['path']; return ['type' => 'file', 'action' => $status === 'A' ? 'add' : ($status === 'M' ? 'modify' : 'delete'), 'name' => $filename]; }, $changedFiles); return $fileChanges; }
/** * @param Commit $commit * @return array */ private function getFileChanges(Commit $commit) { $changedFiles = $commit->getChangedFiles(); $changedFiles = array_filter($changedFiles, function ($changedFile) { $path = str_replace('\\', '/', ABSPATH . $changedFile['path']); $vpdbPath = str_replace('\\', '/', VERSIONPRESS_MIRRORING_DIR); return !Strings::startsWith($path, $vpdbPath); }); $fileChanges = array_map(function ($changedFile) { $status = $changedFile['status']; $filename = $changedFile['path']; return array('type' => 'file', 'action' => $status === 'A' ? 'add' : ($status === 'M' ? 'modify' : 'delete'), 'name' => $filename); }, $changedFiles); return $fileChanges; }