Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
23c0a8a1
Commit
23c0a8a1
authored
May 26, 2007
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 381640: abstract_schema hook is broken--it prevents modification of the extension's own tables
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
parent
4d5504d6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
Schema.pm
Bugzilla/DB/Schema.pm
+18
-14
No files found.
Bugzilla/DB/Schema.pm
View file @
23c0a8a1
...
...
@@ -1331,22 +1331,26 @@ sub _initialize {
my
$self
=
shift
;
my
$abstract_schema
=
shift
;
$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
);
if
(
!
$abstract_schema
)
{
# While ABSTRACT_SCHEMA cannot be modified, $abstract_schema can be.
# So, we dclone it to prevent anything from mucking with the constant.
$abstract_schema
=
dclone
(
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
);
foreach
my
$table
(
keys
%
{
ABSTRACT_SCHEMA
()})
{
lock_value
(
%
$abstract_schema
,
$table
)
if
exists
$abstract_schema
->
{
$table
};
}
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
# anything from mucking with the constant.
$self
->
{
abstract_schema
}
=
dclone
(
$abstract_schema
);
$self
->
{
abstract_schema
}
=
$abstract_schema
;
return
$self
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment