|
Lines 4893-4911
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
| 4893 |
|
4893 |
|
| 4894 |
$DBversion = "3.07.00.025"; |
4894 |
$DBversion = "3.07.00.025"; |
| 4895 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
4895 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 4896 |
$dbh->do( q|DROP TABLE bibliocoverimage;| ); |
4896 |
if (TableExists('bibliocoverimage')) { |
| 4897 |
$dbh->do( |
4897 |
$dbh->do( q|DROP TABLE bibliocoverimage;| ); |
| 4898 |
q|CREATE TABLE biblioimages ( |
4898 |
$dbh->do( |
| 4899 |
imagenumber int(11) NOT NULL AUTO_INCREMENT, |
4899 |
q|CREATE TABLE biblioimages ( |
| 4900 |
biblionumber int(11) NOT NULL, |
4900 |
imagenumber int(11) NOT NULL AUTO_INCREMENT, |
| 4901 |
mimetype varchar(15) NOT NULL, |
4901 |
biblionumber int(11) NOT NULL, |
| 4902 |
imagefile mediumblob NOT NULL, |
4902 |
mimetype varchar(15) NOT NULL, |
| 4903 |
thumbnail mediumblob NOT NULL, |
4903 |
imagefile mediumblob NOT NULL, |
| 4904 |
PRIMARY KEY (imagenumber), |
4904 |
thumbnail mediumblob NOT NULL, |
| 4905 |
CONSTRAINT bibliocoverimage_fk1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE |
4905 |
PRIMARY KEY (imagenumber), |
| 4906 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;| |
4906 |
CONSTRAINT bibliocoverimage_fk1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE |
| 4907 |
); |
4907 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;| |
| 4908 |
print "Upgrade to $DBversion done (Correct table name for local cover images [please disregard the following error messages: \"Unknown table 'bibliocoverimage'...\" and \"Table 'biblioimages' already exists...\"])\n"; |
4908 |
); |
|
|
4909 |
} |
| 4910 |
print "Upgrade to $DBversion done (Correct table name for local cover images if needed. )\n"; |
| 4909 |
SetVersion($DBversion); |
4911 |
SetVersion($DBversion); |
| 4910 |
} |
4912 |
} |
| 4911 |
|
4913 |
|
|
Lines 5135-5141
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
| 5135 |
$dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueOPACXSLTDetailsDisplay\" WHERE variable='OPACXSLTDetailsDisplay'"); |
5137 |
$dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueOPACXSLTDetailsDisplay\" WHERE variable='OPACXSLTDetailsDisplay'"); |
| 5136 |
$dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueOPACXSLTResultsDisplay\" WHERE variable='OPACXSLTResultsDisplay'"); |
5138 |
$dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueOPACXSLTResultsDisplay\" WHERE variable='OPACXSLTResultsDisplay'"); |
| 5137 |
} |
5139 |
} |
| 5138 |
print "XSLT systempreference takes a path to file rather than YesNo\n"; |
5140 |
print "Upgrade to $DBversion done (XSLT systempreference takes a path to file rather than YesNo)\n"; |
| 5139 |
SetVersion($DBversion); |
5141 |
SetVersion($DBversion); |
| 5140 |
} |
5142 |
} |
| 5141 |
|
5143 |
|
|
Lines 5148-5153
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
| 5148 |
|
5150 |
|
| 5149 |
=head1 FUNCTIONS |
5151 |
=head1 FUNCTIONS |
| 5150 |
|
5152 |
|
|
|
5153 |
=head2 TableExists($table) |
| 5154 |
|
| 5155 |
=cut |
| 5156 |
|
| 5157 |
sub TableExists { |
| 5158 |
my $table = shift; |
| 5159 |
eval { |
| 5160 |
local $dbh->{PrintError} = 0; |
| 5161 |
local $dbh->{RaiseError} = 1; |
| 5162 |
$dbh->do(qq{SELECT * FROM $table WHERE 1 = 0 }); |
| 5163 |
}; |
| 5164 |
return 1 unless $@; |
| 5165 |
return 0; |
| 5166 |
} |
| 5167 |
|
| 5151 |
=head2 DropAllForeignKeys($table) |
5168 |
=head2 DropAllForeignKeys($table) |
| 5152 |
|
5169 |
|
| 5153 |
Drop all foreign keys of the table $table |
5170 |
Drop all foreign keys of the table $table |
| 5154 |
- |
|
|