Search the Community
Showing results for tags 'phpbash'.
-
I've got this PHP script for invalidating files in the Amazon CloudFront CDN, which I want to automate. I got it from GitHub. Part of it uses XML, where the file paths are added. $xml = <<<EOD <InvalidationBatch> <Path>/index.html</Path> <Path>/blog/index.html</Path> <CallerReference>{$distribution}{$epoch}</CallerReference> </InvalidationBatch> EOD; I have no idea how to go about this, but what I want to do is change this part so that file paths are added from the output of the bash find command: find /srv/domain.com/wp-content/uploads/ -user www-data This is to invalidate new image file uploads after they have been optimised using a cron script. To further complicate matters, the path needs to only include from the wp-content directory onwards, so the XML would end up something like this: $xml = <<<EOD <InvalidationBatch> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-364x400.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-165x213.jpg</Path> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-165x220.jpg</Path> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-371x495.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-471x609.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-687x412.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-300x180.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-150x150.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-687x477.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-110x142.jpg</Path> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-500x432.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-624x432.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-471x282.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-150x150.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-364x400.jpg</Path> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-110x146.jpg</Path> <CallerReference>{$distribution}{$epoch}</CallerReference> </InvalidationBatch> EOD; I'd really appreciate any help on how to go about this. Thanks.