added script to remove unneeded .wgaccess files instead of running during upgrade
This commit is contained in:
parent
8fdd413d12
commit
1673a67dfc
3 changed files with 32 additions and 21 deletions
|
|
@ -4,8 +4,9 @@
|
|||
- The YUI library used in WebGUI has been upgraded to 2.5.0.
|
||||
- The resizable text area implementation used in WebGUI has been
|
||||
migrated to the code provided by YUI 2.5.0.
|
||||
- As a result of the above, we no longer need extjs, and it has been
|
||||
- As a result of the above, we no longer need extjs, and it has been
|
||||
removed.
|
||||
- added script to remove unneeded .wgaccess files instead of having it run during upgrade
|
||||
|
||||
7.5.3
|
||||
- prevent HTML and Macro injection in usernames
|
||||
|
|
|
|||
|
|
@ -23,31 +23,11 @@ my $quiet; # this line required
|
|||
|
||||
my $session = start(); # this line required
|
||||
|
||||
removePublicStorageAccessFiles($session);
|
||||
# upgrade functions go here
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
sub removePublicStorageAccessFiles {
|
||||
my $session = shift;
|
||||
print "\tRemoving unnecessary .wgaccess files.\n" unless ($quiet);
|
||||
my $uploadsPath = $session->config->get('uploadsPath');
|
||||
File::Find::find({no_chdir => 1, wanted => sub {
|
||||
return if -d $File::Find::name;
|
||||
my $filename = (File::Spec->splitpath($File::Find::name))[2];
|
||||
return if $filename ne '.wgaccess';
|
||||
open my $fh, '<', $File::Find::name or return;
|
||||
local $/ = "\n";
|
||||
chomp (my ($user, $viewGroup, $editGroup) = <$fh>);
|
||||
close $fh;
|
||||
if ($user eq '1' || $viewGroup eq '1' || $viewGroup eq '7' || $editGroup eq '1' || $editGroup eq '7') {
|
||||
unlink $File::Find::name;
|
||||
}
|
||||
}}, $uploadsPath);
|
||||
}
|
||||
|
||||
##-------------------------------------------------
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
|
|
|
|||
30
sbin/purgeWGAccess.pl
Normal file
30
sbin/purgeWGAccess.pl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
use lib "../lib";
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Config;
|
||||
|
||||
local $| = 1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s' => \(my $configFile),
|
||||
'configFile=s' => \(my $configFile),
|
||||
);
|
||||
my $config = WebGUI::Config->new("..",$configFile);
|
||||
use File::Find;
|
||||
|
||||
print "\tRemoving unnecessary .wgaccess files.\n";
|
||||
my $uploadsPath = $config->get('uploadsPath');
|
||||
File::Find::find({wanted => sub {
|
||||
my $filename = $_;
|
||||
return
|
||||
if -d $filename; # Skip directories
|
||||
return
|
||||
if $filename ne '.wgaccess'; # skip anything other than .wgaccess
|
||||
open my $fh, '<', $filename or return; # skip files we can't open
|
||||
chomp (my ($user, $viewGroup, $editGroup) = <$fh>); # slurp file as lines
|
||||
close $fh;
|
||||
#
|
||||
if ($user eq '1' || $viewGroup eq '1' || $viewGroup eq '7' || $editGroup eq '1' || $editGroup eq '7') {
|
||||
unlink $filename;
|
||||
}
|
||||
}}, $uploadsPath);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue