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
e00a2bc8
Commit
e00a2bc8
authored
Mar 20, 2007
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 374330: Make it possible for installation templates to be text or HTML
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
parent
ba5a5c40
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
132 additions
and
24 deletions
+132
-24
Util.pm
Bugzilla/Install/Util.pm
+50
-17
checksetup.pl
checksetup.pl
+2
-2
setup.cgi
setup.cgi
+16
-4
strings.html.pl
template/en/default/setup/strings.html.pl
+45
-0
strings.txt.pl
template/en/default/setup/strings.txt.pl
+19
-1
No files found.
Bugzilla/Install/Util.pm
View file @
e00a2bc8
...
...
@@ -34,13 +34,13 @@ use Safe;
use
base
qw(Exporter)
;
our
@EXPORT_OK
=
qw(
display
_version_and_os
get
_version_and_os
indicate_progress
install_string
vers_cmp
)
;
sub
display
_version_and_os
{
sub
get
_version_and_os
{
# Display version information
my
@os_details
=
POSIX::
uname
;
# 0 is the name of the OS, 2 is the major version,
...
...
@@ -50,11 +50,10 @@ sub display_version_and_os {
$os_name
=
Win32::
GetOSName
();
}
# $os_details[3] is the minor version.
print
install_string
(
'version_and_os'
,
{
bz_ver
=>
BUGZILLA_VERSION
,
return
{
bz_ver
=>
BUGZILLA_VERSION
,
perl_ver
=>
sprintf
(
'%vd'
,
$
^
V
),
os_name
=>
$os_name
,
os_ver
=>
$os_details
[
3
]
})
.
"\n"
;
os_ver
=>
$os_details
[
3
]
};
}
sub
indicate_progress
{
...
...
@@ -75,18 +74,18 @@ sub install_string {
my
$path
=
_cache
()
->
{
template_include_path
};
my
$string_template
;
# Find the first
set of templates
that defines this string.
# Find the first
template
that defines this string.
foreach
my
$dir
(
@$path
)
{
my
$file
=
"$dir/setup/strings.txt.pl"
;
next
unless
-
e
$file
;
my
$safe
=
new
Safe
;
$safe
->
rdo
(
$file
);
my
%
strings
=
%
{
$safe
->
varglob
(
'strings'
)};
$string_template
=
$strings
{
$string_id
};
last
if
$string_template
;
my
$base
=
"$dir/setup/strings"
;
$string_template
=
_get_string_from_file
(
$string_id
,
"$base.html.pl"
)
if
is_web
();
$string_template
=
_get_string_from_file
(
$string_id
,
"$base.txt.pl"
)
if
!
$string_template
;
last
if
defined
$string_template
;
}
die
"No language defines the string '$string_id'"
if
!
$string_template
;
die
"No language defines the string '$string_id'"
if
!
defined
$string_template
;
$vars
||=
{};
my
@replace_keys
=
keys
%
$vars
;
...
...
@@ -236,6 +235,34 @@ sub vers_cmp {
# Helper Subroutines #
######################
# Tells us if we're running in a web interface (Usually, this means
# we're running in setup.cgi as opposed to checksetup.pl, but sometimes
# this function *might* get called from within normal Bugzilla code.)
sub
is_web
{
# When this is called, we may or may not have all of our required
# perl modules installed.
#
# The way this is written works for all of these circumstances:
# * We're in checksetup.pl, before and after requirements-checking
# * We're in setup.cgi, before and after requirements-checking
# * We're in email_in.pl, the WebService interface, or something else
# (That's primarily what the "return 0" check below is for.)
my
$usage_mode
=
eval
{
Bugzilla
->
usage_mode
};
return
0
if
(
defined
$usage_mode
&&
$usage_mode
!=
USAGE_MODE_BROWSER
);
return
i_am_cgi
();
}
# Used by install_string
sub
_get_string_from_file
{
my
(
$string_id
,
$file
)
=
@_
;
return
undef
if
!-
e
$file
;
my
$safe
=
new
Safe
;
$safe
->
rdo
(
$file
);
my
%
strings
=
%
{
$safe
->
varglob
(
'strings'
)};
return
$strings
{
$string_id
};
}
# Used by template_include_path.
sub
_add_language_set
{
my
(
$array
,
$lang
,
$templatedir
)
=
@_
;
...
...
@@ -307,6 +334,12 @@ sub is_tainted {
return
not
eval
{
my
$foo
=
join
(
''
,
@_
),
kill
0
;
1
;
};
}
sub
i_am_cgi
{
# I use SERVER_SOFTWARE because it's required to be
# defined for all requests in the CGI spec.
return
exists
$ENV
{
'SERVER_SOFTWARE'
}
?
1
:
0
;
}
__END__
=head1 NAME
...
...
@@ -331,10 +364,10 @@ export them.
=over
=item C<
display
_version_and_os>
=item C<
get
_version_and_os>
Prints out some text lines, saying what version of Bugzilla we're running,
what perl version we're using, and what OS we're running on.
Returns a hash containing information about what version of Bugzilla we're
running,
what perl version we're using, and what OS we're running on.
=item C<indicate_progress>
...
...
checksetup.pl
View file @
e00a2bc8
...
...
@@ -54,7 +54,7 @@ BEGIN { chdir dirname($0); }
use
lib
"."
;
use
Bugzilla::
Constants
;
use
Bugzilla::Install::
Requirements
;
use
Bugzilla::Install::
Util
qw(
display
_version_and_os)
;
use
Bugzilla::Install::
Util
qw(
install_string get
_version_and_os)
;
require
5.008001
if
ON_WINDOWS
;
# for CGI 2.93 or higher
...
...
@@ -78,7 +78,7 @@ pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'};
my
$answers_file
=
$ARGV
[
0
];
my
$silent
=
$answers_file
&&
!
$switch
{
'verbose'
};
display_version_and_os
(
)
unless
$silent
;
print
(
install_string
(
'header'
,
get_version_and_os
())
.
"\n"
)
unless
$silent
;
# Check required --MODULES--
my
$module_results
=
check_requirements
(
!
$silent
);
Bugzilla::Install::Requirements::
print_module_instructions
(
...
...
setup.cgi
View file @
e00a2bc8
...
...
@@ -10,7 +10,7 @@
# rights and limitations under the License.
#
# The Initial Developer of the Original Code is Everything Solved.
# Portions created by Everything Solved are Copyright (C) 200
6
# Portions created by Everything Solved are Copyright (C) 200
7
# Everything Solved. All Rights Reserved.
#
# The Original Code is the Bugzilla Bug Tracking System.
...
...
@@ -20,6 +20,9 @@
use
strict
;
use
lib
"."
;
#################
# Initial Setup #
#################
# The order of these "use" statements is important--we have to have
# CGI before we have CGI::Carp. Without CGI::Carp, "use 5.008" will just throw
...
...
@@ -37,14 +40,22 @@ use 5.008;
use
Bugzilla::
Constants
;
require
5.008001
if
ON_WINDOWS
;
use
Bugzilla::Install::
Requirements
;
use
Bugzilla::Install::
Util
qw(
display
_version_and_os)
;
use
Bugzilla::Install::
Util
qw(
install_string get
_version_and_os)
;
local
$|
=
1
;
my
$cgi
=
new
CGI
;
$cgi
->
charset
(
'UTF-8'
);
print
$cgi
->
header
(
-
type
=>
'text/plain'
);
print
$cgi
->
header
();
print
install_string
(
'header'
,
get_version_and_os
());
display_version_and_os
();
######################
# Check Requirements #
######################
print
'<pre>'
;
my
$module_results
=
check_requirements
(
1
);
Bugzilla::Install::Requirements::
print_module_instructions
(
$module_results
,
1
);
print
'</pre>'
;
print
install_string
(
'footer'
);
\ No newline at end of file
template/en/default/setup/strings.html.pl
0 → 100644
View file @
e00a2bc8
# 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 Initial Developer of the Original Code is Everything Solved.
# Portions created by Everything Solved are Copyright (C) 2007
# Everything Solved. All Rights Reserved.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
# This is just like strings.txt.pl, but for HTML templates (used by
# setup.cgi).
%
strings
=
(
footer
=>
"</div></body></html>"
,
# This is very simple. It doesn't support the skinning system.
header
=>
<<END_HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Installation and Setup for Bugzilla ##bz_ver##</title>
<link href="skins/standard/global.css" rel="stylesheet" type="text/css" />
</head>
<body id="bugzilla-installation">
<h1>Installation and Setup for Bugzilla ##bz_ver##</h1>
<div id="bugzilla-body">
<p><strong>Perl Version</strong>: ##perl_ver##</p>
<p><strong>OS</strong>: ##os_name## ##os_ver##</p>
END_HTML
,
);
1
;
template/en/default/setup/strings.txt.pl
View file @
e00a2bc8
# 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 Initial Developer of the Original Code is Everything Solved.
# Portions created by Everything Solved are Copyright (C) 2007
# Everything Solved. All Rights Reserved.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
# This file contains a single hash named %strings, which is used by the
# installation code to display strings before Template-Toolkit can safely
# be loaded.
...
...
@@ -9,7 +27,7 @@
# Please keep the strings in alphabetical order by their name.
%
strings
=
(
version_and_os
=>
"* This is Bugzilla ##bz_ver## on perl ##perl_ver##\n"
header
=>
"* This is Bugzilla ##bz_ver## on perl ##perl_ver##\n"
.
"* Running on ##os_name## ##os_ver##"
,
);
...
...
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