Improvments in demo management scripts
authorDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Tue, 23 Apr 2013 15:41:54 +0000 (21:11 +0530)
committerDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Tue, 23 Apr 2013 15:41:54 +0000 (21:11 +0530)
tools/scripts/demo/demo.conf.txt
tools/scripts/demo/load-pristine-drupal [new file with mode: 0755]
tools/scripts/demo/load-pristine-joomla
tools/scripts/demo/load-pristine-wordpress
tools/scripts/demo/save-pristine-drupal [new file with mode: 0755]
tools/scripts/demo/save-pristine-wordpress
tools/scripts/demo/update-demo-all

index 28beeff38fda69cf007718230a9b35dc7541924f..b26d00c5643aee4e200ed6a6425cb83b8a5d10fd 100644 (file)
@@ -5,12 +5,12 @@ TMP_DUMP_FILE=
 CIVI_DEMO_DIR=
 
 # Define drupal-db-name and pristine path along with file-name
-DRUPAL_DEMO_DBNAME=
-DRUPAL_DEMO_PRISTINE=
+DRUPAL_DEMO_CRM_DBNAME=
+DRUPAL_DEMO_CRM_PRISTINE=
 
 # Define wordpress-db-name and pristine path along with file-name
-WORDPRESS_DEMO_DBNAME=
-WORDPRESS_DEMO_PRISTINE=
+WORDPRESS_DEMO_CRM_DBNAME=
+WORDPRESS_DEMO_CRM_PRISTINE=
 
 # Define wordpress-db-name and pristine path along with file-name
 JOOMLA_DEMO_DBNAME=
diff --git a/tools/scripts/demo/load-pristine-drupal b/tools/scripts/demo/load-pristine-drupal
new file mode 100755 (executable)
index 0000000..41675dd
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env /bin/bash
+
+source `dirname $0`/demo.conf
+
+pushd .
+
+# load drupal demo pristines
+if [ $DRUPAL_DEMO_CRM_DBNAME ]; then
+  mysqladmin -f drop $DRUPAL_DEMO_CRM_DBNAME
+  echo "Creating civicrm-drupal-demo db.."
+  mysqladmin create $DRUPAL_DEMO_CRM_DBNAME
+  if [ -f $DRUPAL_DEMO_CRM_PRISTINE ]; then
+    echo "Reloading civicrm-drupal-demo db from pristine.."
+    mysql $DRUPAL_DEMO_CRM_DBNAME < $DRUPAL_DEMO_CRM_PRISTINE
+  fi
+fi
+
+if [ $DRUPAL_DEMO_CMS_DBNAME ]; then
+  mysqladmin -f drop $DRUPAL_DEMO_CMS_DBNAME
+  echo "Creating drupal-demo db.."
+  mysqladmin create $DRUPAL_DEMO_CMS_DBNAME
+  if [ -f $DRUPAL_DEMO_CMS_PRISTINE ]; then
+    echo "Reloading drupal-demo db from pristine.."
+    mysql $DRUPAL_DEMO_CMS_DBNAME < $DRUPAL_DEMO_CMS_PRISTINE
+  fi
+fi
+
+popd
index 6259c5ff4da3989684bb03ad3e9ee1aca830a567..ee30724ccb17f6a1646de641650287d96d8ae72d 100755 (executable)
@@ -8,6 +8,7 @@ pushd .
 if [ $JOOMLA_DEMO_DBNAME ]; then
   if [ -f $JOOMLA_DEMO_PRISTINE ]; then
     mysqladmin -f drop $JOOMLA_DEMO_DBNAME
+    echo "Creating civicrm-joomla-demo db.."
     mysqladmin create $JOOMLA_DEMO_DBNAME
     echo "Reloading civicrm-joomla-demo from pristine.."
     mysql $JOOMLA_DEMO_DBNAME < $JOOMLA_DEMO_PRISTINE
index 858d40edb3413fdfde307c25639a026ec8bba029..42d7ea2c4f55c9036db6ee8a5150ee0441be6148 100755 (executable)
@@ -4,13 +4,24 @@ source `dirname $0`/demo.conf
 
 pushd .
 
-if [ $WORDPRESS_DEMO_DBNAME ]; then
-  # wordpress pristine
-  if [ -f $WORDPRESS_DEMO_PRISTINE ]; then
-    mysqladmin -f drop $WORDPRESS_DEMO_DBNAME
+# load wordpress demo pristines
+if [ $WORDPRESS_DEMO_CRM_DBNAME ]; then
+  mysqladmin -f drop $WORDPRESS_DEMO_CRM_DBNAME
+  echo "Creating civicrm-wordpress-demo db.."
+  mysqladmin create $WORDPRESS_DEMO_CRM_DBNAME
+  if [ -f $WORDPRESS_DEMO_CRM_PRISTINE ]; then
     echo "Reloading civicrm-wordpress-demo db from pristine.."
-    mysqladmin create $WORDPRESS_DEMO_DBNAME
-    mysql $WORDPRESS_DEMO_DBNAME < $WORDPRESS_DEMO_PRISTINE
+    mysql $WORDPRESS_DEMO_CRM_DBNAME < $WORDPRESS_DEMO_CRM_PRISTINE
+  fi
+fi
+
+if [ $WORDPRESS_DEMO_CMS_DBNAME ]; then
+  mysqladmin -f drop $WORDPRESS_DEMO_CMS_DBNAME
+  echo "Creating wordpress-demo db.."
+  mysqladmin create $WORDPRESS_DEMO_CMS_DBNAME
+  if [ -f $WORDPRESS_DEMO_CMS_PRISTINE ]; then
+    echo "Reloading wordpress-demo db from pristine.."
+    mysql $WORDPRESS_DEMO_CMS_DBNAME < $WORDPRESS_DEMO_CMS_PRISTINE
   fi
 fi
 
diff --git a/tools/scripts/demo/save-pristine-drupal b/tools/scripts/demo/save-pristine-drupal
new file mode 100755 (executable)
index 0000000..784a028
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env /bin/bash
+
+source `dirname $0`/demo.conf
+
+pushd .
+
+# drupal pristine
+if [ "$1" == "cms" ] && [ $DRUPAL_DEMO_CMS_DBNAME ]; then
+  echo "Creating drupal-demo db dump.."
+  mysqldump $DRUPAL_DEMO_CMS_DBNAME > $TMP_DUMP_FILE
+  if [ -f $DRUPAL_DEMO_CMS_PRISTINE ]; then
+    echo "Creating drupal-demo db pristine from dump.."
+    cp $TMP_DUMP_FILE $DRUPAL_DEMO_CMS_PRISTINE
+  fi
+elif [ -z "$1" ] && [ $DRUPAL_DEMO_CRM_DBNAME ]; then
+  echo "Creating civicrm-drupal-demo db dump.."
+  mysqldump $DRUPAL_DEMO_CRM_DBNAME > $TMP_DUMP_FILE
+  if [ -f $DRUPAL_DEMO_CRM_PRISTINE ]; then
+    echo "Creating civicrm-drupal-demo db pristine from dump.."
+    cp $TMP_DUMP_FILE $DRUPAL_DEMO_CRM_PRISTINE
+  fi
+else
+    echo "Sorry i couldn't do anything.."
+fi
+
+popd
index 05f84aad84f855a6d353ca341283307e35be65b3..5ae8bf7efcb2f48b084963a011ccb91c48215138 100755 (executable)
@@ -4,14 +4,23 @@ source `dirname $0`/demo.conf
 
 pushd .
 
-# creating wordpress pristine
-if [ $WORDPRESS_DEMO_DBNAME ]; then
-  if [ -f $WORDPRESS_DEMO_PRISTINE ]; then
-    echo "Taking civicrm-wordpress-demo db dump.."
-    mysqldump $WORDPRESS_DEMO_DBNAME > $TMP_DUMP_FILE
-    echo "Creating civicrm-wordpress-demo pristine from dump.."
-    cp $TMP_DUMP_FILE $WORDPRESS_DEMO_PRISTINE
+# wordpress pristine
+if [ "$1" == "cms" ] && [ $WORDPRESS_DEMO_CMS_DBNAME ]; then
+  echo "Creating wordpress-demo db dump.."
+  mysqldump $WORDPRESS_DEMO_CMS_DBNAME > $TMP_DUMP_FILE
+  if [ -f $WORDPRESS_DEMO_CMS_PRISTINE ]; then
+    echo "Creating wordpress-demo db pristine from dump.."
+    cp $TMP_DUMP_FILE $WORDPRESS_DEMO_CMS_PRISTINE
   fi
+elif [ -z "$1" ] && [ $WORDPRESS_DEMO_CRM_DBNAME ]; then
+  echo "Creating civicrm-wordpress-demo db dump.."
+  mysqldump $WORDPRESS_DEMO_CRM_DBNAME > $TMP_DUMP_FILE
+  if [ -f $WORDPRESS_DEMO_CRM_PRISTINE ]; then
+    echo "Creating civicrm-wordpress-demo db pristine from dump.."
+    cp $TMP_DUMP_FILE $WORDPRESS_DEMO_CRM_PRISTINE
+  fi
+else
+    echo "Sorry i couldn't do anything.."
 fi
 
 popd
index b7c8c643c43f2f663bff5dc8f076b78f854bad0a..96d882448c0b265199ffe05d0c0ba0a6bf91f206 100755 (executable)
@@ -12,18 +12,18 @@ cd $CIVI_DEMO_DIR/bin
 echo "cd $CIVI_DEMO_DIR/sql"
 cd $CIVI_DEMO_DIR/sql
 
-if [ $DRUPAL_DEMO_DBNAME ]; then
+if [ $DRUPAL_DEMO_CRM_DBNAME ]; then
   # drupal pristine
   echo "Reloading civicrm-drupal-demo db from generated.mysql .."
-  mysqladmin -f drop $DRUPAL_DEMO_DBNAME
-  mysqladmin create $DRUPAL_DEMO_DBNAME
-  mysql $DRUPAL_DEMO_DBNAME < civicrm.mysql
-  mysql $DRUPAL_DEMO_DBNAME < civicrm_generated.mysql
+  mysqladmin -f drop $DRUPAL_DEMO_CRM_DBNAME
+  mysqladmin create $DRUPAL_DEMO_CRM_DBNAME
+  mysql $DRUPAL_DEMO_CRM_DBNAME < civicrm.mysql
+  mysql $DRUPAL_DEMO_CRM_DBNAME < civicrm_generated.mysql
   echo "Taking civicrm-drupal-demo dump.."
-  mysqldump $DRUPAL_DEMO_DBNAME > $TMP_DUMP_FILE
-  if [ -f $DRUPAL_DEMO_PRISTINE ]; then
+  mysqldump $DRUPAL_DEMO_CRM_DBNAME > $TMP_DUMP_FILE
+  if [ -f $DRUPAL_DEMO_CRM_PRISTINE ]; then
     echo "Creating civicrm-drupal-demo pristine.."
-    cp $TMP_DUMP_FILE $DRUPAL_DEMO_PRISTINE
+    cp $TMP_DUMP_FILE $DRUPAL_DEMO_CRM_PRISTINE
   fi
 fi
 
@@ -31,16 +31,16 @@ if [ ! -f $TMP_DUMP_FILE ]; then
   exit 1
 fi
 
-if [ $WORDPRESS_DEMO_DBNAME ]; then
+if [ $WORDPRESS_DEMO_CRM_DBNAME ]; then
   # wordpress pristine
-  if [ -f $WORDPRESS_DEMO_PRISTINE ]; then
+  if [ -f $WORDPRESS_DEMO_CRM_PRISTINE ]; then
     echo "Creating civicrm-wordpress-demo pristine.."
-    cp $TMP_DUMP_FILE $WORDPRESS_DEMO_PRISTINE
+    cp $TMP_DUMP_FILE $WORDPRESS_DEMO_CRM_PRISTINE
   fi
-  mysqladmin -f drop $WORDPRESS_DEMO_DBNAME
+  mysqladmin -f drop $WORDPRESS_DEMO_CRM_DBNAME
   echo "Reloading civicrm-wordpress-demo from pristine.."
-  mysqladmin create $WORDPRESS_DEMO_DBNAME
-  mysql $WORDPRESS_DEMO_DBNAME < $TMP_DUMP_FILE
+  mysqladmin create $WORDPRESS_DEMO_CRM_DBNAME
+  mysql $WORDPRESS_DEMO_CRM_DBNAME < $TMP_DUMP_FILE
 fi
 
 if [ $JOOMLA_DEMO_DBNAME ]; then