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
4d06a5bd
Commit
4d06a5bd
authored
Oct 05, 2002
by
matty%chariot.net.au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #93667: Move some code around, add some section heading comments.
parent
f9a1a427
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
54 deletions
+65
-54
sanitycheck.cgi
sanitycheck.cgi
+65
-54
No files found.
sanitycheck.cgi
View file @
4d06a5bd
...
...
@@ -71,57 +71,6 @@ sub AlertBadVoteCache {
$offervotecacherebuild
=
1
;
}
sub
CrossCheck
{
my
$table
=
shift
@_
;
my
$field
=
shift
@_
;
Status
(
"Checking references to $table.$field"
);
while
(
@_
)
{
my
$ref
=
shift
@_
;
my
(
$refertable
,
$referfield
,
$keyname
,
$exceptions
)
=
@$ref
;
$exceptions
||=
[]
;
my
%
exceptions
=
map
{
$_
=>
1
}
@$exceptions
;
Status
(
"... from $refertable.$referfield"
);
SendSQL
(
"SELECT DISTINCT $refertable.$referfield"
.
(
$keyname
?
", $refertable.$keyname"
:
''
)
.
" "
.
"FROM $refertable LEFT JOIN $table "
.
" ON $refertable.$referfield = $table.$field "
.
"WHERE $table.$field IS NULL "
.
" AND $refertable.$referfield IS NOT NULL"
);
while
(
MoreSQLData
())
{
my
(
$value
,
$key
)
=
FetchSQLData
();
if
(
!
$exceptions
{
$value
})
{
my
$alert
=
"Bad value $value found in $refertable.$referfield"
;
if
(
$keyname
)
{
if
(
$keyname
eq
'bug_id'
)
{
$alert
.=
' (bug '
.
BugLink
(
$key
)
.
')'
;
}
else
{
$alert
.=
" ($keyname == '$key')"
;
}
}
Alert
(
$alert
);
}
}
}
}
sub
DateCheck
{
my
$table
=
shift
@_
;
my
$field
=
shift
@_
;
Status
(
"Checking dates in $table.$field"
);
SendSQL
(
"SELECT COUNT( $field ) FROM $table WHERE $field > NOW()"
);
my
$c
=
FetchOneColumn
();
if
(
$c
)
{
Alert
(
"Found $c dates in future"
);
}
}
my
@badbugs
;
...
...
@@ -151,6 +100,10 @@ if (exists $::FORM{'rebuildvotecache'}) {
Status
(
"Vote cache has been rebuilt."
);
}
###########################################################################
# Fix group derivations
###########################################################################
if
(
exists
$::FORM
{
'rederivegroups'
})
{
Status
(
"OK, All users' inherited permissions will be rechecked when "
.
"they next access Bugzilla."
);
...
...
@@ -204,6 +157,10 @@ if (exists $::FORM{'cleangroupsnow'}) {
print
"OK, now running sanity checks.<p>\n"
;
###########################################################################
# Check enumeration values
###########################################################################
# This one goes first, because if this is wrong, then the below tests
# will probably fail too
...
...
@@ -226,6 +183,45 @@ foreach my $field (("bug_severity", "bug_status", "op_sys",
# Perform referential (cross) checks
###########################################################################
sub
CrossCheck
{
my
$table
=
shift
@_
;
my
$field
=
shift
@_
;
Status
(
"Checking references to $table.$field"
);
while
(
@_
)
{
my
$ref
=
shift
@_
;
my
(
$refertable
,
$referfield
,
$keyname
,
$exceptions
)
=
@$ref
;
$exceptions
||=
[]
;
my
%
exceptions
=
map
{
$_
=>
1
}
@$exceptions
;
Status
(
"... from $refertable.$referfield"
);
SendSQL
(
"SELECT DISTINCT $refertable.$referfield"
.
(
$keyname
?
", $refertable.$keyname"
:
''
)
.
" "
.
"FROM $refertable LEFT JOIN $table "
.
" ON $refertable.$referfield = $table.$field "
.
"WHERE $table.$field IS NULL "
.
" AND $refertable.$referfield IS NOT NULL"
);
while
(
MoreSQLData
())
{
my
(
$value
,
$key
)
=
FetchSQLData
();
if
(
!
$exceptions
{
$value
})
{
my
$alert
=
"Bad value $value found in $refertable.$referfield"
;
if
(
$keyname
)
{
if
(
$keyname
eq
'bug_id'
)
{
$alert
.=
' (bug '
.
BugLink
(
$key
)
.
')'
;
}
else
{
$alert
.=
" ($keyname == '$key')"
;
}
}
Alert
(
$alert
);
}
}
}
}
CrossCheck
(
"keyworddefs"
,
"id"
,
[
"keywords"
,
"keywordid"
]);
...
...
@@ -284,9 +280,6 @@ CrossCheck("products", "id",
[
"flaginclusions"
,
"product_id"
,
"type_id"
],
[
"flagexclusions"
,
"product_id"
,
"type_id"
]);
DateCheck
(
"groups"
,
"last_changed"
);
DateCheck
(
"profiles"
,
"refreshed_when"
);
###########################################################################
# Perform double field referential (cross) checks
###########################################################################
...
...
@@ -567,6 +560,24 @@ BugCheck("bugs, products WHERE " .
"Bugs that have enough votes to be confirmed but haven't been"
);
###########################################################################
# Date checks
###########################################################################
sub
DateCheck
{
my
$table
=
shift
@_
;
my
$field
=
shift
@_
;
Status
(
"Checking dates in $table.$field"
);
SendSQL
(
"SELECT COUNT( $field ) FROM $table WHERE $field > NOW()"
);
my
$c
=
FetchOneColumn
();
if
(
$c
)
{
Alert
(
"Found $c dates in future"
);
}
}
DateCheck
(
"groups"
,
"last_changed"
);
DateCheck
(
"profiles"
,
"refreshed_when"
);
###########################################################################
# Unsent mail
###########################################################################
...
...
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