Commit f98207e3 authored by Sandeep Kadam's avatar Sandeep Kadam

Updated VF microsite setup scripts

parent 4188f5d5
......@@ -55,7 +55,7 @@ echo "Download external VF-WP plugins"
wget --no-check-certificate -O vfwp-external-plugins-master.zip https://github.com/visual-framework/vfwp-external-plugins/archive/master.zip &&
unzip vfwp-external-plugins-master.zip && mv ./vfwp-external-plugins-master/* ./wp-content/plugins/ &&
rm -rf vfwp-external-plugins-master
# List of Array for default VF plugins
PLUGINS_LIST='
advanced-custom-fields-pro
......@@ -75,6 +75,8 @@ vf-members-block
embl-group-site-roles
vf-publications-group-ebi-block
vf-embl-news-block
vf-navigation-container
vf-banner-container
';
echo "VF Plugins - Activating VF Plugins"
......
......@@ -175,6 +175,80 @@ if ! $(wp theme is-active vf-wp-groups); then
wp theme activate "vf-wp-groups"
fi
# Default homepage content for EBI & EMBL groups
home_page_content='
<!-- wp:acf/vf-group-header {"id":"block_5ebba207a5cce","name":"acf/vf-group-header","data":{"field_defaults":"1"},"mode":"preview"} /-->
<!-- wp:acf/vfwp-latest-posts {"id":"block_5ebba351a5cd0","name":"acf/vfwp-latest-posts","data":{"field_5e99679631cbd":"","field_5e9967a331cbe":""},"mode":"preview"} /-->
<!-- wp:acf/vf-data-resources {"id":"block_5ebba324a5ccf","name":"acf/vf-data-resources","data":{"field_defaults":"1"},"mode":"preview"} /-->
<!-- wp:acf/vf-jobs {"id":"block_5ebba1baa5ccb","name":"acf/vf-jobs","data":{"field_defaults":"0","field_vf_jobs_heading":"","field_vf_jobs_limit":"1","field_vf_jobs_filter":"all"},"mode":"preview"} /-->';
# Define postcontent of vf_template.
case "$site_theme" in
EMBL)
vf_template_content='
<!-- wp:acf/vf-container-global-header {"id":"block_5ebb9edff871c","name":"acf/vf-container-global-header"} /-->
<!-- wp:acf/vf-container-breadcrumbs {"id":"block_5ebb9fd224009","name":"acf/vf-container-breadcrumbs"} /-->
<!-- wp:acf/vf-container-wp-groups-header {"id":"block_5ebb9fe02400a","name":"acf/vf-container-wp-groups-header"} /-->
<!-- wp:acf/vf-container-page-template {"id":"block_5ebb9edff871d","name":"acf/vf-container-page-template"} /-->
<!-- wp:acf/vf-container-embl-news {"id":"block_5ebb9fef2400b","name":"acf/vf-container-embl-news"} /-->
<!-- wp:acf/vf-container-global-footer {"id":"block_5ebb9edff871e","name":"acf/vf-container-global-footer"} /-->';
;;
EMBL-SERVICES-FACILITIES)
vf_template_content='
<!-- wp:acf/vf-container-global-header {"id":"block_5ebb9edff871c","name":"acf/vf-container-global-header"} /-->
<!-- wp:acf/vf-container-breadcrumbs {"id":"block_5ebb9fd224009","name":"acf/vf-container-breadcrumbs"} /-->
<!-- wp:acf/vf-container-wp-groups-header {"id":"block_5ebb9fe02400a","name":"acf/vf-container-wp-groups-header"} /-->
<!-- wp:acf/vf-container-page-template {"id":"block_5ebb9edff871d","name":"acf/vf-container-page-template"} /-->
<!-- wp:acf/vf-container-embl-news {"id":"block_5ebb9fef2400b","name":"acf/vf-container-embl-news"} /-->
<!-- wp:acf/vf-container-global-footer {"id":"block_5ebb9edff871e","name":"acf/vf-container-global-footer"} /-->';
# Set the Gutenberg HTML content for the homepage for facilities groups
# Different homepage if its Services-Facilities sites.
home_page_content='
<!-- wp:acf/vf-group-header {"id":"block_5ebba207a5cce","name":"acf/vf-group-header","data":{"field_defaults":"1"},"mode":"preview"} /-->
<!-- wp:acf/vfwp-latest-posts {"id":"block_5ebba351a5cd0","name":"acf/vfwp-latest-posts","data":{"field_5e99679631cbd":"","field_5e9967a331cbe":""},"mode":"preview"} /-->';
;;
EBI-SERVICE|EBI-CLUSTERS|EBI-RESEARCH)
vf_template_content='
<!-- wp:acf/vf-container-ebi-global-header {"id":"block_5ebba0902400e","name":"acf/vf-container-ebi-global-header"} /-->
<!-- wp:acf/vf-container-breadcrumbs {"id":"block_5ebb9fd224009","name":"acf/vf-container-breadcrumbs"} /-->
<!-- wp:acf/vf-container-wp-groups-header {"id":"block_5ebb9fe02400a","name":"acf/vf-container-wp-groups-header"} /-->
<!-- wp:acf/vf-container-page-template {"id":"block_5ebb9edff871d","name":"acf/vf-container-page-template"} /-->
<!-- wp:acf/vf-container-embl-news {"id":"block_5ebb9fef2400b","name":"acf/vf-container-embl-news"} /-->
<!-- wp:acf/vf-container-ebi-global-footer {"id":"block_5ebba0942400f","name":"acf/vf-container-ebi-global-footer"} /-->';
;;
*)
# Default content
vf_template_content='
<!-- wp:acf/vf-container-global-header {"id":"block_5ebb9edff871c","name":"acf/vf-container-global-header"} /-->
<!-- wp:acf/vf-container-page-template {"id":"block_5ebb9edff871d","name":"acf/vf-container-page-template"} /-->
<!-- wp:acf/vf-container-global-footer {"id":"block_5ebb9edff871e","name":"acf/vf-container-global-footer"} /-->';
;;
esac;
echo "=== Core pages & show_on_front config ==="
if [ $(wp option get show_on_front) != 'page' ] ; then
# # Create some core pages
......@@ -185,6 +259,10 @@ if [ $(wp option get show_on_front) != 'page' ] ; then
wp post meta update $home_page_id vf_locked 1
wp post meta update $home_page_id _vf_locked field_vf_locked
wp option update page_on_front $home_page_id
echo "Homepage - configuring"
# Configure the homepage
wp post update $home_page_id --post_content="$home_page_content"
fi
# # Core settings
......@@ -225,50 +303,6 @@ wp option update options_vf_api_url $VF_API_URL
# Add tagline desc to the site
wp option update blogdescription $SITE_TAGLINE
# Define postcontent of vf_template.
case "$site_theme" in
EMBL)
vf_template_content='
<!-- wp:acf/vf-container-global-header {"id":"block_5ebb9edff871c","name":"acf/vf-container-global-header"} /-->
<!-- wp:acf/vf-container-breadcrumbs {"id":"block_5ebb9fd224009","name":"acf/vf-container-breadcrumbs"} /-->
<!-- wp:acf/vf-container-wp-groups-header {"id":"block_5ebb9fe02400a","name":"acf/vf-container-wp-groups-header"} /-->
<!-- wp:acf/vf-container-page-template {"id":"block_5ebb9edff871d","name":"acf/vf-container-page-template"} /-->
<!-- wp:acf/vf-container-embl-news {"id":"block_5ebb9fef2400b","name":"acf/vf-container-embl-news"} /-->
<!-- wp:acf/vf-container-global-footer {"id":"block_5ebb9edff871e","name":"acf/vf-container-global-footer"} /-->';
;;
EBI-SERVICE|EBI-CLUSTERS|EBI-RESEARCH)
vf_template_content='
<!-- wp:acf/vf-container-ebi-global-header {"id":"block_5ebba0902400e","name":"acf/vf-container-ebi-global-header"} /-->
<!-- wp:acf/vf-container-breadcrumbs {"id":"block_5ebb9fd224009","name":"acf/vf-container-breadcrumbs"} /-->
<!-- wp:acf/vf-container-wp-groups-header {"id":"block_5ebb9fe02400a","name":"acf/vf-container-wp-groups-header"} /-->
<!-- wp:acf/vf-container-page-template {"id":"block_5ebb9edff871d","name":"acf/vf-container-page-template"} /-->
<!-- wp:acf/vf-container-embl-news {"id":"block_5ebb9fef2400b","name":"acf/vf-container-embl-news"} /-->
<!-- wp:acf/vf-container-ebi-global-footer {"id":"block_5ebba0942400f","name":"acf/vf-container-ebi-global-footer"} /-->';
;;
*)
# Default content
vf_template_content='
<!-- wp:acf/vf-container-global-header {"id":"block_5ebb9edff871c","name":"acf/vf-container-global-header"} /-->
<!-- wp:acf/vf-container-page-template {"id":"block_5ebb9edff871d","name":"acf/vf-container-page-template"} /-->
<!-- wp:acf/vf-container-global-footer {"id":"block_5ebb9edff871e","name":"acf/vf-container-global-footer"} /-->';
;;
esac;
# get the command and run it
COMMAND="${1}"; shift;
case "${COMMAND}" in
......@@ -278,9 +312,9 @@ case "${COMMAND}" in
# Go to the deploy path i.e wordpress installation path to trigger 'wp' commands.
cd ${DEPLOY_PATH}/
# Code goes here...
# Updated vf_template post content.
vf_template_post_id="$(wp post list --name=default --post_type=vf_template --field=ID)";
wp post update $vf_template_post_id --post_content="$vf_template_content";
# Updated vf_template post content. NOT NEEDED ANYMORE!!!!
# vf_template_post_id="$(wp post list --name=default --post_type=vf_template --field=ID)";
# wp post update $vf_template_post_id --post_content="$vf_template_content";
;;
microsite_setup)
......@@ -301,11 +335,14 @@ case "${COMMAND}" in
ga-google-analytics
vf-publications-group-ebi-block
vf-embl-news-block
widget-options
vf-navigation-container
vf-banner-container
';
# Updated vf_template post content.
vf_template_post_id="$(wp post list --name='default' --post_type='vf_template' --field=ID)"
wp post update $vf_template_post_id --post_content="$vf_template_content"
# Updated vf_template post content. NOT NEEDED ANYMORE!!!!
# vf_template_post_id="$(wp post list --name='default' --post_type='vf_template' --field=ID)"
# wp post update $vf_template_post_id --post_content="$vf_template_content"
# Check if plugin is active, if not then activate plugins
for PLUGIN in ${MICROSITE_PLUGINS_LIST}; do
......@@ -314,18 +351,39 @@ case "${COMMAND}" in
fi
done;
# Configure jobs plugin
echo "=== Jobs ==="
jobs_id="$(wp post list --name=vf_jobs --post_type=vf_block --field=ID)"
if ! [[ `wp post meta get $jobs_id _vf_jobs_limit` ]] ; then
echo "Jobs - configuring"
wp post meta update $jobs_id vf_jobs_heading "Latest Jobs"
wp post meta update $jobs_id _vf_jobs_heading field_vf_jobs_heading
wp post meta update $jobs_id vf_jobs_limit 2
wp post meta update $jobs_id _vf_jobs_limit field_vf_jobs_limit
else
echo "Jobs - already configured"
fi
if [ $site_theme != "EMBL-SERVICES-FACILITIES" ]; then
### Apply below changes to all groups except "EMBL-SERVICES-FACILITIES" sites ###
# Configure jobs plugin
echo "=== Jobs ==="
jobs_id="$(wp post list --name=vf_jobs --post_type=vf_block --field=ID)"
if ! [[ `wp post meta get $jobs_id _vf_jobs_limit` ]] ; then
echo "Jobs - configuring"
wp post meta update $jobs_id vf_jobs_heading "Latest Jobs"
wp post meta update $jobs_id _vf_jobs_heading field_vf_jobs_heading
wp post meta update $jobs_id vf_jobs_limit 2
wp post meta update $jobs_id _vf_jobs_limit field_vf_jobs_limit
else
echo "Jobs - already configured"
fi
# Create Publications page - Create only if it doesn't exists.
if ! $(wp post list --post_type=page --fields=post_title --format=csv | grep -qE "^Publications"); then
publications_page_id="$(wp post create --post_title='Publications' --post_type=page --post_status=publish --porcelain)"
wp menu item add-post primary $publications_page_id --title="Publications"
wp post meta update $publications_page_id _wp_page_template template-publications.php
# Lock the team page agianst further edits from non-admins
wp post meta update $publications_page_id vf_locked 1
wp post meta update $publications_page_id _vf_locked field_vf_locked
fi
fi # End if EMBL-SERVICES-FACILITIES
#### Common pages & configurations across all groups sites ####
###############################################################
# Configure members plugin
echo "=== Members ==="
......@@ -391,24 +449,6 @@ case "${COMMAND}" in
wp option update options_embl_taxonomy_term_where $where_id
fi;
echo "=== Homepage ==="
echo "Homepage - configuring"
# Configure the homepage
# Set the Gutenberg HTML content for the homepage of microsite
home_page_content='
<!-- wp:acf/vf-group-header {"id":"block_5ebba207a5cce","name":"acf/vf-group-header","data":{"field_defaults":"1"},"mode":"preview"} /-->
<!-- wp:acf/vfwp-latest-posts {"id":"block_5ebba351a5cd0","name":"acf/vfwp-latest-posts","data":{"field_5e99679631cbd":"","field_5e9967a331cbe":""},"mode":"preview"} /-->
<!-- wp:acf/vf-data-resources {"id":"block_5ebba324a5ccf","name":"acf/vf-data-resources","data":{"field_defaults":"1"},"mode":"preview"} /-->
<!-- wp:acf/vf-jobs {"id":"block_5ebba1baa5ccb","name":"acf/vf-jobs","data":{"field_defaults":"0","field_vf_jobs_heading":"","field_vf_jobs_limit":"1","field_vf_jobs_filter":"all"},"mode":"preview"} /-->';
# Find ID of homepage and update contents
home_page_id=$(wp option get page_on_front)
wp post update $home_page_id --post_content="$home_page_content"
# Create About page - Create only if it doesn't exists.
if ! $(wp post list --post_type=page --fields=post_title --format=csv | grep -qE "^About"); then
about_page_id="$(wp post create --post_title='About' --post_type=page --post_status=publish --porcelain)"
......@@ -417,11 +457,10 @@ case "${COMMAND}" in
# Create pages for team list and nav
echo "=== Members, about and blog ==="
members_page_content='<!-- wp:acf/vf-members {"id":"block_5ebba3effc3ea","name":"acf/vf-members","data":{"field_defaults":"1"},"mode":"preview"} /-->';
# Create Members page - Create only if it doesn't exists.
if ! $(wp post list --post_type=page --fields=post_title --format=csv | grep -qE "^Members"); then
# Set the Gutenberg HTML content for the members page
members_page_content='<!-- wp:acf/vf-members {"id":"block_5ebba3effc3ea","name":"acf/vf-members","data":{"field_defaults":"1"},"mode":"preview"} /-->';
team_page_id="$(wp post create --post_title='Members' --post_type=page --post_status=publish --post_content="$members_page_content" --porcelain)"
wp menu item add-post primary $team_page_id --title="Members"
wp post meta update $team_page_id _wp_page_template template-members.php
......@@ -430,18 +469,11 @@ case "${COMMAND}" in
wp post meta update $team_page_id vf_locked 1
wp post meta update $team_page_id _vf_locked field_vf_locked
fi
# Create Publications page - Create only if it doesn't exists.
if ! $(wp post list --post_type=page --fields=post_title --format=csv | grep -qE "^Publications"); then
publications_page_id="$(wp post create --post_title='Publications' --post_type=page --post_status=publish --porcelain)"
wp menu item add-post primary $publications_page_id --title="Publications"
wp post meta update $publications_page_id _wp_page_template template-publications.php
# Lock the team page agianst further edits from non-admins
wp post meta update $publications_page_id vf_locked 1
wp post meta update $publications_page_id _vf_locked field_vf_locked
fi
# else
# # Get members page id and update content
## team_page_id="$(wp post list --name='Members' --post_type=page --field=ID)"
## wp post update $team_page_id --post_content="$members_page_content"
# fi
# Create blog page - Create only if it doesn't exists.
if ! $(wp post list --post_type=page --fields=post_title --format=csv | grep -qE "^Blog"); then
......@@ -525,6 +557,8 @@ if [ "$MICROSITE_FLAG" -eq "1" ] ; then
# Update DB if any.
wp core update-db
# Update language core if any
wp language core update
# Apply SAML config & other additional configs
PHP=`which php`;
......@@ -554,12 +588,6 @@ if [ "$MICROSITE_FLAG" -eq "1" ] ; then
if [ -n "$trash_ids" ]; then
wp post delete $trash_ids --force
fi;
# Call custom scripts
cd ${MICROSITE_PATH}/
# Additional custom settings
bin/extend-microsites ${ENVIRONMENT} ${DEPLOY_PATH}/
fi
echo "Successfully completed VF default configuration!!!"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment