Merge pull request #11999 from totten/master-header
[civicrm-core.git] / bin / setup.lib.sh
index d98f2f52e27b1bcb1a9baf6719fb2720f8f16225..e385acfa709b4839f9a846f2746418da6fb6e800 100644 (file)
@@ -55,3 +55,20 @@ function has_commands() {
   done
   return 0
 }
+
+## Execute some PHP within CMS context
+## usage: cms_eval '<php-code>'
+function cms_eval() {
+  case "$GENCODE_CMS" in
+    Drupal*)
+      drush ev "$1"
+      ;;
+    WordPress*)
+      wp eval "$1"
+      ;;
+    *)
+      echo "Cannot boot (GENCODE_CMS=$GENCODE_CMS)" > /dev/stderr
+      exit 1
+      ;;
+  esac
+}