}
-# This function should be called only after creating the admin user.
-sub create_default_product {
+sub create_default_classification {
my $dbh = Bugzilla->dbh;
+
# Make the default Classification if it doesn't already exist.
if (!$dbh->selectrow_array('SELECT 1 FROM classifications')) {
- print get_text('install_default_classification',
+ print get_text('install_default_classification',
{ name => DEFAULT_CLASSIFICATION->{name} }) . "\n";
Bugzilla::Classification->create(DEFAULT_CLASSIFICATION);
}
+}
+
+# This function should be called only after creating the admin user.
+sub create_default_product {
+ my $dbh = Bugzilla->dbh;
# And same for the default product/component.
if (!$dbh->selectrow_array('SELECT 1 FROM products')) {
Returns: nothing.
+=item C<create_default_classification>
+
+Creates the default "Unclassified" L<Classification|Bugzilla::Classification>
+if it doesn't already exist
+
=item C<create_default_product()>
-Description: Creates the default product and classification if
+Description: Creates the default product and component if
they don't exist.
Params: none
use Bugzilla::Constants;
use Bugzilla::Hook;
+use Bugzilla::Install ();
use Bugzilla::Install::Util qw(indicate_progress install_string);
use Bugzilla::Util;
use Bugzilla::Series;
Bugzilla::Hook::process('install-update_db');
+ # We do this here because otherwise the foreign key from
+ # products.classification_id to classifications.id will fail
+ # (because products.classification_id defaults to "1", so on upgraded
+ # installations it's already been set before the first Classification
+ # exists).
+ Bugzilla::Install::create_default_classification();
+
$dbh->bz_setup_foreign_keys();
}
if $switch{'reset-password'};
###########################################################################
-# Create default Product and Classification
+# Create default Product
###########################################################################
Bugzilla::Install::create_default_product();
The code for this is in L<Bugzilla::Install::DB/update_table_definitions>.
+This includes creating the default Classification (using
+L<Bugzilla::Install/create_default_classification>) and setting up all
+the foreign keys for all tables, using L<Bugzilla::DB/bz_setup_foreign_keys>.
+
=item 14
Creates the system groups--the ones like C<editbugs>, C<admin>, and so on.
=item 17
-Creates the default Classification, Product, and Component, using
+Creates the default Product and Component, using
L<Bugzilla::Install/create_default_product>.
=back