Last active
August 18, 2017 18:17
-
-
Save markisatacomputer/e519d845fa09f84aa6703bc3f35528a9 to your computer and use it in GitHub Desktop.
deploy changes to pantheon - an attempt to do as little as possible by hand - this way we can test more often
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PANTHEON_ENV="$1" | |
# delete old calendar nodes to free up aliases | |
echo 'node_delete_multiple(array(13,82,3186,3219,3250,3251,3264,4656,4838,4858,4955,5216,5248,5250,5261,5292,6794,6795,8360,8361,8362,8358,8352,8355,9147));' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
# enable features | |
drush @pantheon.exploratorium.$PANTHEON_ENV en explo_feature_event_calendar_views -y | |
# revert features | |
drush @pantheon.exploratorium.$PANTHEON_ENV fr explo_feature_event_type -y | |
# remove old event views made for after dark | |
drush @pantheon.exploratorium.$PANTHEON_ENV dis explo_event_views -y | |
drush @pantheon.exploratorium.$PANTHEON_ENV pm-uninstall explo_event_views -y | |
# delete old past programs contexts | |
echo '$context = context_load("upcoming_event_series"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("conversations_about_landscape_past_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("explorables_past_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("full_spectrum_past_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("lab_and_lunch_past_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("market_days_past_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("off_the_screen_past_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("pairings_past_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("pairings_upcoming_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("sat_cinema_past_programs"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("this_weeks_events"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$context = context_load("todays_events"); context_delete($context);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
# publish the after dark children nodes | |
echo '$nodes = node_load_multiple(array(11467,11468,11469,11470,11471,11472,11473,11474,11475,11476,11477,11478,11483,11484)); | |
foreach ($nodes as $node) { | |
// set status property to 1 | |
$node->status = 1; | |
// re-save the node | |
node_save($node); | |
}' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
# unpublish the tactile dome special hours nodes | |
echo '$nodes = node_load_multiple(array(11347,11348,11349,11350,11352,11406,11407,11408,11409)); | |
foreach ($nodes as $node) { | |
// set status property to 1 | |
$node->status = 0; | |
// re-save the node | |
node_save($node); | |
}' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
# update taxonomy aliases | |
drush @pantheon.exploratorium.$PANTHEON_ENV vset pathauto_taxonomy_term_event_type_pattern 'visit/calendar/[term:name]' | |
drush @pantheon.exploratorium.$PANTHEON_ENV vset pathauto_update_action 2 | |
echo 'pathauto_taxonomy_term_update_alias_multiple(array(39,40,41,43,44,45,46,47,48,49,222), "bulkupdate");' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
drush @pantheon.exploratorium.$PANTHEON_ENV vset pathauto_update_action 0 | |
# delete aliases | |
#echo '$delete = array( | |
# "taxonomy/term/517" | |
# ); | |
# foreach ($delete as $source) { | |
# $result = db_query("DELETE FROM {url_alias} WHERE source = :source", array(":source" => $source)); | |
# }' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
# update aliases that need to be other than auto | |
echo '$updates = array( | |
"taxonomy/term/45" => "visit/calendar/holiday", | |
"taxonomy/term/108" => "arts/resonance", | |
"taxonomy/term/49" => "visit/calendar/members", | |
"taxonomy/term/1863" => "visit/calendar/first-thursdays", | |
"taxonomy/term/503" => "visit/calendar/everything-matters", | |
"taxonomy/term/509" => "visit/calendar/in-the-balance", | |
"taxonomy/term/1863" => "visit/calendar/first-thursdays", | |
"taxonomy/term/486" => "visit/calendar/cinema/saturday-cinema", | |
"taxonomy/term/499" => "visit/calendar/lab-and-lunch", | |
"taxonomy/term/487" => "visit/calendar/full-spectrum-science", | |
"taxonomy/term/517" => "visit/calendar/tactile-dome-special-evening-hours-list", | |
"node/11478" => "visit/calendar/tactile-dome-special-evening-hours" | |
); | |
foreach ($updates as $source => $alias) { | |
$result = db_query("SELECT pid FROM {url_alias} WHERE source = :source", array(":source" => $source)); | |
$a = $result->fetchObject(); | |
$na = array( | |
"source" => $source, | |
"alias" => $alias, | |
"pid" => $a->pid, | |
); | |
path_save($na); | |
}' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
# update menu items | |
echo '$newlink = array( | |
"menu_name" => "main-menu", | |
"link_path" => "visit/calendar", | |
"link_title" => "Calendar", | |
"plid" => 910, | |
"weight" => -47, | |
); | |
menu_link_save($newlink);' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
echo '$newlink = array( | |
"menu_name" => "menu-main-menu-mobile", | |
"link_path" => "visit/calendar", | |
"link_title" => "Calendar", | |
"plid" => 1772, | |
"weight" => -49, | |
); | |
$mlid = menu_link_save($newlink); | |
$newlink = array( | |
"menu_name" => "menu-main-menu-mobile", | |
"link_path" => "visit/calendar/today", | |
"link_title" => "Today", | |
"plid" => $mlid, | |
"weight" => -50, | |
); | |
menu_link_save($newlink); | |
$newlink = array( | |
"menu_name" => "menu-main-menu-mobile", | |
"link_path" => "visit/calendar/this-week", | |
"link_title" => "This Week", | |
"plid" => $mlid, | |
"weight" => -49, | |
); | |
menu_link_save($newlink); | |
$newlink = array( | |
"menu_name" => "menu-main-menu-mobile", | |
"link_path" => "visit/calendar/ongoing", | |
"link_title" => "Ongoing + Series", | |
"plid" => $mlid, | |
"weight" => 10, | |
); | |
menu_link_save($newlink); | |
$event_types = array( | |
39 => "After Dark Thursday Nights", | |
40 => "Arts", | |
41 => "Cinema Arts", | |
44 => "Free", | |
45 => "Holiday Hours", | |
46 => "Kids + Families", | |
47 => "Lab Members", | |
48 => "Live Webcasts", | |
49 => "Members", | |
); | |
$i = -40; | |
foreach($event_types as $tid => $title) { | |
$lank = array( | |
"menu_name" => "menu-main-menu-mobile", | |
"link_path" => "taxonomy/term/$tid", | |
"link_title" => $title, | |
"plid" => $mlid, | |
"weight" => $i++, | |
); | |
menu_link_save($lank); | |
} | |
' | drush @pantheon.exploratorium.$PANTHEON_ENV php-script - | |
# clear the cache!! | |
drush @pantheon.exploratorium.$PANTHEON_ENV cc all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use like so:
./deploy.sh live