Lines 1-27
Link Here
|
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# This Script can be used to provide a list of ALL external modules ***used*** (uncommented) in Koha. |
4 |
# It provides you not only the list of modules BUT ALSO the files that uses those modules. |
5 |
# utf8 or warnings or other lib use are not taken into account at the moment. |
6 |
|
7 |
use Modern::Perl; |
8 |
use C4::Context; |
9 |
|
10 |
my $dir=C4::Context->config('intranetdir'); |
11 |
qx(grep -r "^ *use" $dir | grep -v "C4\|strict\|vars" >/tmp/modulesKoha.log); |
12 |
$dir=C4::Context->config('opacdir'); |
13 |
qx(grep -r "^ *use" $dir | grep -v "C4\|strict\|vars" >>/tmp/modulesKoha.log); |
14 |
|
15 |
open my $fh, '<', '/tmp/modulesKoha.log' ||die "unable to open file /tmp/modulesKoha.log"; |
16 |
my %modulehash; |
17 |
while (my $line=<$fh>){ |
18 |
if ( $line=~m#(.*)\:\s*use\s+([A-Z][^\s;]+)# ){ |
19 |
my ($file,$module)=($1,$2); |
20 |
my @filename = split /\//, $file; |
21 |
push @{$modulehash{$module}},$filename[scalar(@filename) - 1]; |
22 |
} |
23 |
} |
24 |
print "external modules used in Koha ARE :\n"; |
25 |
map {print "* $_ \t in files ",join (",",@{$modulehash{$_}}),"\n" } sort keys %modulehash; |
26 |
close $fh; |
27 |
unlink "/tmp/modulesKoha.log"; |
28 |
- |