wp-cli as bash alias

#on ~/.bash_profile, add:
alias wp='php -d "disable_functions=" /<path_to>/wp-cli.phar'

Acquia Dev Desktop – use Drush 7 for Drupal 7 sites

echo $DEVDESKTOP_DRUPAL_SETTINGS_DIR
// returns empty string
//
  
export DEVDESKTOP_DRUPAL_SETTINGS_DIR=$HOME/.acquia/DevDesktop/DrupalSettings
echo $DEVDESKTOP_DRUPAL_SETTINGS_DIR
// returns:
//  ~/.acquia/DevDesktop/DrupalSettings
  
vendor/drush/drush/drush --verbose --debug info
// returns
// Drush bootstrap phase : bootstrap_drupal_database() [0.27 sec, 5.39 MB]                                                                                                [bootstrap]
// Successfully connected to the Drupal database. [0.29 sec, 5.75 MB]                                                                                                     [bootstrap]

WordPress – add a new admin user directly using database

# Replace the following:
# <DATABASE NAME>
# <WP TABLE PREFIX> = "wp_"

INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>users` (`user_login`, `user_pass`, `user_email`, `user_registered`) VALUES ('new_admin', MD5('123456'), 'new_admin@test.com', NOW());

# Get the user id of the use
# Replace <ADDED USER ID>
INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '<ADDED USER ID>', '<WP TABLE PREFIX>capabilities', 'a:1:{s:13:"administrator";b:1;}');

INSERT INTO `<DATABASE NAME>`.`<WP TABLE PREFIX>usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '<ADDED USER ID>', '<WP TABLE PREFIX>user_level', '10');

WordPress – Optimisation

#public_html/.htaccess
<FilesMatch "\.(js|css|jpg|gif|png|pdf|swf|svg|svgz|ico|ttf|ttc|otf|eot|woff|woff2|webp)$">
 <IfModule mod_headers.c>
    ExpiresActive On
    ExpiresDefault  "access plus 1 year"
    Header set Cache-Control "public, immutable, max-age=31536000, s-maxage=31536000"
    Header set Access-Control-Allow-Origin "*"
 </IfModule>
</FilesMatch>

#public_html/wp-content/cache/autoptimize/.htaccess

## Comment out:
#<IfModule mod_expires.c>
#        ExpiresActive On
#        ExpiresByType text/css A30672000
#        ExpiresByType text/javascript A30672000
#        ExpiresByType application/javascript A30672000
#</IfModule>
#<IfModule mod_headers.c>
#    Header append Cache-Control "public, immutable"
#</IfModule>

## Add
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access 1 year"
    ExpiresByType text/javascript "access 1 year"
    ExpiresByType application/javascript "access 1 year"
    Header set Cache-Control "public, immutable, max-age=31536000, s-maxage=31536000"
    Header set Access-Control-Allow-Origin "*"
</IfModule>

youtube-dl – Pluralsight

youtube-dl -u "username" \
-p "password" \
-i \
-c \
--no-check-certificate \
--console-title \
--max-sleep-interval 240 \
--min-sleep-interval 180 \
--add-header Referer:"https://app.pluralsight.com/library/" \
-o '%(playlist_title)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s-%(title)s.%(ext)s' \
-f 'best[height<=720]/worst[height>720]' \
--rate-limit 600k \
"https://app.pluralsight.com/library/courses/firebase-functions-fundamentals"

wget – download a wordpress from ftp

wget -c -m --ftp-user='' --ftp-password='' ftp://162.241.248.17/  --exclude-directories=/wp-content/uploads/,/wp-admin/,/wp-includes/ --reject sql

.htaccess – Force https

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

WordPress – Package a plugin

# Run at the current directory
find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && find . -name '.DS_Store' -type f -delete
# zip it
zip -x '*.git/*' -r updraftplus.2.16.20.24.zip updraftplus