Skip to content

Commit

Permalink
Remove patch that is no longer needed in RT 5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
craigkai committed Dec 18, 2020
1 parent 4830429 commit 7480fcc
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 43 deletions.
4 changes: 3 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Changes
html/Callbacks/RT-Extension-ToggleTheme/Elements/Header/MassageCSSFiles
html/Callbacks/RT-Extension-ToggleTheme/Elements/Tabs/Privileged
html/Callbacks/RT-Extension-ToggleTheme/Elements/Tabs/SelfService
html/Helpers/Toggle/Theme
inc/Module/Install.pm
inc/Module/Install/Base.pm
Expand All @@ -19,7 +20,8 @@ lib/RT/Extension/ToggleTheme.pm
Makefile.PL
MANIFEST This list of files
META.yml
patches/header-callback.patch
README
README.md
static/images/demo.gif
static/js/fontawesome-icons.js
static/js/themes.js
4 changes: 2 additions & 2 deletions META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ requires:
perl: 5.10.1
resources:
repository: https://github.com/craigkai/rt-extension-toggletheme
version: '0.01'
x_module_install_rtx_version: '0.41'
version: '0.02'
x_module_install_rtx_version: '0.42'
x_requires_rt: 5.0.0
x_rt_too_new: 5.2.0
6 changes: 2 additions & 4 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ NAME
RT-Extension-ToggleTheme - Toggle elevator light and dark theme.

DESCRIPTION
To save your eyes in the dark.
To save your eyes in the dark. The theme toggle button only displays for
users who have the ModifySelf right.

RT VERSION
Works with RT 5
Expand All @@ -18,9 +19,6 @@ INSTALLATION

Plugin('RT::Extension::ToggleTheme');

Apply patch to RT5
patch -d /opt/r5 -p1 < patches/header-callback.patch

Clear your mason cache
rm -rf /opt/rt5/var/mason_data/obj

Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ users who have the ModifySelf right.

##### May need root permissions

##### Edit your /opt/rt4/etc/RT_SiteConfig.pm
##### Edit your /opt/rt5/etc/RT_SiteConfig.pm

##### Add this line:

Plugin('RT::Extension::ToggleTheme');

##### Apply patch to RT5

patch -d /opt/r5 -p1 < patches/header-callback.patch

##### Clear your mason cache

rm -rf /opt/rt5/var/mason_data/obj
Expand Down
34 changes: 25 additions & 9 deletions inc/Module/Install/RTx.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ use strict;
use warnings;
no warnings 'once';

use Term::ANSIColor qw(:constants);
use Module::Install::Base;
use base 'Module::Install::Base';
our $VERSION = '0.41';
our $VERSION = '0.42';

use FindBin;
use File::Glob ();
Expand Down Expand Up @@ -76,6 +77,22 @@ sub RTx {
$self->requires_rt('4.0.0');
}

my $package = $name;
$package =~ s/-/::/g;
if ( $RT::CORED_PLUGINS{$package} ) {
my ($base_version) = $RT::VERSION =~ /(\d+\.\d+\.\d+)/;
die RED, <<"EOT";
**** Error: Your installed version of RT ($RT::VERSION) already
contains this extension in core, so you don't need to
install it.
Check https://docs.bestpractical.com/rt/$base_version/RT_Config.html
to configure it.
EOT
}

# Installation locations
my %path;
my $plugin_path;
Expand Down Expand Up @@ -223,7 +240,7 @@ sub requires_rt {
my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;

if ($sorted[-1] eq $version) {
die <<"EOT";
die RED, <<"EOT";
**** Error: This extension requires RT $version. Your installed version
of RT ($RT::VERSION) is too old.
Expand All @@ -249,12 +266,12 @@ sub requires_rt_plugin {
unshift @INC, $path;
} else {
my $name = $self->name;
warn <<"EOT";
my $msg = <<"EOT";
**** Warning: $name requires that the $plugin plugin be installed and
enabled; it does not appear to be installed.
EOT
warn RED, $msg, RESET, "\n";
}
$self->requires(@_);
}
Expand All @@ -264,17 +281,16 @@ sub rt_too_new {
my $name = $self->name;
$msg ||= <<EOT;
**** Error: Your installed version of RT (%s) is too new; this extension
only works with versions older than %s.
**** Warning: Your installed version of RT (%s) is too new; this extension
has not been tested on your version of RT and may not work as expected.
EOT
$self->add_metadata("x_rt_too_new", $version) if $self->is_admin;

_load_rt_handle();
my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;

if ($sorted[0] eq $version) {
die sprintf($msg,$RT::VERSION,$version);
warn RED, sprintf($msg,$RT::VERSION), RESET, "\n";
}
}

Expand All @@ -297,4 +313,4 @@ sub _load_rt_handle {

__END__
#line 468
#line 484
4 changes: 0 additions & 4 deletions lib/RT/Extension/ToggleTheme.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ Add this line:
Plugin('RT::Extension::ToggleTheme');
=item Apply patch to RT5
patch -d /opt/r5 -p1 < patches/header-callback.patch
=item Clear your mason cache
rm -rf /opt/rt5/var/mason_data/obj
Expand Down
18 changes: 0 additions & 18 deletions patches/header-callback.patch

This file was deleted.

0 comments on commit 7480fcc

Please sign in to comment.