diff --git a/app/config/d8prj-clean/download.sh b/app/config/d8prj-clean/download.sh new file mode 100644 index 00000000..5f9f1d6c --- /dev/null +++ b/app/config/d8prj-clean/download.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +## download.sh -- Download Drupal and CiviCRM + +############################################################################### + +#[ -z "$CMS_VERSION" ] && CMS_VERSION=8.7.x +[ -z "$CMS_VERSION" ] && CMS_VERSION=8.x-dev + +composer create-project drupal-composer/drupal-project:"$CMS_VERSION" "$WEB_ROOT" --no-interaction + +pushd "$WEB_ROOT" >> /dev/null + composer require drupal/{devel,libraries,userprotect} + composer require civicrm/civicrm-asset-plugin:'~1.0.0' civicrm/civicrm-setup:'dev-master as 0.2.99' civicrm/civicrm-{core,packages,drupal-8}:$(civicrm_composer_ver "$CIVI_VERSION") pear/pear_exception:'1.0.1 as 1.0.0' --prefer-source + + ## FIXME: All of the following should be removed/replaced as things get cleaner. + composer require "cache/integration-tests:dev-master#b97328797ab199f0ac933e39842a86ab732f21f9" ## Issue: it's a require-dev in civicrm-core for E2E/Cache/*; how do we pull in civi require-dev without all other require-dev? + case "$CIVI_VERSION" in + 5.21*) git scan -N am https://github.com/civicrm/civicrm-core/pull/16328 ; ;; ## Issue: Patches needed in 5.21 + 5.22*) git scan -N am https://github.com/civicrm/civicrm-core/pull/16413 ; ;; ## Issue: Patches needed in 5.22 have one trivial difference + master) git scan -N am https://github.com/civicrm/civicrm-core/pull/{16403,16405,16406,16407,16408,16409} ; ;; ## Issue: This list may be volatile as PRs are getting reviewed. + *) cvutil_fatal "This build type is temporarily limited to branch which have a corresponding patchset." ; ;; + esac + extract-url --cache-ttl 172800 vendor/civicrm/civicrm-core/l10n=http://download.civicrm.org/civicrm-l10n-core/archives/civicrm-l10n-daily.tar.gz ## Issue: Don't write directly into vendor tree +popd >> /dev/null diff --git a/app/config/d8prj-clean/install.sh b/app/config/d8prj-clean/install.sh new file mode 100644 index 00000000..a6a53494 --- /dev/null +++ b/app/config/d8prj-clean/install.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +## Transition: Old builds don't have "web/" folder. New builds do. +## TODO: Simplify sometime after Dec 2019 +## install.sh -- Create config files and databases; fill the databases +[ -d "$WEB_ROOT/web" ] && CMS_ROOT="$WEB_ROOT/web" + +############################################################################### +## Create virtual-host and databases + +amp_install + +############################################################################### +## Setup Drupal (config files, database tables) + +drupal8_install +DRUPAL_SITE_DIR=$(_drupal_multisite_dir "$CMS_URL" "$SITE_ID") +pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null + drush8 -y updatedb + drush8 -y en libraries +popd >> /dev/null + +############################################################################### +## Setup CiviCRM (config files, database tables) + +CIVI_DOMAIN_NAME="Demonstrators Anonymous" +CIVI_DOMAIN_EMAIL="\"Demonstrators Anonymous\" " +CIVI_CORE="${WEB_ROOT}/vendor/civicrm/civicrm-core" +CIVI_UF="Drupal8" +GENCODE_CONFIG_TEMPLATE="${CMS_ROOT}/modules/contrib/civicrm/civicrm.config.php.drupal" + +pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null + civicrm_install_cv +popd >> /dev/null + +############################################################################### +## Extra configuration +pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null + + ## make sure drush functions are loaded + drush8 cc drush -y + + ## Setup CiviCRM -- But not in 'clean' config! + #echo '{"enable_components":["CiviEvent","CiviContribute","CiviMember","CiviMail","CiviReport","CiviPledge","CiviCase","CiviCampaign"]}' \ + # | drush8 cvapi setting.create --in=json + #civicrm_apply_demo_defaults + #cv ev 'return CRM_Utils_System::synchronizeUsers();' + + ## Setup demo user + civicrm_apply_d8_perm_defaults + drush8 -y user-create --password="$DEMO_PASS" --mail="$DEMO_EMAIL" "$DEMO_USER" + drush8 -y user-add-role demoadmin "$DEMO_USER" + + ## Setup userprotect + drush8 -y en userprotect + drush8 -y rmp authenticated userprotect.account.edit + drush8 -y rmp authenticated userprotect.mail.edit + drush8 -y rmp authenticated userprotect.pass.edit + +popd >> /dev/null + diff --git a/app/config/d8prj-clean/uninstall.sh b/app/config/d8prj-clean/uninstall.sh new file mode 100644 index 00000000..ca7f37e4 --- /dev/null +++ b/app/config/d8prj-clean/uninstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +## uninstall.sh -- Delete config files and databases + +############################################################################### + +if [ -f "$CIVI_SETTINGS" ]; then + chmod u+w $(dirname "$CIVI_SETTINGS") + rm -f "$CIVI_SETTINGS" +fi + +drupal_uninstall +amp_uninstall diff --git a/app/config/d8prj-re/download.sh b/app/config/d8prj-re/download.sh new file mode 100644 index 00000000..69566013 --- /dev/null +++ b/app/config/d8prj-re/download.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +## download.sh -- Download Drupal and CiviCRM + +############################################################################### + +#[ -z "$CMS_VERSION" ] && CMS_VERSION=8.7.x +[ -z "$CMS_VERSION" ] && CMS_VERSION=8.x-dev +[ -z "$CIVI_VERSION" ] && cvutil_fatal "Must specify a CiviCRM version (--civi-ver X.Y)" +[ "$CIVI_VERSION" == "master" ] && cvutil_fatal "Must specify a CiviCRM version (--civi-ver X.Y)" + +composer create-project drupal-composer/drupal-project:"$CMS_VERSION" "$WEB_ROOT" --no-interaction + +pushd "$WEB_ROOT" >> /dev/null + composer require drupal/{devel,libraries} + + ## NOTE: No support for CIVI_VERSION + ## NOTE: pear/log has a silly requirement for exactly 1.0.0 + composer require roundearth/civicrm-composer-plugin civicrm/civicrm-setup:'dev-master as 0.2.1' civicrm/civicrm-{core,drupal-8}:~${CIVI_VERSION}.0 pear/pear_exception:'1.0.1 as 1.0.0' + #composer require roundearth/civicrm-composer-plugin civicrm/civicrm-setup:'dev-master as 0.2.1' civicrm/civicrm-core:5.14.2 civicrm/civicrm-drupal-8:5.14.2 + #composer require roundearth/civicrm-composer-plugin civicrm/civicrm-setup:'dev-master as 0.2.1' civicrm/civicrm-drupal-8 + #composer require roundearth/civicrm-composer-plugin civicrm/civicrm-setup:dev-master civicrm/civicrm-drupal-8 +popd >> /dev/null diff --git a/app/config/d8prj-re/install.sh b/app/config/d8prj-re/install.sh new file mode 100644 index 00000000..cfad1276 --- /dev/null +++ b/app/config/d8prj-re/install.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +## Transition: Old builds don't have "web/" folder. New builds do. +## TODO: Simplify sometime after Dec 2019 +## install.sh -- Create config files and databases; fill the databases +[ -d "$WEB_ROOT/web" ] && CMS_ROOT="$WEB_ROOT/web" + +############################################################################### +## Create virtual-host and databases + +amp_install + +############################################################################### +## Setup Drupal (config files, database tables) + +drupal8_install +DRUPAL_SITE_DIR=$(_drupal_multisite_dir "$CMS_URL" "$SITE_ID") +pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null +# drush8 -y updatedb +# drush8 -y en libraries + + cv core:install -f --cms-base-url="$CMS_URL" \ + -m "settings.userFrameworkResourceURL=[cms.root]/libraries/civicrm" \ + -m "siteKey=$CIVI_SITE_KEY" + # -m "db=$CIVI_DB_DSN" ## For two DBs + drush8 -y en civicrm + + ## Setup demo user + civicrm_apply_d8_perm_defaults + drush8 -y user-create --password="$DEMO_PASS" --mail="$DEMO_EMAIL" "$DEMO_USER" + drush8 -y user:role:add demoadmin "$DEMO_USER" +popd >> /dev/null diff --git a/app/config/d8prj-re/uninstall.sh b/app/config/d8prj-re/uninstall.sh new file mode 100644 index 00000000..ca7f37e4 --- /dev/null +++ b/app/config/d8prj-re/uninstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +## uninstall.sh -- Delete config files and databases + +############################################################################### + +if [ -f "$CIVI_SETTINGS" ]; then + chmod u+w $(dirname "$CIVI_SETTINGS") + rm -f "$CIVI_SETTINGS" +fi + +drupal_uninstall +amp_uninstall diff --git a/app/config/drupal8-clean/download.sh b/app/config/drupal8-clean/download.sh index fb475a74..83966010 100644 --- a/app/config/drupal8-clean/download.sh +++ b/app/config/drupal8-clean/download.sh @@ -4,14 +4,24 @@ ############################################################################### -[ -z "$CMS_VERSION" ] && CMS_VERSION=8.x +#[ -z "$CMS_VERSION" ] && CMS_VERSION=8.7.x +[ -z "$CMS_VERSION" ] && CMS_VERSION=8 -MAKEFILE="${TMPDIR}/${SITE_TYPE}/${SITE_NAME}/${SITE_ID}.make" -cvutil_makeparent "$MAKEFILE" -cat "$SITE_CONFIG_DIR/drush.make.tmpl" \ - | sed "s;%%CACHE_DIR%%;${CACHE_DIR};" \ - | sed "s;%%CIVI_VERSION%%;${CIVI_VERSION};" \ - | sed "s;%%CMS_VERSION%%;${CMS_VERSION};" \ - > "$MAKEFILE" +mkdir "$WEB_ROOT" +drush8 -y dl drupal-${CMS_VERSION} --destination="$WEB_ROOT" --drupal-project-rename +mv "$WEB_ROOT/drupal" "$WEB_ROOT/web" -drush8 -y make --working-copy "$MAKEFILE" "$WEB_ROOT" +pushd "$WEB_ROOT/web" >> /dev/null + drush8 dl -y devel-1 libraries userprotect + composer require civicrm/civicrm-asset-plugin:'~1.0.0' civicrm/civicrm-setup:'dev-master as 0.2.99' civicrm/civicrm-{core,packages,drupal-8}:$(civicrm_composer_ver "$CIVI_VERSION") --prefer-source + + ## FIXME: All of the following should be removed/replaced as things get cleaner. + composer require "cache/integration-tests:dev-master#b97328797ab199f0ac933e39842a86ab732f21f9" ## Issue: it's a require-dev in civicrm-core for E2E/Cache/*; how do we pull in civi require-dev without all other require-dev? + case "$CIVI_VERSION" in + 5.21*) git scan -N am https://github.com/civicrm/civicrm-core/pull/16328 ; ;; ## Issue: Patches needed in 5.21 + 5.22*) git scan -N am https://github.com/civicrm/civicrm-core/pull/16413 ; ;; ## Issue: Patches needed in 5.22 have one trivial difference + master) git scan -N am https://github.com/civicrm/civicrm-core/pull/{16403,16405,16406,16407,16408,16409} ; ;; ## Issue: This list may be volatile as PRs are getting reviewed. + *) cvutil_fatal "This build type is temporarily limited to branch which have a corresponding patchset." ; ;; + esac + extract-url --cache-ttl 172800 vendor/civicrm/civicrm-core/l10n=http://download.civicrm.org/civicrm-l10n-core/archives/civicrm-l10n-daily.tar.gz ## Issue: Don't write directly into vendor tree +popd >> /dev/null diff --git a/app/config/drupal8-clean/drush.make.tmpl b/app/config/drupal8-clean/drush.make.tmpl deleted file mode 100644 index 4eee8e32..00000000 --- a/app/config/drupal8-clean/drush.make.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -; A drush makefile for CiviCRM. -; Call using: -; drush make --working-copy civicrm.make - -; drush make API version -api = 2 - -; Drupal core -core = %%CMS_VERSION%% - -; **************************************** -; Drupal core -; **************************************** - -projects[] = drupal -projects[] = libraries - -; **************************************** -; CiviCRM core -; **************************************** - -; IMPORTANT: replace "github.com/civicrm" by your own fork of CiviCRM. -; This will make it easier to submit pull-requests for patches. -; see: http://wiki.civicrm.org/confluence/display/CRMDOC/Github+for+CiviCRM - -libraries[civicrmdrupal][destination] = modules -libraries[civicrmdrupal][directory_name] = civicrm -libraries[civicrmdrupal][download][type] = git -libraries[civicrmdrupal][download][url] = %%CACHE_DIR%%/civicrm/civicrm-drupal-8.git -libraries[civicrmdrupal][download][branch] = %%CIVI_VERSION%% -libraries[civicrmdrupal][overwrite] = TRUE - -libraries[civicrm][destination] = libraries -libraries[civicrm][directory_name] = civicrm -libraries[civicrm][download][type] = git -libraries[civicrm][download][url] = %%CACHE_DIR%%/civicrm/civicrm-core.git -libraries[civicrm][download][branch] = %%CIVI_VERSION%% -libraries[civicrm][overwrite] = TRUE - -libraries[civicrmpackages][destination] = libraries -libraries[civicrmpackages][directory_name] = civicrm/packages -libraries[civicrmpackages][download][type] = git -libraries[civicrmpackages][download][url] = %%CACHE_DIR%%/civicrm/civicrm-packages.git -libraries[civicrmpackages][download][branch] = %%CIVI_VERSION%% -libraries[civicrmpackages][overwrite] = TRUE - -; Download available l10n releases (may be outdated) -; libraries[civicrm_l10n][destination] = libraries -; libraries[civicrm_l10n][directory_name] = civicrm/l10n/fr_CA/LC_MESSAGES/ -; libraries[civicrm_l10n][download][type] = get -; libraries[civicrm_l10n][download][url] = "https://raw.github.com/civicrm/l10n/master/po/fr_CA/civicrm.mo" -; libraries[civicrm_l10n][overwrite] = TRUE - -; Overwrite .mo files with latest versions -libraries[civicrm_l10n_latest][directory_name] = civicrm/l10n -libraries[civicrm_l10n_latest][download][type] = get -libraries[civicrm_l10n_latest][download][url] = http://download.civicrm.org/civicrm-l10n-core/archives/civicrm-l10n-daily.tar.gz -libraries[civicrm_l10n_latest][overwrite] = TRUE - -; **************************************** -; Runtime Modules -; **************************************** - - -; **************************************** -; Developer modules -; **************************************** - diff --git a/app/config/drupal8-clean/install.sh b/app/config/drupal8-clean/install.sh index cd4be224..84fc9ed4 100644 --- a/app/config/drupal8-clean/install.sh +++ b/app/config/drupal8-clean/install.sh @@ -1,6 +1,7 @@ #!/bin/bash ## install.sh -- Create config files and databases; fill the databases +CMS_ROOT="$WEB_ROOT/web" ############################################################################### ## Create virtual-host and databases @@ -12,7 +13,7 @@ amp_install drupal8_install DRUPAL_SITE_DIR=$(_drupal_multisite_dir "$CMS_URL" "$SITE_ID") -pushd "${WEB_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null +pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null drush8 -y updatedb drush8 -y en libraries popd >> /dev/null @@ -22,26 +23,17 @@ popd >> /dev/null CIVI_DOMAIN_NAME="Demonstrators Anonymous" CIVI_DOMAIN_EMAIL="\"Demonstrators Anonymous\" " -CIVI_CORE="${WEB_ROOT}/libraries/civicrm" -CIVI_SETTINGS="${WEB_ROOT}/sites/${DRUPAL_SITE_DIR}/civicrm.settings.php" -CIVI_FILES="${WEB_ROOT}/sites/${DRUPAL_SITE_DIR}/files/civicrm" -CIVI_TEMPLATEC="${CIVI_FILES}/templates_c" +CIVI_CORE="${CMS_ROOT}/vendor/civicrm/civicrm-core" CIVI_UF="Drupal8" +GENCODE_CONFIG_TEMPLATE="${CMS_ROOT}/modules/contrib/civicrm/civicrm.config.php.drupal" -## civicrm-core v4.7+ sets default ext dir; for older versions, we'll set our own. -if [[ "$CIVI_VERSION" =~ ^4.[0123456](\.([0-9]|alpha|beta)+)?$ ]] ; then - CIVI_EXT_DIR="${WEB_ROOT}/sites/${DRUPAL_SITE_DIR}/ext" - CIVI_EXT_URL="${CMS_URL}/sites/${DRUPAL_SITE_DIR}/ext" -fi - -civicrm_install +pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null + civicrm_install_cv +popd >> /dev/null ############################################################################### ## Extra configuration -pushd "${WEB_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null - - drush8 -y updatedb - drush8 -y en civicrm +pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null ## make sure drush functions are loaded drush8 cc drush -y @@ -52,139 +44,16 @@ pushd "${WEB_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null #civicrm_apply_demo_defaults #cv ev 'return CRM_Utils_System::synchronizeUsers();' - ## Setup theme - #above# drush8 -y en garland - export SITE_CONFIG_DIR - # (not d8 ready) drush8 -y -u "$ADMIN_USER" scr "$SITE_CONFIG_DIR/install-theme.php" - - ## Based on the block info, CRM_Core_Block::CREATE_NEW and CRM_Core_Block::ADD should be enabled by default, but they aren't. - ## "drush8 -y cc all" and "drush8 -y cc block" do *NOT* solve the problem. But this does: - ## doesn't work on d8 - ## drush8 php-eval -u "$ADMIN_USER" 'module_load_include("inc","block","block.admin"); block_admin_display();' - - ## Setup welcome page - #drush8 -y scr "$SITE_CONFIG_DIR/install-welcome.php" - # vset doesn't work in d8 drush8 -y vset site_frontpage "welcome" - - ## Setup login_destination - #above# drush8 -y en login_destination - # doesn't work in d8 drush8 -y scr "$SITE_CONFIG_DIR/install-login-destination.php" + ## Setup demo user + civicrm_apply_d8_perm_defaults + drush8 -y user-create --password="$DEMO_PASS" --mail="$DEMO_EMAIL" "$DEMO_USER" + drush8 -y user-add-role demoadmin "$DEMO_USER" ## Setup userprotect - drush8 -y dl userprotect drush8 -y en userprotect drush8 -y rmp authenticated userprotect.account.edit drush8 -y rmp authenticated userprotect.mail.edit drush8 -y rmp authenticated userprotect.pass.edit - ## Setup demo user - # drush8 -y en civicrm_webtest -#- drush8 -y role-create 'civicrm webtest user' -#- drush8 -y user-create --password="$DEMO_PASS" --mail="$DEMO_EMAIL" "$DEMO_USER" -#- drush8 -y user-add-role 'civicrm webtest user' "$DEMO_USER" -#- drush8 -y rap 'civicrm webtest user' 'delete activities' -#- drush8 -y rap 'civicrm webtest user' 'access AJAX API' -#- drush8 -y rap 'civicrm webtest user' 'access CiviCRM' -#- drush8 -y rap 'civicrm webtest user' 'access Contact Dashboard' -#- drush8 -y rap 'civicrm webtest user' 'access all custom data' -#- drush8 -y rap 'civicrm webtest user' 'access contact reference fields' -#- drush8 -y rap 'civicrm webtest user' 'access deleted contacts' -#- drush8 -y rap 'civicrm webtest user' 'access uploaded files' -#- drush8 -y rap 'civicrm webtest user' 'add contacts' -#- drush8 -y rap 'civicrm webtest user' 'administer CiviCRM' -#- drush8 -y rap 'civicrm webtest user' 'administer Tagsets' -#- drush8 -y rap 'civicrm webtest user' 'administer dedupe rules' -#- drush8 -y rap 'civicrm webtest user' 'administer payment processors' -#- drush8 -y rap 'civicrm webtest user' 'administer reserved groups' -#- drush8 -y rap 'civicrm webtest user' 'administer reserved tags' -#- drush8 -y rap 'civicrm webtest user' 'create manual batch' -#- drush8 -y rap 'civicrm webtest user' 'delete all manual batches' -#- drush8 -y rap 'civicrm webtest user' 'delete contacts' -#- drush8 -y rap 'civicrm webtest user' 'delete own manual batches' -#- drush8 -y rap 'civicrm webtest user' 'edit all contacts' -#- drush8 -y rap 'civicrm webtest user' 'edit all manual batches' -#- drush8 -y rap 'civicrm webtest user' 'edit groups' -#- drush8 -y rap 'civicrm webtest user' 'edit message templates' -#- drush8 -y rap 'civicrm webtest user' 'edit my contact' -#- drush8 -y rap 'civicrm webtest user' 'edit own manual batches' -#- drush8 -y rap 'civicrm webtest user' 'export all manual batches' -#- drush8 -y rap 'civicrm webtest user' 'export own manual batches' -#- drush8 -y rap 'civicrm webtest user' 'import contacts' -#- drush8 -y rap 'civicrm webtest user' 'import contacts' -#- drush8 -y rap 'civicrm webtest user' 'merge duplicate contacts' -#- drush8 -y rap 'civicrm webtest user' 'profile create' -#- drush8 -y rap 'civicrm webtest user' 'profile edit' -#- drush8 -y rap 'civicrm webtest user' 'profile listings' -#- drush8 -y rap 'civicrm webtest user' 'profile listings and forms' -#- drush8 -y rap 'civicrm webtest user' 'profile view' -#- drush8 -y rap 'civicrm webtest user' 'skip IDS check' -#- drush8 -y rap 'civicrm webtest user' 'translate CiviCRM' -#- drush8 -y rap 'civicrm webtest user' 'view all activities' -#- drush8 -y rap 'civicrm webtest user' 'view all contacts' -#- drush8 -y rap 'civicrm webtest user' 'view all manual batches' -#- drush8 -y rap 'civicrm webtest user' 'view all notes' -#- drush8 -y rap 'civicrm webtest user' 'view debug output' -#- drush8 -y rap 'civicrm webtest user' 'view my contact' -#- drush8 -y rap 'civicrm webtest user' 'view my invoices' -#- drush8 -y rap 'civicrm webtest user' 'view own manual batches' -#- drush8 -y rap 'civicrm webtest user' 'access CiviContribute' -#- drush8 -y rap 'civicrm webtest user' 'delete in CiviContribute' -#- drush8 -y rap 'civicrm webtest user' 'edit contributions' -#- drush8 -y rap 'civicrm webtest user' 'make online contributions' -#- drush8 -y rap 'civicrm webtest user' 'access CiviEvent' -#- drush8 -y rap 'civicrm webtest user' 'delete in CiviEvent' -#- drush8 -y rap 'civicrm webtest user' 'edit all events' -#- drush8 -y rap 'civicrm webtest user' 'edit event participants' -#- drush8 -y rap 'civicrm webtest user' 'manage event profiles' -#- drush8 -y rap 'civicrm webtest user' 'register for events' -#- drush8 -y rap 'civicrm webtest user' 'view event info' -#- drush8 -y rap 'civicrm webtest user' 'view event participants' -#- drush8 -y rap 'civicrm webtest user' 'access CiviMail' -#- drush8 -y rap 'civicrm webtest user' 'access CiviMail subscribe/unsubscribe pages' -#- drush8 -y rap 'civicrm webtest user' 'delete in CiviMail' -#- drush8 -y rap 'civicrm webtest user' 'view public CiviMail content' -#- drush8 -y rap 'civicrm webtest user' 'access CiviMember' -#- drush8 -y rap 'civicrm webtest user' 'delete in CiviMember' -#- drush8 -y rap 'civicrm webtest user' 'edit memberships' -#- drush8 -y rap 'civicrm webtest user' 'access CiviPledge' -#- drush8 -y rap 'civicrm webtest user' 'delete in CiviPledge' -#- drush8 -y rap 'civicrm webtest user' 'edit pledges' -#- drush8 -y rap 'civicrm webtest user' 'access CiviReport' -#- drush8 -y rap 'civicrm webtest user' 'access Report Criteria' -#- drush8 -y rap 'civicrm webtest user' 'administer Reports' -#- drush8 -y rap 'civicrm webtest user' 'administer reserved reports' - - # In Garland, CiviCRM's toolbar looks messy unless you also activate Drupal's "toolbar", so grant "access toolbar" - # We've activated more components than typical web-test baseline, so grant rights to those components. - #drush8 scr "$PRJDIR/src/drush/perm.php" <> /dev/null diff --git a/app/drupal.settings.d/pre.d/100-file_private_path-d8.php b/app/drupal.settings.d/pre.d/100-file_private_path-d8.php new file mode 100644 index 00000000..cacf524e --- /dev/null +++ b/app/drupal.settings.d/pre.d/100-file_private_path-d8.php @@ -0,0 +1,7 @@ + +## usage: cvutil_inject_settings [] ## example: cvutil_inject_settings "/var/www/build/drupal/sites/foo/civicrm.settings.php" "civicrm.settings.d" -## example: cvutil_inject_settings "/var/www/build/drupal/sites/foo/settings.php" "drupal.settings.d" +## example: cvutil_inject_settings "/var/www/build/drupal/sites/foo/settings.php" "drupal.settings.d" 'global $settings;' function cvutil_inject_settings() { local FILE="$1" local NAME="$2" - cvutil_assertvars cvutil_inject_settings PRJDIR SITE_NAME SITE_TYPE SITE_CONFIG_DIR SITE_ID SITE_TOKEN PRIVATE_ROOT FILE NAME + local PREAMBLE="$3" + cvutil_assertvars cvutil_inject_settings PRJDIR SITE_NAME SITE_TYPE SITE_CONFIG_DIR SITE_ID SITE_TOKEN PRIVATE_ROOT FILE NAME CMS_VERSION ## Prepare temp file local TMPFILE="${TMPDIR}/${SITE_TYPE}/${SITE_NAME}/${SITE_ID}.settings.tmp" @@ -231,6 +232,8 @@ function cvutil_inject_settings() { \$civibuild['PRIVATE_ROOT'] = '$PRIVATE_ROOT'; \$civibuild['WEB_ROOT'] = '$WEB_ROOT'; \$civibuild['CMS_ROOT'] = '$CMS_ROOT'; + \$civibuild['CMS_VERSION'] = '$CMS_VERSION'; + $PREAMBLE if (file_exists(\$civibuild['PRJDIR'].'/src/civibuild.settings.php')) { require_once \$civibuild['PRJDIR'].'/src/civibuild.settings.php'; @@ -545,11 +548,10 @@ function api4_download_conditional() { ############################################################################### ## Generate config files and setup database function civicrm_install() { - cvutil_assertvars civicrm_install CIVI_CORE CIVI_FILES CIVI_TEMPLATEC CIVI_DOMAIN_NAME CIVI_DOMAIN_EMAIL + cvutil_assertvars civicrm_install CIVI_CORE CIVI_FILES CIVI_TEMPLATEC if [ ! -d "$CIVI_CORE/bin" -o ! -d "$CIVI_CORE/CRM" ]; then - echo "Failed to locate valid civi root: $CIVI_CORE" - exit 1 + cvutil_fatal "Failed to locate valid civi root: $CIVI_CORE" fi ## Create CiviCRM data dirs @@ -578,6 +580,35 @@ function civicrm_install() { fi popd >> /dev/null + civicrm_update_domain +} + +############################################################################### +## Generate config files and setup database (via cv) +function civicrm_install_cv() { + cvutil_assertvars civicrm_install CIVI_CORE CIVI_DB_DSN CMS_URL CIVI_SITE_KEY + + if [ ! -d "$CIVI_CORE/bin" -o ! -d "$CIVI_CORE/CRM" ]; then + cvutil_fatal "Failed to locate valid civi root: $CIVI_CORE" + fi + + local loadGenOpt + [ -n "$NO_SAMPLE_DATA" ] && loadGenOpt="" || loadGenOpt="-m loadGenerated=1" + + cv core:install -f --cms-base-url="$CMS_URL" --db="$CIVI_DB_DSN" -m "siteKey=$CIVI_SITE_KEY" $loadGenOpt + local settings=$( cv ev 'echo CIVICRM_SETTINGS_PATH;' ) + cvutil_inject_settings "$settings" "civicrm.settings.d" + civicrm_update_domain + + ## Enable development + civicrm_make_setup_conf + civicrm_make_test_settings_php +} + +############################################################################### +## Update the CiviCRM domain's name+email +function civicrm_update_domain() { + cvutil_assertvars civicrm_install CIVI_DOMAIN_NAME CIVI_DOMAIN_EMAIL amp sql -Ncivi --root="$CMS_ROOT" <> "$CIVI_CORE/bin/setup.conf" + echo "export GENCODE_CONFIG_TEMPLATE" >> "$CIVI_CORE/bin/setup.conf" + fi } ############################################################################### @@ -995,7 +1041,8 @@ function drupal8_install() { DRUPAL_SITE_DIR=$(_drupal_multisite_dir "$CMS_URL" "$SITE_ID") CMS_DB_HOSTPORT=$(cvutil_build_hostport "$CMS_DB_HOST" "$CMS_DB_PORT") pushd "$CMS_ROOT" >> /dev/null - [ -f "sites/$DRUPAL_SITE_DIR/settings.php" ] && rm -f "sites/$DRUPAL_SITE_DIR/settings.php" + [ -d "sites/$DRUPAL_SITE_DIR" ] && chmod u+w "sites/$DRUPAL_SITE_DIR" + [ -f "sites/$DRUPAL_SITE_DIR/settings.php" ] && chmod u+w "sites/$DRUPAL_SITE_DIR/settings.php" && rm -f "sites/$DRUPAL_SITE_DIR/settings.php" drush8 site-install -y "$@" \ --db-url="mysql://${CMS_DB_USER}:${CMS_DB_PASS}@${CMS_DB_HOSTPORT}/${CMS_DB_NAME}" \ @@ -1006,7 +1053,7 @@ function drupal8_install() { --sites-subdir="$DRUPAL_SITE_DIR" chmod u+w "sites/$DRUPAL_SITE_DIR" chmod u+w "sites/$DRUPAL_SITE_DIR/settings.php" - cvutil_inject_settings "$CMS_ROOT/sites/$DRUPAL_SITE_DIR/settings.php" "drupal.settings.d" + cvutil_inject_settings "$CMS_ROOT/sites/$DRUPAL_SITE_DIR/settings.php" "drupal.settings.d" "global \$settings; \$civibuild['DRUPAL_SITE_DIR'] = '$DRUPAL_SITE_DIR';" chmod u-w "sites/$DRUPAL_SITE_DIR/settings.php" ## Setup extra directories