PHP 클래스 VersionPress\Git\MergeDriverInstaller

파일 보기 프로젝트 열기: versionpress/versionpress 1 사용 예제들

공개 메소드들

메소드 설명
installMergeDriver ( string $rootDir, string $pluginDir, string $vpdbDir, string $driver = self::DRIVER_AUTO ) Installs a merge driver.
uninstallMergeDriver ( string $rootDir, string $pluginDir, string $vpdbDir ) Uninstalls a merge driver - removes 'vp-ini' sections from both .gitattributes and .git/config.

비공개 메소드들

메소드 설명
installGitConfig ( string $rootDir, string $pluginDir, string $driver ) Installs 'vp-ini' merge driver section into .git/config
installGitattributes ( string $rootDir, string $pluginDir, string $vpdbDir ) Installs .gitattributes - creates the file if it doesn't exist or inserts a section if the section didn't exist already.

메소드 상세

installMergeDriver() 공개 정적인 메소드

Merge driver consists of three things: 1. .gitattributes definition that tells which files to process with which driver 2. Section in git/config that maps the logical merge driver name to a concrete script on a disk 3. The actual script files(s) - PHP or Bash impl in our case It's a bit tricky because: - .gitattributes is committed in the repo. The paths must therefore be relative. - git/config is not committed in the repo so it must be created dynamically on actions like activating VersionPress or restoring / cloning a site. Furthermore, the paths must be absolute because Git's cwd can be different. - We need cross-platform scripts so we detect the OS and install the correct driver. The driver impl can be forced using the $driver parameter.
public static installMergeDriver ( string $rootDir, string $pluginDir, string $vpdbDir, string $driver = self::DRIVER_AUTO )
$rootDir string Where to install the driver
$pluginDir string Path to VersionPress (plugin) - used to look up templates and merge drivers
$vpdbDir string Location of the VPDB dir (where the INI files are)
$driver string DRIVER_BASH | DRIVER_PHP | DRIVER_AUTO (default; will use PHP driver for Windows, Bash otherwise)

uninstallMergeDriver() 공개 정적인 메소드

Uninstalls a merge driver - removes 'vp-ini' sections from both .gitattributes and .git/config.
public static uninstallMergeDriver ( string $rootDir, string $pluginDir, string $vpdbDir )
$rootDir string
$pluginDir string
$vpdbDir string