Skip to content

Instantly share code, notes, and snippets.

View tbutterf's full-sized avatar

Travis Butterfield tbutterf

View GitHub Profile
@travisbutterfield
travisbutterfield / config-deploy.md
Last active May 11, 2022 21:47
Workflow for deploying config changes in D9

Workflow for deploying config changes in D9

/* This workflow assumes you have installed Drush and have downloaded Pantheon site aliases with terminus aliases */

  1. Set bash variable: SITE=<sitename>
  2. Clone your LIVE environment to DEV in Pantheon terminus env:clone-content --updatedb -- $SITE.live dev (Optional, but recommended)
  3. Commit all LOCAL changes in Git.
  4. Export configs on LOCAL: drush config:export
  5. Commit changes on LOCAL: git commit -am "export local configs to code"
  6. Pull remote changes from LIVE to LOCAL: drush config:pull @$SITE.live @self:../config/
  7. Resolve any conflicts and then commit on LOCAL: git commit -am "resolve config code conflicts"
  8. Push changes up to remote DEV: git push origin
@chlp
chlp / replace_serialized_data.php
Created May 7, 2019 14:22
php change str_replace inside serialized data and fix it
<?php
$change_from = 'old_string';
$change_to = 'new_string_new_length';
$serialized = file_get_contents('serialized_data.txt');
$serialized = str_replace($change_from, $change_to, $serialized);
function fix_str_length($matches) {
$string = $matches[2];
$right_length = strlen($string); // yes, strlen even for UTF-8 characters, PHP wants the mem size, not the char count
return 's:' . $right_length . ':"' . $string . '";';
}