-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resurrect patches from unstable branch #44
Changes from all commits
be26116
7d5e31e
fd2cc92
30c5eab
10f2057
92e6a73
529fe30
59aba64
3e0ef11
cb8a64e
8e5e1b6
46b975e
b7abfa9
f344c52
f0b8f4f
7c1a336
43c1f45
f8db696
a21b7bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -46,6 +46,7 @@ use File::Spec::Functions; | |||||
use Safe; | ||||||
use JSON::XS qw(decode_json); | ||||||
use Scope::Guard; | ||||||
use URI; | ||||||
|
||||||
use parent qw(Bugzilla::CPAN); | ||||||
|
||||||
|
@@ -124,6 +125,14 @@ sub template_inner { | |||||
} | ||||||
|
||||||
sub extensions { | ||||||
# Guard against extensions querying the extension list during initialization | ||||||
# (through this method or has_extension). | ||||||
# The extension list is not fully populated at that point, | ||||||
# so the results would not be meaningful. | ||||||
state $recursive = 0; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
die "Recursive attempt to load/query extensions" if $recursive; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
$recursive = 1; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, applied these in #66 |
||||||
|
||||||
state $extensions; | ||||||
return $extensions if $extensions; | ||||||
my $extension_packages = Bugzilla::Extension->load_all(); | ||||||
|
@@ -133,9 +142,20 @@ sub extensions { | |||||
push @$extensions, $package; | ||||||
} | ||||||
} | ||||||
$recursive = 0; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
return $extensions; | ||||||
} | ||||||
|
||||||
sub has_extension { | ||||||
my ($class, $name) = @_; | ||||||
my $cache = $class->request_cache; | ||||||
if (!$cache->{extensions_hash}) { | ||||||
my %extensions = map { $_->NAME => 1 } @{Bugzilla->extensions}; | ||||||
$cache->{extensions_hash} = \%extensions; | ||||||
} | ||||||
return exists $cache->{extensions_hash}{$name}; | ||||||
} | ||||||
|
||||||
sub cgi { | ||||||
return request_cache->{cgi} ||= Bugzilla::CGI->new; | ||||||
} | ||||||
|
@@ -162,6 +182,12 @@ sub localconfig { | |||||
||= Bugzilla::Localconfig->new(read_localconfig()); | ||||||
} | ||||||
|
||||||
sub urlbase { | ||||||
my ($class) = @_; | ||||||
|
||||||
# Since this could be modified, we have to return a new one every time. | ||||||
return URI->new($class->localconfig->{urlbase}); | ||||||
} | ||||||
|
||||||
sub params { | ||||||
return request_cache->{params} ||= Bugzilla::Config::read_param_file(); | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,14 @@ use constant get_param_list => ( | |
checker => \&check_email | ||
}, | ||
|
||
{ | ||
name => 'nobody_user', | ||
type => 't', | ||
no_reset => '1', | ||
default => '[email protected]', | ||
checker => \&check_email | ||
}, | ||
|
||
{ | ||
name => 'docs_urlbase', | ||
type => 't', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4227,7 +4227,7 @@ sub _migrate_group_owners { | |
my $dbh = Bugzilla->dbh; | ||
return if $dbh->bz_column_info('groups', 'owner_user_id'); | ||
$dbh->bz_add_column('groups', 'owner_user_id', {TYPE => 'INT3'}); | ||
my $nobody = Bugzilla::User->check('[email protected]'); | ||
my $nobody = Bugzilla::User->check(Bugzilla->params->{'nobody_user'}); | ||
$dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,51 @@ use constant HTTPD_ENV => qw( | |
NYTPROF_DIR | ||
); | ||
|
||
sub _error_page { | ||
my ($code, $title, $description) = @_; | ||
my $host = Bugzilla->urlbase->host; | ||
|
||
return <<EOT; | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>$title</title> | ||
<style> | ||
body { | ||
margin: 1em 2em; | ||
background-color: #455372; | ||
color: #ddd; | ||
font-family: sans-serif; | ||
} | ||
h1, h3 { | ||
color: #fff; | ||
} | ||
a { | ||
color: #fff; | ||
text-decoration: none; | ||
} | ||
#buggie { | ||
float: left; | ||
} | ||
#content { | ||
margin-left: 100px; | ||
padding-top: 20px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<img src="/images/buggie.png" id="buggie" alt="buggie" width="78" height="215"> | ||
<div id="content"> | ||
<h1>$title</h1> | ||
<p>$description</p> | ||
<h3>Error $code</h3> | ||
<p><a href="/">$host</a></p> | ||
</div> | ||
</body> | ||
</html> | ||
EOT | ||
} | ||
|
||
############### | ||
# Permissions # | ||
############### | ||
|
@@ -344,6 +389,47 @@ sub FILESYSTEM { | |
{perms => CGI_READ, overwrite => 1, contents => $yui3_all_css}, | ||
); | ||
|
||
# Create static error pages. | ||
$create_dirs{"errors"} = DIR_CGI_READ; | ||
$create_files{"errors/401.html"} = { | ||
perms => CGI_READ, | ||
overwrite => 1, | ||
contents => _error_page( | ||
401, 'Authentication Required', | ||
"This server could not verify that you are authorized to access | ||
that URL. you either supplied the wrong credentials (e.g., bad | ||
password), or your browser doesn't understand how to supply the | ||
credentials required." | ||
) | ||
}; | ||
$create_files{"errors/403.html"} = { | ||
perms => CGI_READ, | ||
overwrite => 1, | ||
contents => _error_page( | ||
403, | ||
'Access Denied', | ||
"Access to the requested resource has been denied." | ||
) | ||
}; | ||
$create_files{"errors/404.html"} = { | ||
perms => CGI_READ, | ||
overwrite => 1, | ||
contents => _error_page( | ||
404, | ||
'Object Not Found', | ||
"The requested URL was not found on this server." | ||
) | ||
}; | ||
$create_files{"errors/500.html"} = { | ||
perms => CGI_READ, | ||
overwrite => 1, | ||
contents => _error_page( | ||
500, | ||
'Internal Server Error', | ||
"The server encountered an internal error and was unable to complete your request." | ||
) | ||
}; | ||
|
||
Bugzilla::Hook::process( | ||
'install_filesystem', | ||
{ | ||
|
@@ -417,7 +503,7 @@ sub update_filesystem { | |
# Delete old files that no longer need to exist | ||
|
||
# 2001-04-29 [email protected] - Remove oldemailtech | ||
# http://bugzilla.mozilla.org/show_bugs.cgi?id=71552 | ||
# http://bugzilla.mozilla.org/show_bug.cgi?id=71552 | ||
if (-d 'shadow') { | ||
print "Removing shadow directory...\n"; | ||
rmtree("shadow"); | ||
|
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.