Yet another web developer blog

Knowledge base

Useful static information about web developing, system administration, automation an other cool things

Recent updates:

How to eval PHP code via drush without escaping quotes routine

Very often there is a need to execute via drush eval command the PHP code with both single and double quotes, something like this:

echo "Hello, '$username'!"; 

This can be quickly done without manually adding slashes to each quote in PHP code via this bash trick:

PHP=`cat <<'EOF'
echo "Hello, '$username'!"; 
EOF`; drush ev "$PHP"

Instead of single line of PHP code, you can insert long multi-line part of code, without carrying about escaping quotes.


How to view and revert installed schema version of module in Drupal 8, 9

After executing hook_update_N functions, Drupal stores last version of installed updates in his key-value storage, if update function executed without exceptions.

You can simply lookup installed version via command-line drush command:

drush ev "var_dump(drupal_get_installed_schema_version('my_module'))"

Sometimes you may need revert version to previous, for re-apply updates, or repeat updates, if they previously executed with problems.

You can set previous version of Drupal module schema version via this cli drush command:


How to disable auto switching Bluetooth from A2DP to HSP profile on Skype calls in Linux

If you use Bluetooth headset, you probably have bad quality of voice in VoIP calls via Skype and other apps. This happens on Linux and on Windows too.

This happens because when an application starts a call - it create a recording stream with property media.role=phone (telephony applications should set that property for their streams), and PulseAudio switch profile of your Bluetooth Headset from A2DP (Stereo high-quality one-way channel) to HSP/HFP (Mono low-quality 2-way channel for voice-only).