PHP Класс VersionPress\Git\MergeDriverInstaller

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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