Bug 76923 - Don't |use diagnostics| (its really expensive at startup time)

r=joel x2
This commit is contained in:
bbaetz%student.usyd.edu.au 2002-08-26 06:17:26 +00:00
Родитель f96f0897f6
Коммит aacda75fc3
65 изменённых файлов: 1 добавлений и 413 удалений

Просмотреть файл

@ -24,7 +24,6 @@
# Module Initialization
############################################################################
use diagnostics;
use strict;
package Attachment;

Просмотреть файл

@ -21,7 +21,6 @@
# Terry Weissman <terry@mozilla.org>
# Chris Yeh <cyeh@bluemartini.com>
use diagnostics;
use strict;
use DBI;

Просмотреть файл

@ -24,7 +24,6 @@
# Module Initialization
############################################################################
use diagnostics;
use strict;
package Attachment;

Просмотреть файл

@ -21,7 +21,6 @@
# Terry Weissman <terry@mozilla.org>
# Chris Yeh <cyeh@bluemartini.com>
use diagnostics;
use strict;
use DBI;

Просмотреть файл

@ -29,7 +29,6 @@
# might involve turning this into a virtual base class, and having
# UserSet and KeywordSet types that inherit from it.
use diagnostics;
use strict;
# Everything that uses RelationSet should already have globals.pl loaded

Просмотреть файл

@ -25,7 +25,6 @@
# Myk Melez <myk@mozilla.org>
# Michael Schindler <michael@compressconsult.com>
use diagnostics;
use strict;
require "globals.pl";

Просмотреть файл

@ -24,7 +24,6 @@
################################################################################
# Make it harder for us to do dangerous things in Perl.
use diagnostics;
use strict;
# Bundle the functions in this file together into the "Token" package.

Просмотреть файл

@ -69,7 +69,6 @@ use base qw(Exporter);
trim);
use strict;
use diagnostics;
=head1 FUNCTIONS

Просмотреть файл

@ -27,7 +27,6 @@
# Contains some global routines used throughout the CGI scripts of Bugzilla.
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -29,7 +29,6 @@
# might involve turning this into a virtual base class, and having
# UserSet and KeywordSet types that inherit from it.
use diagnostics;
use strict;
# Everything that uses RelationSet should already have globals.pl loaded

Просмотреть файл

@ -24,7 +24,6 @@
################################################################################
# Make it harder for us to do dangerous things in Perl.
use diagnostics;
use strict;
# Bundle the functions in this file together into the "Token" package.

Просмотреть файл

@ -26,7 +26,6 @@
################################################################################
# Make it harder for us to do dangerous things in Perl.
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -21,7 +21,6 @@
# Dave Miller <justdave@syndicomm.com>
# Vaskin Kissoyan <vkissoyan@yahoo.com>
use diagnostics;
use strict;
use RelationSet;

Просмотреть файл

@ -29,7 +29,6 @@
################################################################################
# Make it harder for us to do dangerous things in Perl.
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -94,7 +94,6 @@
# Global definitions
###########################################################################
use diagnostics;
use strict;
# 12/17/00 justdave@syndicomm.com - removed declarations of the localconfig

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -26,7 +26,6 @@
use AnyDBM_File;
use diagnostics;
use strict;
use vars @::legal_product;

Просмотреть файл

@ -29,7 +29,6 @@ push @INC, "../."; # this script now lives in contrib
require "globals.pl";
use diagnostics;
use strict;
my $EMAIL_TRANSFORM_NONE = "email_transform_none";

Просмотреть файл

@ -37,7 +37,7 @@
#
# You need to work with bug_email.pl the MIME::Parser installed.
#
# $Id: bug_email.pl,v 1.12 2002-08-17 14:19:57 bbaetz%student.usyd.edu.au Exp $
# $Id: bug_email.pl,v 1.13 2002-08-26 06:17:21 bbaetz%student.usyd.edu.au Exp $
###############################################################
# 02/12/2000 (SML)
@ -66,7 +66,6 @@
# - integrate some setup in the checksetup.pl script
# - gpg signatures for security
use diagnostics;
use strict;
use MIME::Parser;

Просмотреть файл

@ -28,7 +28,6 @@
# 1. better way to get the body text (I don't know what dump_entity() is
# actually doing
use diagnostics;
use strict;
use MIME::Parser;

Просмотреть файл

@ -23,7 +23,6 @@
# mysqld-watcher.pl - a script that watches the running instance of
# mysqld and kills off any long-running SELECTs against the shadow_db
#
use diagnostics;
use strict;
# some configurables:

Просмотреть файл

@ -24,7 +24,6 @@
# Christopher Aillon <christopher@aillon.com>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -33,7 +33,6 @@
# Only adding new parameters is done here. Once the parameter exists, you
# must use %baseurl%/editparams.cgi from the web to edit the settings.
use diagnostics;
use strict;
# Shut up misguided -w warnings about "used only once". For some reason,

Просмотреть файл

@ -27,7 +27,6 @@ use vars qw(
$userid
);
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Contributor(s): Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# J. Paul Reed <preed@sigkill.com>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -23,7 +23,6 @@
# Generates mostfreq list from data collected by collectstats.pl.
use diagnostics;
use strict;
use AnyDBM_File;

Просмотреть файл

@ -1,348 +0,0 @@
#!/usr/bonsaitools/bin/perl -w
# -*- 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): Terry Weissman <terry@mozilla.org>
# Myk Melez <myk@mozilla.org>
################################################################################
# Script Initialization
################################################################################
# Make it harder for us to do dangerous things in Perl.
use diagnostics;
use strict;
use lib ".";
use vars qw(
$template
$vars
);
# Include the Bugzilla CGI and general utility library.
require "CGI.pl";
# Establish a connection to the database backend.
ConnectToDatabase();
# Make sure the user is logged in and is allowed to edit products
# (i.e. the user has "editcomponents" privileges), since attachment
# statuses are product-specific.
confirm_login();
UserInGroup("editcomponents")
|| DisplayError("You are not authorized to administer attachment statuses.")
&& exit;
################################################################################
# Main Body Execution
################################################################################
# All calls to this script should contain an "action" variable whose value
# determines what the user wants to do. The code below checks the value of
# that variable and runs the appropriate code.
# Determine whether to use the action specified by the user or the default.
my $action = $::FORM{'action'} || 'list';
if ($action eq "list")
{
list();
}
elsif ($action eq "create")
{
create();
}
elsif ($action eq "insert")
{
validateName();
validateDescription();
validateSortKey();
validateProduct();
insert();
}
elsif ($action eq "edit")
{
edit();
}
elsif ($action eq "update")
{
validateID();
validateName();
validateDescription();
validateSortKey();
update();
}
elsif ($action eq "confirmdelete")
{
validateID();
confirmDelete();
}
elsif ($action eq "delete")
{
validateID();
deleteStatus();
}
else
{
DisplayError("I could not figure out what you wanted to do.")
}
exit;
################################################################################
# Data Validation
################################################################################
sub validateID
{
$::FORM{'id'} =~ /^[1-9][0-9]*$/
|| DisplayError("The status ID is not a positive integer.")
&& exit;
SendSQL("SELECT 1 FROM attachstatusdefs WHERE id = $::FORM{'id'}");
my ($defexists) = FetchSQLData();
$defexists
|| DisplayError("The status with ID #$::FORM{'id'} does not exist.")
&& exit;
}
sub validateName
{
$::FORM{'name'}
|| DisplayError("You must enter a name for the status.")
&& exit;
$::FORM{'name'} !~ /[\s,]/
|| DisplayError("The status name cannot contain commas or whitespace.")
&& exit;
length($::FORM{'name'}) <= 50
|| DisplayError("The status name cannot be more than 50 characters long.")
&& exit;
}
sub validateDescription
{
$::FORM{'desc'}
|| DisplayError("You must enter a description of the status.")
&& exit;
}
sub validateSortKey
{
$::FORM{'sortkey'} =~ /^\d+$/
&& $::FORM{'sortkey'} < 32768
|| DisplayError("The sort key must be an integer between 0 and 32767 inclusive.")
&& exit;
}
sub validateProduct
{
# Retrieve a list of products.
SendSQL("SELECT name FROM products");
my @products;
push(@products, FetchSQLData()) while MoreSQLData();
grep($_ eq $::FORM{'product'}, @products)
|| DisplayError("You must select an existing product for the status.")
&& exit;
}
################################################################################
# Functions
################################################################################
sub list
{
# Administer attachment status flags, which is the set of status flags
# that can be applied to an attachment.
# If the user is seeing this screen as a result of doing something to
# an attachment status flag, display a message about what happened
# to that flag (i.e. "The attachment status flag was updated.").
my ($message) = (@_);
# Retrieve a list of attachment status flags and create an array of hashes
# in which each hash contains the data for one flag.
SendSQL("SELECT attachstatusdefs.id, attachstatusdefs.name, " .
"attachstatusdefs.description, attachstatusdefs.sortkey, products.name, " .
"count(attachstatusdefs.id) " .
"FROM attachstatusdefs, products " .
"WHERE products.id = attachstatusdefs.product_id " .
"GROUP BY id " .
"ORDER BY attachstatusdefs.sortkey");
my @statusdefs;
while ( MoreSQLData() )
{
my ($id, $name, $description, $sortkey, $product, $attachcount) = FetchSQLData();
push @statusdefs, { 'id' => $id , 'name' => $name , 'description' => $description ,
'sortkey' => $sortkey , 'product' => $product,
'attachcount' => $attachcount };
}
# Define the variables and functions that will be passed to the UI template.
$vars->{'message'} = $message;
$vars->{'statusdefs'} = \@statusdefs;
# Return the appropriate HTTP response headers.
print "Content-type: text/html\n\n";
# Generate and return the UI (HTML page) from the appropriate template.
$template->process("admin/attachstatus/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
sub create
{
# Display a form for creating a new attachment status flag.
# Retrieve a list of products to which the attachment status may apply.
SendSQL("SELECT name FROM products");
my @products;
push(@products, FetchSQLData()) while MoreSQLData();
# Define the variables and functions that will be passed to the UI template.
$vars->{'products'} = \@products;
# Return the appropriate HTTP response headers.
print "Content-type: text/html\n\n";
# Generate and return the UI (HTML page) from the appropriate template.
$template->process("admin/attachstatus/create.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
sub insert
{
# Insert a new attachment status flag into the database.
# Quote the flag's name and description as appropriate for inclusion
# in a SQL statement.
my $name = SqlQuote($::FORM{'name'});
my $desc = SqlQuote($::FORM{'desc'});
my $product_id = get_product_id($::FORM{'product'});
SendSQL("LOCK TABLES attachstatusdefs WRITE");
SendSQL("SELECT MAX(id) FROM attachstatusdefs");
my $id = FetchSQLData() + 1;
SendSQL("INSERT INTO attachstatusdefs (id, name, description, sortkey, product_id)
VALUES ($id, $name, $desc, $::FORM{'sortkey'}, $product_id)");
SendSQL("UNLOCK TABLES");
# Display the "administer attachment status flags" page
# along with a message that the flag has been created.
list("The attachment status has been created.");
}
sub edit
{
# Display a form for editing an existing attachment status flag.
# Retrieve the definition from the database.
SendSQL("SELECT attachstatusdefs.name, attachstatusdefs.description, " .
" attachstatusdefs.sortkey, products.name " .
"FROM attachstatusdefs, products " .
"WHERE attachstatusdefs.product_id = products.id " .
" AND attachstatusdefs.id = $::FORM{'id'}");
my ($name, $desc, $sortkey, $product) = FetchSQLData();
# Define the variables and functions that will be passed to the UI template.
$vars->{'id'} = $::FORM{'id'};
$vars->{'name'} = $name;
$vars->{'desc'} = $desc;
$vars->{'sortkey'} = $sortkey;
$vars->{'product'} = $product;
# Return the appropriate HTTP response headers.
print "Content-type: text/html\n\n";
# Generate and return the UI (HTML page) from the appropriate template.
$template->process("admin/attachstatus/edit.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
sub update
{
# Update an attachment status flag in the database.
# Quote the flag's name and description as appropriate for inclusion
# in a SQL statement.
my $name = SqlQuote($::FORM{'name'});
my $desc = SqlQuote($::FORM{'desc'});
SendSQL("LOCK TABLES attachstatusdefs WRITE");
SendSQL("
UPDATE attachstatusdefs
SET name = $name ,
description = $desc ,
sortkey = $::FORM{'sortkey'}
WHERE id = $::FORM{'id'}
");
SendSQL("UNLOCK TABLES");
# Display the "administer attachment status flags" page
# along with a message that the flag has been updated.
list("The attachment status has been updated.");
}
sub confirmDelete
{
# check if we need confirmation to delete:
SendSQL("SELECT COUNT(attach_id), name
FROM attachstatusdefs LEFT JOIN attachstatuses
ON attachstatuses.statusid=attachstatusdefs.id
WHERE statusid = $::FORM{'id'}
GROUP BY attachstatuses.statusid;");
my ($attachcount, $name) = FetchSQLData();
if ($attachcount > 0) {
$vars->{'id'} = $::FORM{'id'};
$vars->{'attachcount'} = $attachcount;
$vars->{'name'} = $name;
print "Content-type: text/html\n\n";
$template->process("admin/attachstatus/delete.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
else {
deleteStatus();
}
}
sub deleteStatus
{
# Delete an attachment status flag from the database.
SendSQL("LOCK TABLES attachstatusdefs WRITE, attachstatuses WRITE");
SendSQL("DELETE FROM attachstatuses WHERE statusid = $::FORM{'id'}");
SendSQL("DELETE FROM attachstatusdefs WHERE id = $::FORM{'id'}");
SendSQL("UNLOCK TABLES");
# Display the "administer attachment status flags" page
# along with a message that the flag has been deleted.
list("The attachment status has been deleted.");
}

Просмотреть файл

@ -25,7 +25,6 @@
#
# Holger Schurig <holgerschurig@nikocity.de>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -23,7 +23,6 @@
# Code derived from editowners.cgi and editusers.cgi
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -20,7 +20,6 @@
#
# Contributor(s): Terry Weissman <terry@mozilla.org>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -13,7 +13,6 @@
#
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -22,7 +22,6 @@
# J. Paul Reed <preed@sigkill.com>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -27,7 +27,6 @@
#
# Holger Schurig <holgerschurig@nikocity.de>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -27,7 +27,6 @@
#
# Holger Schurig <holgerschurig@nikocity.de>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -26,7 +26,6 @@
#
# Holger Schurig <holgerschurig@nikocity.de>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -32,7 +32,6 @@
#
##############################################################################
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -25,7 +25,6 @@
# Contains some global variables and routines used throughout bugzilla.
use diagnostics;
use strict;
use Bugzilla::Util;

Просмотреть файл

@ -25,7 +25,6 @@
# a new bug into bugzilla. Everything before the beginning <?xml line
# is removed so you can pipe in email messages.
use diagnostics;
use strict;
#####################################################################

Просмотреть файл

@ -30,7 +30,6 @@ use vars qw{ %COOKIE };
###############################################################################
# Make it harder for us to do dangerous things in Perl.
use diagnostics;
use strict;
# Include the Bugzilla CGI and general utility library.

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Dawn Endico <endico@mozilla.org>
# Terry Weissman <terry@mozilla.org>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -28,7 +28,6 @@
# either case), numbers 0-9, the underscore "_" and the hyphen "-".
###############################################################################
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -23,7 +23,6 @@
# Joe Robins <jmrobins@tgix.com>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -24,7 +24,6 @@
# Christopher Aillon <christopher@aillon.com>
# Myk Melez <myk@mozilla.org>
use diagnostics;
use strict;
my $UserInEditGroupSet = -1;

Просмотреть файл

@ -25,7 +25,6 @@
# Jacob Steenhagen <jake@actex.net>
# Matthew Tuck <matty@chariot.net.au>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -23,7 +23,6 @@
# Matthias Radestock <matthias@sorted.org>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -24,7 +24,6 @@
use vars %::FORM;
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -22,7 +22,6 @@
# Gervase Markham <gerv@gerv.net>
# David Fallon <davef@tetsubo.com>
use diagnostics;
use strict;
use vars qw(

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use vars %::COOKIE;

Просмотреть файл

@ -38,7 +38,6 @@
# Myk Melez <myk@mozilla.org):
# Implemented form field validation and reorganized code.
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Matthew Tuck <matty@chariot.net.au>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -22,7 +22,6 @@
# Myk Melez <myk@mozilla.org>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -20,7 +20,6 @@
#
# Contributor(s): Terry Weissman <terry@mozilla.org>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Jacob Steenhagen <jake@acutex.net>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -23,7 +23,6 @@
# Christian Reis <kiko@async.com.br>
# Myk Melez <myk@mozilla.org>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -16,7 +16,6 @@
# Contributor(s): Jacob Steenhagen <jake@acutex.net>
use strict;
use diagnostics;
use lib ".";
require "CGI.pl";

Просмотреть файл

@ -21,7 +21,6 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# David Gardiner <david.gardiner@unisa.edu.au>
use diagnostics;
use strict;
require "globals.pl";

Просмотреть файл

@ -23,7 +23,6 @@
package Support::Templates;
use diagnostics;
use strict;
use lib 't';

Просмотреть файл

@ -25,7 +25,6 @@
############################################################################
# Make it harder for us to do dangerous things in Perl.
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -20,7 +20,6 @@
# Christopher Aillon <christopher@aillon.com>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib qw(.);

Просмотреть файл

@ -23,7 +23,6 @@
# Christopher Aillon <christopher@aillon.com>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib ".";

Просмотреть файл

@ -26,7 +26,6 @@
# assigned to them that has status NEW that has not been touched for
# more than 7 days.
use diagnostics;
use strict;
require "globals.pl";

Просмотреть файл

@ -22,7 +22,6 @@
# Terry Weissman <terry@mozilla.org>
# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
use lib qw(.);