From c1a9ca9c46a4471475e166251b4c3d3b64ee03df Mon Sep 17 00:00:00 2001
From: Mark Dorison <mdorison@gmail.com>
Date: Tue, 22 Mar 2011 12:52:06 -0400
Subject: [PATCH] Issue #1101666 by markdorison: Added basic drush integration to bulk generate missing UUIDs.

---
 uuid.drush.inc |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)
 create mode 100644 uuid.drush.inc

diff --git a/uuid.drush.inc b/uuid.drush.inc
new file mode 100644
index 0000000..983d24c
--- /dev/null
+++ b/uuid.drush.inc
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * @file
+ * Drush implementation for the uuid module.
+ */
+
+/**
+ * Implementation of hook_drush_command().
+ */
+function uuid_drush_command() {
+  $items = array();
+  $items['uuid-create-missing'] = array(
+    'description' => 'Create missing UUIDs for node types specified for automatic generation',
+    'arguments' => array(),
+    'aliases' => array('uuid-create'),
+  );
+  return $items;
+}
+
+/**
+ * Implementation of hook_drush_help().
+ *
+ */
+function uuid_drush_help($section) {
+  switch ($section) {
+    case 'drush:uuid-create-missing':
+      return dt("This command will create missing UUIDs for those content types specified in the module settings for automatic generation.");
+  }
+}
+
+/**
+ * drush command callback
+ *
+ */
+function drush_uuid_create_missing() {
+  if (!drush_confirm(dt('Are you sure?'))) {
+    return drush_user_abort();
+  }
+  module_load_include('inc', 'uuid', 'uuid.admin');
+  drush_log(dt('Beginning bulk creation of UUIDs.'), 'ok');
+  uuid_sync();
+}
-- 
1.7.3.4

