Skip to content

Instantly share code, notes, and snippets.

@mikeyp mikeyp/cron-queue.php

Last active Apr 21, 2018
What would you like to do?
$queue = DrupalQueue::get('versioncontrol_reposync');
while ($item = $queue->claimItem()) {
try {
catch (Exception $e) {
watchdog_exception('cron', $e);

Clone a bare repo on disk:

git clone git:// drupal.git --bare

Update the Drupal project to point to your repo on disk

UPDATE versioncontrol_repositories set root = '/home/mikey_p/drupal.git' WHERE repo_id = 2;

Simulate a code push. Should use format: old-sha1 new-sha1 refs/heads/8.0.x

echo "8fcce5b381c8590238c2a0c73798d99b47e55392 ccfaa23e0a25ca8b6ba61f1b5ae076043dcc42fe refs/heads/8.0.x" | drush vc-nq --uid=1 --repo-id=2 --timestamp=1428000005

Check to see that it was queued in the versioncontrol_reposync queue:

select * from queue where name = 'versioncontrol_reposync';

Process the queue with a custom PHP script (see attached script) or cron:

drush -v php-script cron-queue.php

This will trigger hook_versioncontrol_code_arrival().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.