This file contains 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 | |
# init folders | |
mkdir deploy-cache | |
mkdir contents | |
# init atomic deployment folders | |
mkdir releases | |
mkdir releases/release-0 | |
mkdir releases/release-0/web |
This file contains 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 | |
# Clean a cloned git repo to avoid conflicts between multiple OS | |
# To install | |
## download the file clean-repo.sh and place it somewhere | |
## in bashrc or zhrc add an alias like so: alias cleangit="bash /path/to/clean-repo.sh" | |
## in the terminal into the project, simply lunch the alias: cleangit | |
This file contains 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 | |
/** | |
* Delete a folder recursively | |
* | |
* @param $dir | |
* | |
* @author Maxime CULEA | |
*/ | |
private function delete_folder( $dir ) { |
This file contains 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 | |
/** | |
* Delete all empty terms for the given $taxonomy | |
* PS: You can do the same in WP CLI or even plain WordPress php functions | |
* | |
* @param : string $tax : given taxonomy to work on | |
* | |
* @author Maxime CULEA | |
*/ |
This file contains 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
# Optimize DB : WC action scheduler | |
DELETE FROM `wp_actionscheduler_actions` WHERE `status` = 'canceled' OR `status` = 'complete' OR `status` = 'failed'; | |
# Optimize Action Scheduler queue | |
# See the WP Cli cron command: https://gist.github.com/MaximeCulea/df0766f9e17105f03717f206a22a2d39#single-site |
This file contains 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
# Find all wanted files by type and delete | |
find . -iname \*.pdf\* -exec rm -rf {} \; | |
find . -iname \*.zip\* -exec rm -rf {} \; | |
find . -iname \*.psd\* -exec rm -rf {} \; | |
find . -iname \*.pptx\* -exec rm -rf {} \; | |
find . -iname \*.mp4\* -exec rm -rf {} \; | |
# Top 10 heavy files | |
find . -printf '%s %p\n'| sort -nr | head -10 |
This file contains 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 | |
/** | |
* Add other post types into the post rest api route to gather different contents type | |
* | |
* @link /wp-json/wp/v2/posts/ | |
* | |
* @param $args | |
* @param $request | |
* | |
This file contains 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
# https://www.cyberciti.biz/faq/how-to-find-my-public-ip-address-from-command-line-on-a-linux | |
echo $(dig +short myip.opendns.com @resolver1.opendns.com) | |
# @url https://www.tecmint.com/find-linux-server-public-ip-address | |
wget -qO- http://ipecho.net/plain | xargs echo | |
# Get PHP Version | |
https://www.thegeekdiary.com/how-to-check-the-php-version-on-linux | |
# Get Public server info | |
https://github.com/BeAPI/phpwpinfo |
This file contains 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 | |
$dependencies = [ | |
'inc' => [ | |
'assets', | |
'manage-plugins', | |
'options', | |
'languages', | |
], | |
'theme' => [ | |
'wysiwyg', |
This file contains 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
// Hide the Customizer and related features | |
add_action( 'admin_print_footer_scripts', function () { | |
echo '<style type="text/css">.hide-if-no-customize{display: none}</style>'; | |
} ); |
NewerOlder