summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB/Schema.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/DB/Schema.pm')
-rw-r--r--Bugzilla/DB/Schema.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index ea25a125a..4c270e68c 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -35,9 +35,11 @@ package Bugzilla::DB::Schema;
use strict;
use Bugzilla::Error;
+use Bugzilla::Hook;
use Bugzilla::Util;
use Bugzilla::Constants;
+use Hash::Util qw(lock_value unlock_hash lock_keys unlock_keys);
use Safe;
# Historical, needed for SCHEMA_VERSION = '1.00'
use Storable qw(dclone freeze thaw);
@@ -1168,6 +1170,15 @@ sub _initialize {
$abstract_schema ||= ABSTRACT_SCHEMA;
+ # Let extensions add tables, but make sure they can't modify existing
+ # tables. If we don't lock/unlock keys, lock_value complains.
+ lock_keys(%$abstract_schema);
+ lock_value(%$abstract_schema, $_) foreach (keys %$abstract_schema);
+ unlock_keys(%$abstract_schema);
+ Bugzilla::Hook::process('db_schema-abstract_schema',
+ { schema => $abstract_schema });
+ unlock_hash(%$abstract_schema);
+
$self->{schema} = dclone($abstract_schema);
# While ABSTRACT_SCHEMA cannot be modified,
# $self->{abstract_schema} can be. So, we dclone it to prevent