Turn off foreign key check for the installation
[koha.git] / misc / sync_koha_plugin.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use C4::Context;
5 use Getopt::Long;
6
7 my %opt = ();
8 GetOptions(
9     \%opt,
10     qw/head_dir=s rel_2_2_dir=s help/
11 ) or die "\nHouston, we got a problem\n";
12
13 if (exists $opt{help}) {
14     print <<FIN;
15 Sync the Koha plugin with the appropriate files from HEAD. Assumes
16 that you've set up your Koha install to use CVS symlinked to the
17 normal locations.
18
19 Usage: sync_koha_plugin.pl --head_dir=<cvs head directory>
20                            --rel_2_2_dir=<cvs rel_2_2 directory>
21                         [--help]
22
23 --head_dir: is the directory where your Koha HEAD cvs is checked out.
24
25 --rel_2_2_dir: is the directory where your Koha rel_2_2 cvs is checked
26 out and symlinked to your Koha install directories.
27
28 --help: show this help
29
30 FIN
31
32       exit(0);
33 }
34 # Configurable Variables
35 foreach my $option (qw/head_dir rel_2_2_dir/) {
36   if (not exists $opt{$option}) {
37     die 'option "', $option, '" is mandatory', "\n";
38   }
39
40   if (not -d $opt{$option}) {
41     die '"', $opt{$option}, '" must be an existing directory', "\n";
42   }
43
44   if (not $opt{$option} =~ m{^/}) {
45     die '--', $option, ' must be an absolute path', "\n";
46   }
47 }
48
49 ## Modules
50 system(
51     'cp',
52     $opt{head_dir}.'/C4/Biblio.pm',
53     $opt{rel_2_2_dir}.'/C4/'
54 );
55 system(
56     'cp',
57     $opt{head_dir}.'/C4/Context.pm',
58     $opt{rel_2_2_dir}.'/C4/'
59 );
60 system(
61     'cp',
62     $opt{head_dir}.'/C4/SearchMarc.pm',
63     $opt{rel_2_2_dir}.'/C4/'
64 );
65 system(
66     'cp',
67     $opt{head_dir}.'/C4/Log.pm',
68     $opt{rel_2_2_dir}.'/C4/'
69 );
70
71 system(
72     'cp',
73     $opt{head_dir}.'/C4/Review.pm',
74     $opt{rel_2_2_dir}.'/C4/'
75 );
76 system(
77     'cp',
78     $opt{head_dir}.'/misc/plugin/Search.pm',
79     $opt{rel_2_2_dir}.'/C4/'
80 );
81
82 ## Intranet
83 system(
84     'cp',
85     $opt{head_dir}.'/cataloguing/addbiblio.pl',
86     $opt{rel_2_2_dir}.'/acqui.simple/addbiblio.pl'
87 );
88 system(
89     'cp',
90     $opt{head_dir}.'/cataloguing/additem.pl',
91     $opt{rel_2_2_dir}.'/acqui.simple/'
92 );
93 system(
94     'cp',
95     $opt{head_dir}.'/catalogue/detail.pl',
96     $opt{rel_2_2_dir}.'/'
97 );
98 system(
99     'cp',
100     $opt{head_dir}.'/catalogue/MARCdetail.pl',
101     $opt{rel_2_2_dir}.'/'
102 );
103 system(
104     'cp',
105     $opt{head_dir}.'/catalogue/ISBDdetail.pl',
106     $opt{rel_2_2_dir}.'/'
107 );
108
109 # OPAC
110 system(
111     'cp',
112     $opt{head_dir}.'/opac/opac-detail.pl',
113     $opt{rel_2_2_dir}.'/opac/'
114 );
115 system(
116     'cp',
117     $opt{head_dir}.'/opac/opac-MARCdetail.pl',
118     $opt{rel_2_2_dir}.'/opac/'
119 );
120 system(
121     'cp',
122     $opt{head_dir}.'/opac/opac-ISBDdetail.pl',
123     $opt{rel_2_2_dir}.'/opac/'
124 );
125
126 ## Add the symlink necessary due to changes in the dir structure
127 system(
128     'ln',
129     '-s',
130     $opt{rel_2_2_dir}.'/koha-tmpl/intranet-tmpl/npl/en/acqui.simple',
131     $opt{rel_2_2_dir}.'/koha-tmpl/intranet-tmpl/npl/en/cataloguing'
132 );
133
134 ## Add the 'record.abs' symlink 
135 system(
136     'ln',
137     '-s',
138     $opt{head_dir}.'/misc/zebra/usmarc/collection.abs',
139     $opt{head_dir}.'/misc/zebra/usmarc/record.abs'
140 );
141
142 ## Create symlink from intranet/zebra to head zebra directory
143 system(
144     'ln',
145     '-s',
146     $opt{head_dir}.'/misc/zebra/usmarc',
147     C4::Context->config("intranetdir").'/zebra'
148 );
149
150 print "Finished\n\nRemember, you still need to:
151
152 1. Edit moredetail.tmpl and detail.tmpl to allow for deletions
153
154 2. add  <option value=''>Relevance</option> to the search
155    pages to sort by relevance by default
156
157 \n";
158