\GitAssetCommitter
Synopsis
class GitAssetCommitter
extends AssetCommitter
implements
AssetCommitterInterface
{
- // members
- private static string $repository_path = 'assets';
- private static boolean $push_to_after_committing = false;
- private static boolean $automatically_define_author = true;
- private static string $supplement_empty_author_email = 'cms.user@localhost';
- private static string $supplement_empty_author_name = 'CMS User';
- private static boolean $commit_file_creations = true;
- private static boolean $commit_file_replacements = true;
- private static boolean $commit_file_deletions = true;
- private static boolean $commit_file_renamings = true;
- private ExtendedGitRepository $repository;
- // methods
- public void CommitFileCreation()
- public void CommitFileReplacement()
- public void CommitFileDeletion()
- public void CommitFileRenaming()
- private ExtendedGitRepository|mixed repository()
- private string repository_path()
- private void commit()
- public void PushToRemoteRepository()
- public void isPushingEnabled()
- private void getCommitAuthor()
- private static void automatically_define_author()
- private void reset_git_stage()
- // Inherited methods from AssetCommitter
- protected void newCommitCreated()
- public bool hasCreatedNewCommits()
- protected void getAbsoluteFilename()
Hierarchy
Members
private
- $commit_file_creations
- $commit_file_deletions
- $commit_file_renamings
- $commit_file_replacements
-
$push_to_after_committing
If you want all commits to be pushed automatically to a remote repository, set this to for example "origin master" (remote name + branch name separated by a single space). Note that pushing is done immediately after each commit, which may execute multiple pushes in a short time if for example a folder containing many files is renamed/moved. - $repository — ExtendedGitRepository
- $repository_path
Methods
private
- commit()
- getCommitAuthor() — Return's the name and email address of the currently logged in user. If nobody is logged in in the CMS, return null. This is usually the best bet for the author: if we would use the owner of the file, it would probably work when uploading files, but could be incorrect when renaming or deleting files.
- repository()
- repository_path()
- reset_git_stage() — Makes sure that there's nothing staged. This is called before starting to add files to staging to make sure that we won't accidentally commit some odd changes not related to what we are doing.
public
- CommitFileCreation()
- CommitFileDeletion()
- CommitFileRenaming()
- CommitFileReplacement()
- PushToRemoteRepository() — {@inheritDoc}
- isPushingEnabled()
Inherited from AssetCommitter
protected
- getAbsoluteFilename()
- newCommitCreated() — AssetCommitters should call this method every time they have successfully created a commit. The exact counter value is not actually needed, but it's used to determine if there are commits that should be pushed to a remote server at the end of the application's execution flow. (Of course pushing will not be done if no pushing is configured in the application's YAML config files. See AssetCommitterInterface::isPushingEnabled() for more details).
public
- hasCreatedNewCommits() — Indicates whether there are any new commits created by the AssetCommitter subclass that can be pushed to a remote repository.