Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use File::Find;
  4. use File::Copy;
  5. use File::Path;
  6.  
  7. my @dirs = grep { -d } glob '/var/www/*';
  8.  
  9. foreach $dir (@dirs) {
  10.  
  11. $save = $dir.'/httpdocs/wp-content/w3tc-config';
  12.  
  13. $f = $save.'/master.php';
  14.  
  15. if (! -d $save) {
  16.  
  17. mkpath($save);
  18.  
  19. }
  20.  
  21. if (-f $f) {
  22.  
  23. print "Overwriting: $f\n";
  24.  
  25. }
  26. else {
  27.  
  28. print "Adding: $f\n";
  29.  
  30. }
  31.  
  32. copy('/master.php',$f);
  33.  
  34. my $perf = $dir.'/httpdocs/index.php';
  35.  
  36. if (-f $perf) {
  37.  
  38. my $uid = (stat $perf)[4];
  39. my $user = (getpwuid $uid)[0];
  40.  
  41. `chown -R $user:psacln '$dir/httpdocs/wp-content/*'`;
  42. }
  43. else {
  44.  
  45. print "Could not locate $perf\n";
  46.  
  47. }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement