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
// User have to be in the same group (apache for instance) | |
setfacl -R -m g:<whatever group>:rwX gitrepo | |
find gitrepo -type d | xargs setfacl -R -m d:g:<whatever group>:rwX |
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
<?php | |
// Autoload Url and Link classes. | |
use Drupal\Core\Url; | |
use Drupal\Core\Link; | |
/** | |
* External link | |
*/ | |
$url = Url::fromUri('https://colorfield.be'); |
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
# To be executed in a script or directly in Devel PHP console | |
$nids = \Drupal::entityQuery('node')->condition('type','YOUR_NODE_TYPE')->execute(); | |
$nodes = \Drupal\node\Entity\Node::loadMultiple($nids); | |
foreach($nodes as $node) { | |
cer_sync_corresponding_references($node); | |
} |
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 | |
# Backup/duplicate a Drupal website and its database. | |
# Usage: sh backup.sh | |
# Prompt for website to backup. | |
read -p "Website directory to backup (/var/www/html/drupal): " WEBSITE_DIRECTORY | |
if [ -z "$WEBSITE_DIRECTORY" ]; then | |
WEBSITE_DIRECTORY="/var/www/html/drupal" | |
fi |
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
perl -lne 'print $& if /bot/' /var/log/httpd/access_log | wc -l |
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
sudo du -d 1 -x -c -g / |
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
$backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS); | |
$variables = array('@backtrace' => json_encode($backtrace, JSON_PRETTY_PRINT)); | |
watchdog('MODULE', 'Things happend, here\'s a backtrace:<br><pre>@backtrace</pre>', $variables, WATCHDOG_ERROR); |
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
<?php | |
ctools_include('cleanstring'); | |
$clean_string = ctools_cleanstring($string_to_clean); | |
?> |
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
CAST(text_column AS CHARACTER VARYING(255)) |
NewerOlder