The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
<?php | |
// Add a WP CLI Command which allows import of CSV files from the command line. | |
if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
require_once WP_PLUGIN_DIR . '/woocommerce/includes/import/class-wc-product-csv-importer.php'; | |
// Maybe require and invoke any other filters you need here as theme/plugins may not be loaded at this point. | |
class WP_CLI_WC_Import_CSV { |
#!/bin/bash | |
# | |
# Inspired by http://gcloud-script-disk-snapshot.blogspot.co.uk/2015/04/gcloud-snapshot-script.html | |
# | |
#Delete the snapshots older than 7 days | |
retention_preiod=7 | |
removal_date=`date --date="$retention_preiod days ago" +%Y%m%d%H%M%S` | |
dt=`date +%Y%m%d%H%M%S` | |
echo $dt | |
#Delimiter to exclude is "\|" |
#!/bin/bash | |
# Usage: ./deleteOld "bucketname" "30 days" | |
s3cmd ls $1 | while read -r line; do | |
createDate=`echo $line|awk {'print $1" "$2'}` | |
createDate=`date -d"$createDate" +%s` | |
olderThan=`date -d"-$2" +%s` | |
if [[ $createDate -lt $olderThan ]] | |
then | |
fileName=`echo $line|awk {'print $4'}` |