Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
best-practical
rt-extension-localdateheader
Commits
d376fe03
Commit
d376fe03
authored
Mar 13, 2014
by
Kevin Falcone
Browse files
Update MIRTx
parent
35d9c151
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
29 deletions
+35
-29
inc/Module/Install/RTx.pm
inc/Module/Install/RTx.pm
+35
-29
No files found.
inc/Module/Install/RTx.pm
View file @
d376fe03
...
...
@@ -8,7 +8,7 @@ no warnings 'once';
use
Module::Install::
Base
;
use
base
'
Module::Install::Base
';
our
$VERSION
=
'
0.32
';
our
$VERSION
=
'
0.32
_02
';
use
FindBin
;
use
File::
Glob
();
...
...
@@ -136,7 +136,9 @@ install ::
$has_etc
{acl}++;
}
if ( -e 'etc/initialdata' ) {
$has_etc
{initialdata}++; }
if ( -d 'etc/upgrade/' ) {
$has_etc
{upgrade}++; }
if ( grep { /
\
d+
\
.
\
d+
\
.
\
d+.*$/ } glob('etc/upgrade/*.*.*') ) {
$has_etc
{upgrade}++;
}
$self
->postamble(
"
$postamble
\
n
"
);
unless (
$subdirs
{'lib'} ) {
...
...
@@ -174,46 +176,50 @@ install ::
}
}
# stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
{ my %word = (
a => -4,
alpha => -4,
b => -3,
beta => -3,
pre => -2,
rc => -1,
head => 9999,
);
sub cmp_version($$) {
my (
$a
,
$b
) = (
@_
);
my
@a
= grep defined, map { /^[0-9]+$/?
$_
: /^[a-zA-Z]+$/?
$word
{
$_
}|| -10 : undef }
split /([^0-9]+)/,
$a
;
my
@b
= grep defined, map { /^[0-9]+$/?
$_
: /^[a-zA-Z]+$/?
$word
{
$_
}|| -10 : undef }
split /([^0-9]+)/,
$b
;
@a
>
@b
? push
@b
, (0) x (
@a
-
@b
)
: push
@a
, (0) x (
@b
-
@a
);
for ( my
$i
= 0;
$i
<
@a
;
$i
++ ) {
return
$a
[
$i
] <=>
$b
[
$i
] if
$a
[
$i
] <=>
$b
[
$i
];
}
return 0;
}}
sub requires_rt {
my (
$self
,
$version
) =
@_
;
# if we're exactly the same version as what we want, silently return
return if (
$version
eq
$RT
::VERSION);
my
@sorted
= sort cmp_version
$version
,
$RT
::VERSION;
_load_rt_handle();
my
@sorted
= sort RT::Handle::cmp_version
$version
,
$RT
::VERSION;
if (
$sorted
[-1] eq
$version
) {
# should we die?
warn
"
\
nWarning:
prerequisite
RT
$version
not
found
.
Your
installed
version
of
RT
(
$
RT::
VERSION
)
is
too
old
.\
n
\
n
"
;
die
"
\
nWarning:
prerequisite
RT
$version
not
found
.
Your
installed
version
of
RT
(
$
RT::
VERSION
)
is
too
old
.\
n
\
n
"
;
}
}
sub rt_too_new {
my (
$self
,
$version
,
$msg
) =
@_
;
$msg
||=
"
Your
version
%s
is
too
new
,
this
extension
requires
a
release
of
RT
older
than
%s
\
n
"
;
_load_rt_handle();
my
@sorted
= sort RT::Handle::cmp_version
$version
,
$RT
::VERSION;
if (
$sorted
[0] eq
$version
) {
die sprintf(
$msg
,
$RT
::VERSION,
$version
);
}
}
# RT::Handle runs FinalizeDatabaseType which calls RT->Config->Get
# On 3.8, this dies. On 4.0/4.2 ->Config transparently runs LoadConfig.
# LoadConfig requires being able to read RT_SiteConfig.pm (root) so we'd
# like to avoid pushing that on users.
# Fake up just enough Config to let FinalizeDatabaseType finish, and
# anyone later calling LoadConfig will overwrite our shenanigans.
sub _load_rt_handle {
unless (
$RT
::Config) {
require RT::Config;
$RT
::Config = RT::Config->new;
RT->Config->Set('DatabaseType','mysql');
}
require RT::Handle;
}
1;
__END__
#line 3
3
6
#line 36
2
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