Bug 18426: Address QA issues
[koha.git] / installer / externalmodules.pl
blob42eb4b7ef181f6456b1be5317b85bde68211a967
1 #!/usr/bin/perl
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.
8 use strict;
9 use warnings;
10 use C4::Context;
11 my $dir=C4::Context->config('intranetdir');
12 qx(grep -r "^ *use" $dir | grep -v "C4\|strict\|vars" >/tmp/modulesKoha.log);
13 $dir=C4::Context->config('opacdir');
14 qx(grep -r "^ *use" $dir | grep -v "C4\|strict\|vars" >>/tmp/modulesKoha.log);
16 open FILE, "< /tmp/modulesKoha.log" ||die "unable to open file /tmp/modulesKoha.log";
17 my %modulehash;
18 while (my $line=<FILE>){
19 if ( $line=~m#(.*)\:\s*use\s+([A-Z][^\s;]+)# ){
20 my ($file,$module)=($1,$2);
21 my @filename = split /\//, $file;
22 push @{$modulehash{$module}},$filename[scalar(@filename) - 1];
25 print "external modules used in Koha ARE :\n";
26 map {print "* $_ \t in files ",join (",",@{$modulehash{$_}}),"\n" } sort keys %modulehash;
27 close FILE;
28 unlink "/tmp/modulesKoha.log";