summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xperl-install/share/po/help_xml2pm.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/perl-install/share/po/help_xml2pm.pl b/perl-install/share/po/help_xml2pm.pl
index 249a4efe5..acef76d19 100755
--- a/perl-install/share/po/help_xml2pm.pl
+++ b/perl-install/share/po/help_xml2pm.pl
@@ -45,8 +45,8 @@ use common;
# IMPORTANT: Don't edit this File - It is automatically generated
# from the manuals !!!
-# Write a mail to <doc@linux-mandrake.com> if you want
-# it changed.
+# Write a mail to <documentation@mandrakesoft.com> if
+# you want it changed.
%steps = (
empty => '',
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Andrew Dunstan <andrew@dunslane.net>,
#                 Edward J. Sabol <edwardjsabol@iname.com>
#                 Max Kanat-Alexander <mkanat@bugzilla.org>

package Bugzilla::DB::Schema::Mysql;

###############################################################################
#
# DB::Schema implementation for MySQL
#
###############################################################################

use strict;
use Bugzilla::Error;

use base qw(Bugzilla::DB::Schema);

# This is for column_info_to_column, to know when a tinyint is a 
# boolean and when it's really a tinyint. This only has to be accurate
# up to and through 2.19.3, because that's the only time we need
# column_info_to_column.
#
# This is basically a hash of tables/columns, with one entry for each column
# that should be interpreted as a BOOLEAN instead of as an INT1 when
# reading in the Schema from the disk. The values are discarded; I just
# used "1" for simplicity.
use constant BOOLEAN_MAP => {
    bugs           => {everconfirmed => 1, reporter_accessible => 1,
                       cclist_accessible => 1, qacontact_accessible => 1,
                       assignee_accessible => 1},
    longdescs      => {isprivate => 1, already_wrapped => 1},
    attachments    => {ispatch => 1, isobsolete => 1, isprivate => 1},
    flags          => {is_active => 1},
    flagtypes      => {is_active => 1, is_requestable => 1, 
                       is_requesteeble => 1, is_multiplicable => 1},
    fielddefs      => {mailhead => 1, obsolete => 1},
    bug_status     => {isactive => 1},
    resolution     => {isactive => 1},
    bug_severity   => {isactive => 1},
    priority       => {isactive => 1},
    rep_platform   => {isactive => 1},
    op_sys         => {isactive => 1},
    profiles       => {mybugslink => 1, newemailtech => 1},
    namedqueries   => {linkinfooter => 1, watchfordiffs => 1},
    groups         => {isbuggroup => 1, isactive => 1},
    group_control_map => {entry => 1, membercontrol => 1, othercontrol => 1,
                          canedit => 1},
    group_group_map => {isbless => 1},
    user_group_map => {isbless => 1, isderived => 1},
    products       => {disallownew => 1},
    series         => {public => 1},
    whine_queries  => {onemailperbug => 1},
    quips          => {approved => 1},
    setting        => {is_enabled => 1}
};

# Maps the db_specific hash backwards, for use in column_info_to_column.
use constant REVERSE_MAPPING => {
    # Boolean and the SERIAL fields are handled in column_info_to_column,
    # and so don't have an entry here.
    TINYINT   => 'INT1',
    SMALLINT  => 'INT2',
    MEDIUMINT => 'INT3',
    INTEGER   => 'INT4',

    # All the other types have the same name in their abstract version
    # as in their db-specific version, so no reverse mapping is needed.
};

use constant MYISAM_TABLES => qw(bugs_fulltext);

#------------------------------------------------------------------------------
sub _initialize {

    my $self = shift;

    $self = $self->SUPER::_initialize(@_);

    $self->{db_specific} = {

        BOOLEAN =>      'tinyint',
        FALSE =>        '0', 
        TRUE =>         '1',

        INT1 =>         'tinyint',
        INT2 =>         'smallint',
        INT3 =>         'mediumint',
        INT4 =>         'integer',

        SMALLSERIAL =>  'smallint auto_increment',
        MEDIUMSERIAL => 'mediumint auto_increment',
        INTSERIAL =>    'integer auto_increment',

        TINYTEXT =>     'tinytext',
        MEDIUMTEXT =>   'mediumtext',
        LONGTEXT =>     'mediumtext',

        LONGBLOB =>     'longblob',

        DATETIME =>     'datetime',

    };

    $self->_adjust_schema;

    return $self;

} #eosub--_initialize
#------------------------------------------------------------------------------
sub _get_create_table_ddl {
    # Extend superclass method to specify the MYISAM storage engine.
    # Returns a "create table" SQL statement.

    my($self, $table) = @_;

    my $charset = Bugzilla->dbh->bz_db_is_utf8 ? "CHARACTER SET utf8" : '';
    my $type    = grep($_ eq $table, MYISAM_TABLES) ? 'MYISAM' : 'InnoDB';
    return($self->SUPER::_get_create_table_ddl($table) 
           . " ENGINE = $type $charset");

} #eosub--_get_create_table_ddl
#------------------------------------------------------------------------------
sub _get_create_index_ddl {
    # Extend superclass method to create FULLTEXT indexes on text fields.
    # Returns a "create index" SQL statement.

    my($self, $table_name, $index_name, $index_fields, $index_type) = @_;

    my $sql = "CREATE ";
    $sql .= "$index_type " if ($index_type eq 'UNIQUE'
                               || $index_type eq 'FULLTEXT');
    $sql .= "INDEX \`$index_name\` ON $table_name \(" .
      join(", ", @$index_fields) . "\)";

    return($sql);

} #eosub--_get_create_index_ddl
#--------------------------------------------------------------------

sub get_create_database_sql {
    my ($self, $name) = @_;
    # We only create as utf8 if we have no params (meaning we're doing
    # a new installation) or if the utf8 param is on.
    my $create_utf8 = Bugzilla->params->{'utf8'} 
                      || !defined Bugzilla->params->{'utf8'};
    my $charset = $create_utf8 ? "CHARACTER SET utf8" : '';
    return ("CREATE DATABASE $name $charset");
}

# MySQL has a simpler ALTER TABLE syntax than ANSI.
sub get_alter_column_ddl {
    my ($self, $table, $column, $new_def, $set_nulls_to) = @_;
    my $old_def = $self->get_column($table, $column);
    my %new_def_copy = %$new_def;
    if ($old_def->{PRIMARYKEY} && $new_def->{PRIMARYKEY}) {
        # If a column stays a primary key do NOT specify PRIMARY KEY in the
        # ALTER TABLE statement. This avoids a MySQL error that two primary
        # keys are not allowed.
        delete $new_def_copy{PRIMARYKEY};
    }

    my $new_ddl = $self->get_type_ddl(\%new_def_copy);
    my @statements;

    push(@statements, "UPDATE $table SET $column = $set_nulls_to
                        WHERE $column IS NULL") if defined $set_nulls_to;
    push(@statements, "ALTER TABLE $table CHANGE COLUMN 
                       $column $column $new_ddl");
    if ($old_def->{PRIMARYKEY} && !$new_def->{PRIMARYKEY}) {
        # Dropping a PRIMARY KEY needs an explicit DROP PRIMARY KEY
        push(@statements, "ALTER TABLE $table DROP PRIMARY KEY");
    }

    return @statements;
}

sub get_drop_fk_sql {
    my ($self, $table, $column, $references) = @_;
    my $fk_name = $self->_get_fk_name($table, $column, $references);
    my @sql = ("ALTER TABLE $table DROP FOREIGN KEY $fk_name");
    my $dbh = Bugzilla->dbh;

    # MySQL requires, and will create, an index on any column with
    # an FK. It will name it after the fk, which we never do.
    # So if there's an index named after the fk, we also have to delete it. 
    if ($dbh->bz_index_info_real($table, $fk_name)) {
        push(@sql, $self->get_drop_index_ddl($table, $fk_name));
    }

    return @sql;
}

sub get_drop_index_ddl {
    my ($self, $table, $name) = @_;
    return ("DROP INDEX \`$name\` ON $table");
}

# A special function for MySQL, for renaming a lot of indexes.
# Index renames is a hash, where the key is a string - the 
# old names of the index, and the value is a hash - the index
# definition that we're renaming to, with an extra key of "NAME"
# that contains the new index name.
# The indexes in %indexes must be in hashref format.
sub get_rename_indexes_ddl {
    my ($self, $table, %indexes) = @_;
    my @keys = keys %indexes or return ();

    my $sql = "ALTER TABLE $table ";

    foreach my $old_name (@keys) {
        my $name = $indexes{$old_name}->{NAME};
        my $type = $indexes{$old_name}->{TYPE};
        $type ||= 'INDEX';
        my $fields = join(',', @{$indexes{$old_name}->{FIELDS}});