|
Revision 282, 0.7 kB
(checked in by ogawa, 22 months ago)
|
|
Just a little bit fix to avoid removing entry archives when there's no individual entry archive template.
|
-
Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 | # DeleteAndRebuild |
|---|
| 2 | # |
|---|
| 3 | # $Id$ |
|---|
| 4 | |
|---|
| 5 | package MT::Plugin::DeleteAndRebuild; |
|---|
| 6 | use strict; |
|---|
| 7 | use MT 3.3; |
|---|
| 8 | use base qw(MT::Plugin); |
|---|
| 9 | our $VERSION = '0.01'; |
|---|
| 10 | |
|---|
| 11 | my $plugin = __PACKAGE__->new({ |
|---|
| 12 | name => 'DeleteAndRebuild', |
|---|
| 13 | description => 'A plugin for rebuilding archives related to deleted entry.', |
|---|
| 14 | author_name => 'Hirotaka Ogawa', |
|---|
| 15 | author_link => 'http://profile.typekey.com/ogawa/', |
|---|
| 16 | version => $VERSION, |
|---|
| 17 | callbacks => { 'CMSPostDelete.entry' => \&handler } |
|---|
| 18 | }); |
|---|
| 19 | MT->add_plugin($plugin); |
|---|
| 20 | |
|---|
| 21 | sub handler { |
|---|
| 22 | my ($eh, $app, $obj) = @_; |
|---|
| 23 | $app->rebuild_entry(Entry => $obj, BuildDependencies => 1); |
|---|
| 24 | $app->publisher->remove_entry_archive_file(Entry => $obj, ArchiveType => 'Individual') |
|---|
| 25 | if $app->config('DeleteFilesAtRebuild'); |
|---|
| 26 | } |
|---|