Layers | Responsibility |
---|---|
This file contains hidden or 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 | |
# Set the log file path | |
LOG_FILE="lof-file.txt" # Replace with your desired log file path | |
# Get the current timestamp | |
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S") | |
# Function to log messages with timestamp | |
log() { |
This file contains hidden or 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 | |
# Log file path | |
LOG_FILE="logfile-name.txt" | |
# Function to log messages with timestamp | |
log_message() { | |
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE" | |
} |
Use Case | Solution |
---|---|
Content belongs to multiple geographies and timezones, Editors are in multiple timezones, date/time are critical in context of content rather than user, editor, or site. | Smart Date Module |
Content is in one timezone, localized with content editor timezone, site default timezone, and end users are anonymous users. | Drupal Core Date Field |
This file contains hidden or 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
drush sqlq "select a.id,a.mail from <table_name>" --uri='<site-uri>'| awk 'BEGIN { FS = "\t"} ; {print $1","$2}' > output.csv |
This file contains hidden or 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
// will skip deleting branches master|dev|stage | |
// replace origin with remote name | |
git branch -r --merged| egrep -v "(^\*|master|dev|stage)" | sed 's/origin\///' | xargs -n 1 git push --delete origin |
This file contains hidden or 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
// Change the bundle that needs to be deleted. | |
drush php-eval '$ids = \Drupal::entityQuery("media")->condition("bundle", "image")->execute();$storageHandler = \Drupal::entityTypeManager()->getStorage('media');$entities = $storageHandler->loadMultiple($ids);foreach ($entities as $entity) {$entity->delete();}' |
This file contains hidden or 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
// replace 119751 with media entity ID | |
drush php-eval '$nids = \Drupal::entityQuery("node")->condition("type","article")->execute();$nodes = \Drupal\node\Entity\Node::loadMultiple($nids);$media = \Drupal\media\Entity\Media::load(119751);foreach($nodes as $node) {$node->field_hero_media->entity = $media;$node->save();}' |
This file contains hidden or 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
# Check Varnish Header | |
# Use following if no CDN(cloudflare/cloudfront) is used. | |
curl -sLIXGET http://<domain>/page-to-purge | |
# Use following to by-pass CDN | |
curl -sLIXGET -H "Host: <domain>" http://<acquia server ip>/path-to-purge | |
# Example | |
curl -sLIXGET -H "Host: www.test.com" http://12.602.711.xxx/test-page |
This file contains hidden or 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
public function image_upload($image_path, $filename, $is_image_name_set = FALSE) { | |
$output = []; | |
$fid = ParagraphImportProcessParagraph::getFidFromHashing($image_path, $this->configuration); | |
if (!$fid) { | |
$fid = ParagraphImportProcessParagraph::create_image($filename, $image_path, $this->configuration); | |
} | |
if ($fid) { | |
$output = ParagraphImportProcessParagraph::attach_image_info($fid, '', ''); |
NewerOlder