Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Drupal 8 demo buildkit build and create a Drupal 9 buildkit bu… #537

Merged
merged 4 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions app/config/drupal8-demo/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,29 @@

###############################################################################

[ -z "$CMS_VERSION" ] && CMS_VERSION=8.x
[ -z "$CMS_VERSION" ] && CMS_VERSION=8.9.x-dev
[ -z "$VOL_VERSION" ] && VOL_VERSION='master'
[ -z "$NG_PRFL_VERSION" ] && NG_PRFL_VERSION='master'
[ -z "$DISC_VERSION" ] && DISC_VERSION=master
[ -z "$RULES_VERSION" ] && RULES_VERSION='master'
[ -z "$DISC_VERSION" ] && DISC_VERSION='master'

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};" \
| sed "s;%%DISC_VERSION%%;${DISC_VERSION};" \
| sed "s;%%VOL_VERSION%%;${VOL_VERSION};" \
| sed "s;%%NG_PRFL_VERSION%%;${NG_PRFL_VERSION};" \
> "$MAKEFILE"
mkdir "$WEB_ROOT"
composer create-project drupal/recommended-project:"$CMS_VERSION" "$WEB_ROOT" --no-interaction

drush8 -y make --working-copy "$MAKEFILE" "$WEB_ROOT"
pushd "$WEB_ROOT" >> /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use the composer install function from civibuild.lib.sh like the d8prj builds do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for D9 :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MikeyMJCO is that not what is called in L25 there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ignore me :-)

composer require drupal/userprotect
composer require drupal/devel
## Some D8 builds include a specific revision of phpunit, but Civi uses standalone phpunit (PHAR)
if composer info | grep -q ^phpunit/phpunit\ ; then
composer config "discard-changes" true ## Weird. phpcs has changes which interfere with other work.
composer remove phpunit/phpunit
composer install --no-dev --no-interaction
fi
civicrm_download_composer_d8
git clone "${CACHE_DIR}/civicrm/civivolunteer.git" -b "$VOL_VERSION" vendor/civicrm/civicrm-core/tools/extensions/civivolunteer
git clone "${CACHE_DIR}/ginkgostreet/org.civicrm.angularprofiles.git" -b "$NG_PRFL_VERSION" vendor/civicrm/civicrm-core/tools/extensions/org.civicrm.angularprofiles
git clone "${CACHE_DIR}/civicrm/org.civicoop.civirules.git" -b "$RULES_VERSION" vendor/civicrm/civicrm-core/tools/extensions/org.civicoop.civirules
git clone "${CACHE_DIR}/TechToThePeople/civisualize.git" -b "master" vendor/civicrm/civicrm-core/tools/extensions/civisualize
git clone "${CACHE_DIR}/dlobo/org.civicrm.module.cividiscount.git" -b "$DISC_VERSION" vendor/civicrm/civicrm-core/tools/extensions/cividiscount
git clone "${CACHE_DIR}/colemanw/exportui.git" -b "master" vendor/civicrm/civicrm-core/tools/extensions/exportui
popd >> /dev/null
20 changes: 15 additions & 5 deletions app/config/drupal8-demo/install-dashboard.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
<?php
civicrm_initialize();
\Drupal::service('civicrm')->initialize();

// -----------------------------
// Get a list of users to update
if (!getenv('INSTALL_DASHBOARD_USERS')) {
throw new RuntimeException('Missing environment variable: INSTALL_DASHBOARD_USERS');
}
$users = explode(';', getenv('INSTALL_DASHBOARD_USERS'));

// WISHLIST: CMSUser::synchronize probably merits an API but lacks test coverage.
CRM_Utils_System::synchronizeUsers(); // v4.7+

// ------------------------------
// Get list of available dashlets
$reportInstanceResult = civicrm_api3('ReportInstance', 'get', array(
'option.limit' => 0,
));
$reportInstanceNames = CRM_Utils_Array::index(array('report_id'), $reportInstanceResult['values']);
$dashletTypeResult = civicrm_api3('Dashboard', 'get', array(
'domain_id' => CRM_Core_Config::domainID(),
));
Expand All @@ -23,21 +29,24 @@
// Left column
// -----------
array(
'dashboard_id' => $dashletTypes['report/25']['id'], // Event Income Summary
// Event Income Summary
'dashboard_id' => $dashletTypes['report/' . $reportInstanceNames['event/summary']['id']]['id'],
'column_no' => 0,
'is_minimized' => 0,
'is_fullscreen' => 1,
'weight' => 1,
),
array(
'dashboard_id' => $dashletTypes['report/13']['id'], // Top Donors
// Top Donors
'dashboard_id' => $dashletTypes['report/' . $reportInstanceNames['contribute/topDonor']['id']]['id'],
'column_no' => 0,
'is_minimized' => 0,
'is_fullscreen' => 1,
'weight' => 3,
),
array(
'dashboard_id' => $dashletTypes['report/6']['id'], // Donor Summary
// Donor Summary
'dashboard_id' => $dashletTypes['report/' . $reportInstanceNames['contribute/summary']['id']]['id'],
'column_no' => 0,
'is_minimized' => 0,
'is_fullscreen' => 1,
Expand All @@ -61,7 +70,8 @@
'weight' => 11,
),
array(
'dashboard_id' => $dashletTypes['report/20']['id'], // Membership Summary
// Membership Summary
'dashboard_id' => $dashletTypes['report/' . $reportInstanceNames['member/summary']['id']]['id'],
'column_no' => 1,
'is_minimized' => 0,
'is_fullscreen' => 1,
Expand Down
52 changes: 46 additions & 6 deletions app/config/drupal8-demo/install-theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
define('SITE_CONFIG_DIR', getenv('SITE_CONFIG_DIR'));
if (! SITE_CONFIG_DIR) { throw new Exception("Failed to locate site config dir"); }

function _install_theme_applyColorScheme($theme, $scheme) {
/*function _install_theme_applyColorScheme($theme, $scheme) {
module_load_include('inc', 'system', 'system.admin');

$fform = array();
Expand All @@ -20,7 +20,7 @@ function _install_theme_applyColorScheme($theme, $scheme) {
$fform_state['values']['scheme'] = $scheme;

color_scheme_form_submit($fform, $fform_state);
}
}*/

/* Set Garland options
VGET & VSET don't work in d8
Expand Down Expand Up @@ -48,8 +48,48 @@ function _install_theme_applyColorScheme($theme, $scheme) {
variable_set('theme_garland_settings', array_merge($settings_old, $settings_new));
variable_set('theme_default', 'garland');
*/
_install_theme_applyColorScheme('garland', 'ash');
//_install_theme_applyColorScheme('garland', 'ash');

// Enable blocks in bartik
$userValues = [
'id' => 'userlogin',
'settings' => [
'id' => 'user_login_block',
'label' => 'User login',
'provider' => 'user',
'label_display' => 'visible',
],
'theme' => 'bartik',
'region' => 'sidebar_first',
'weight' => 0,
'plugin' => 'user_login_block',
'visibility' => [],
'contexts' => [],
'dependencies' => [
'module'=> ['user'],
'theme' => ['bartik'],
],
];
\Drupal::entityTypeManager()->getStorage('block')->create($userValues)->save();
$navigationValues = [
'id' => 'mainnavigation',
'settings' => [
'id' => 'system_menu_block:main',
'label' => 'Main Navigation',
'provider' => 'system',
'label_display' => 'visible',
],
'theme' => 'bartik',
'region' => 'sidebar_first',
'weight' => 0,
'plugin' => 'system_menu_block:main',
'visibility' => [],
'contexts' => [],
'dependencies' => [
'config' => ['system.menu.main'],
'module'=> ['system'],
'theme' => ['bartik'],
],
];
\Drupal::entityTypeManager()->getStorage('block')->create($navigationValues)->save();

// Enable blocks in Garland
db_query("update block set region='sidebar_first' where theme='garland' and module='user' and delta='login'");
db_query("update block set region='sidebar_first' where theme='garland' and module='system' and delta='navigation'");
47 changes: 25 additions & 22 deletions app/config/drupal8-demo/install-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@
*
* Register the "welcome" node (node/1)
*/

$node = node_load(1);
if ($node === FALSE) {
$node = new stdClass();
$node->type = 'page';
node_object_prepare($node);
}

// variable_get is not d8 $node->title = 'Welcome to ' . variable_get('site_name');
$node->title = 'Welcome to your new CiviCRM site';
$node->language = LANGUAGE_NONE;
$node->body[$node->language][0]['value'] = '
<p><strong><a href="http://civicrm.org" target="_blank" title="Opens CiviCRM.org site in a new window.">CiviCRM</a> is a community-based open source project to build constituent relationship management functionality for the nonprofit, advocacy and nongovernmental sectors.
$bodyValue = '<p><strong><a href="http://civicrm.org" target="_blank" title="Opens CiviCRM.org site in a new window.">CiviCRM</a> is a community-based open source project to build constituent relationship management functionality for the nonprofit, advocacy and nongovernmental sectors.
You can use this demo site to try out most of the features of CiviCRM including online donation processing, event management, memberships, case management, reporting and more ...</strong></p>

Just login with...
Expand All @@ -30,13 +18,28 @@
<h3>New to CiviCRM?</h3>
<ul>
<li>Learn about how you can use CiviCRM from our new <strong><a href="https://docs.civicrm.org/user/en/stable/" target="_blank" title="Opens Understanding CiviCRM book in a new window">online book</a></strong>.</li>
<li>Check out <strong><a href="https://civicrm.org">CiviCRM.org</a></strong> for an overview of the project, blogs, professional services listings and other resources and links.</li>\
<li>Check out <strong><a href="https://civicrm.org">CiviCRM.org</a></strong> for an overview of the project, blogs, professional services listings and other resources and links.</li>
<li>Join the <strong><a href="https://chat.civicrm.org">Mattermost</a></strong> chat to see what folks in the CiviCRM community are talking about.</li>
</ul>
';
$node->body[$node->language][0]['summary'] = text_summary($node->body[$node->language][0]['value']);
$node->body[$node->language][0]['format'] = 'filtered_html';

$node->path = array('alias' => 'welcome');
// @todo no good in d8
//node_save($node);
</ul>';
$config = \Drupal::configFactory()->getEditable('system.site');
$nodeEntity = \Drupal::entityTypeManager()->getStorage('node');
$node = $nodeEntity->load(1);
if ($node === NULL) {
$node = $nodeEntity->create([
'type' => 'page',
'title' => 'Welcome to ' . $config->get('name'),
]);
$node->body->value = $bodyValue;
$node->body->summary = text_summary($node->body->value);
$node->body->format = 'restricted_html';
$node->save();
}
else {
$node->title = 'Welcome to ' . $config->get('name');
$node->body->value = $bodyValue;
$node->body->summary = text_summary($node->body->value);
$node->body->format = 'restricted_html';
$node->save();
}
\Drupal::entityTypeManager()->getStorage('path_alias')->create(['path' => $node->toUrl()->toString(), 'alias' => '/welcome'])->save();
$config->set('page.front', $node->toUrl()->toString())->save();
Loading