Jump to content

jason404

New Members
  • Posts

    3
  • Joined

  • Last visited

jason404's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. @requinix Thanks, but it will take a while before I can understand what you are saying. What is the advantage of doing that instead of adding $path to the $paths array?
  2. A guy apparently from Google gave me this help on IRC: <?php $path = isset($argv[1]) ? $argv[1] : './'; $owner = isset($argv[2]) ? $argv[2] : 'www-data'; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $paths = array(); foreach ($iterator as $result) { $path = $result->getPath() . '/' . $result->getFilename(); if (posix_getpwuid(fileowner($path))['name'] == $owner) { $paths[] = $path; } } /* Do what you want with $paths */ I am trying to understand it.
  3. 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.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.