-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete initial set
- Loading branch information
Showing
8 changed files
with
323 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
class PurgerPlugin extends MantisPlugin { | ||
|
||
function register() { | ||
$this->name = lang_get( 'plugin_Purger_name' ); | ||
$this->description = lang_get( 'plugin_Purger_description' ); | ||
$this->version = '1.0.0'; | ||
$this->requires = array('MantisCore' => '2.0.0',); | ||
$this->author = 'Cas Nuy'; | ||
$this->contact = 'Cas-at-nuy.info'; | ||
$this->url = 'https://github.com/mantisbt-plugins/Purger'; | ||
$this->page = 'config'; | ||
} | ||
|
||
function config() { | ||
return array( | ||
'manage_threshold' => ADMINISTRATOR, | ||
'status' => 90, | ||
); | ||
} | ||
|
||
function init() { | ||
plugin_event_hook( 'EVENT_MENU_MANAGE', 'purge_them' ); | ||
} | ||
|
||
function purge_them() { | ||
return array( '<a href="' . plugin_page( 'purge_issues' ) . '">' . lang_get( 'plugin_Purger_manage' ) . '</a>', ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,47 @@ | ||
# Purger | ||
# Purgerplugin for Mantisbt | ||
Plugin that allows to purge issues based upon age/status | ||
|
||
Version 1.0.0 | ||
Copyright 2024 Cas Nuy | ||
|
||
## description | ||
|
||
This plugin will purge issues in bul so one does not need to use a tool like phpMyAdmin.<br> | ||
Just define the minimum Status the issues should have and give the date untill when all issues should be purged.<br> | ||
It will take into account the project selction made in Mantis itself.<br> | ||
NB<br> | ||
If you have not selected a specific project, it will review ALL issues.<br> | ||
If you select a project, it will also review the child projects.<br> | ||
|
||
## Requirements | ||
|
||
Mantis 2.x | ||
|
||
## Installation | ||
|
||
Copy the Purger directory into the plugins folder of your installation.<br> | ||
After copying to your webserver:<br> | ||
- Start Mantis as administrator<br> | ||
- Select manage<br> | ||
- Select manage Plugins<br> | ||
- Select Install behind Purger 1.0.0<br> | ||
- Click on the plugin name for further configuration (se below)<br> | ||
|
||
|
||
## Configuration | ||
|
||
- Set lifetime of the Captcha image (default = 60) | ||
- Set length of the Captcha text (default = 5 | ||
|
||
## License | ||
|
||
Released under the [GPL v3 license](http://opensource.org/licenses/GPL-3.0). | ||
|
||
|
||
## Support | ||
|
||
Please visit https://github.com/mantisbt-plugins/Purger | ||
|
||
## Changes | ||
|
||
Version 1.0.0 31-03-2024 Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?PHP | ||
$s_plugin_Purger_name = "Purger issues Plugin"; | ||
$s_plugin_Purger_description = "Purge issues based upon age & status"; | ||
$s_plugin_Purger_manage = "Purge Issues"; | ||
$s_plugin_Purger_threshold = "Minimum level required"; | ||
$s_plugin_Purger_go = "Start Purge Process"; | ||
$s_plugin_Purger_age = "Purge until date: "; | ||
$s_plugin_Purger_status = "Minimum current status for Purge: "; | ||
$s_plugin_Purger_continue = "Please confirm to start purging"; | ||
$s_plugin_Purger_ok = "Purge!"; | ||
$s_plugin_Purger_export = "Use the ZipExport plugin to secure the data you are about to purge"; | ||
$s_plugin_Purger_getit = "Go get that plugin"; | ||
$s_plugin_Purger_backup = "<b><i>Please do make backup of your database before continuing</i></b>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
auth_reauthenticate(); | ||
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); | ||
layout_page_header( lang_get( 'plugin_Purger_name' ) ); | ||
layout_page_begin( 'config_page.php' ); | ||
print_manage_menu(); | ||
?> | ||
|
||
<div class="col-md-12 col-xs-12"> | ||
<div class="space-10"></div> | ||
<div class="form-container" > | ||
<div class="widget-box widget-color-blue2"> | ||
|
||
<div class="widget-header widget-header-small"> | ||
<h4 class="widget-title lighter"> | ||
<i class="ace-icon fa fa-text-width"></i> | ||
<?php echo lang_get( 'plugin_query_name' ).': ' . lang_get( 'plugin_format_config' )?> | ||
</h4> | ||
</div> | ||
<div class="widget-body"> | ||
<div class="widget-main no-padding"> | ||
<div class="table-responsive"> | ||
<table class="table table-bordered table-condensed table-striped"> | ||
<form action="<?php echo plugin_page( 'config_edit' ) ?>" method="post"> | ||
|
||
<tr > | ||
<td class="category"> | ||
<?php echo lang_get( 'plugin_Purger_threshold' ) ?> | ||
</td> | ||
<td class="category"> | ||
<select name="manage_threshold"> | ||
<?php print_enum_string_option_list( 'access_levels', plugin_config_get( 'manage_threshold' ) ) ?>; | ||
</select> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td class="category"> | ||
<?php echo lang_get( 'plugin_Purger_status' ); ?> | ||
</td> | ||
<td class="category"> | ||
<select name="status"> | ||
<?php print_enum_string_option_list( 'status', plugin_config_get( 'status' ) ) ?>; | ||
</select> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td class="center" colspan="3"> | ||
<input type="submit" class="button" value="<?php echo lang_get( 'change_configuration' ) ?>" /> | ||
</td> | ||
</tr> | ||
</table> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<?php | ||
layout_page_end( ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
// authenticate | ||
auth_reauthenticate(); | ||
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); | ||
// Read results | ||
$f_manage_threshold = gpc_get_int( 'manage_threshold', [ADMINISTRATOR] ); | ||
// update results | ||
plugin_config_set( 'manage_threshold', $f_manage_threshold ); | ||
// redirect | ||
print_header_redirect( plugin_page( 'config',TRUE ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
auth_reauthenticate(); | ||
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); | ||
layout_page_header( lang_get( 'plugin_format_title' ) ); | ||
layout_page_begin(); | ||
print_manage_menu(); | ||
$t_date_format = config_get( 'normal_date_format' ); | ||
$project_id = helper_get_current_project(); | ||
$project_name = project_get_name( $project_id ); | ||
$t_status = plugin_config_get( 'status' ) | ||
?> | ||
<div class="col-md-12 col-xs-12"> | ||
<div class="space-10"></div> | ||
<div class="form-container" > | ||
|
||
<div class="widget-box widget-color-blue2"> | ||
<div class="widget-header widget-header-small"> | ||
<h4 class="widget-title lighter"> | ||
<i class="ace-icon fa fa-text-width"></i> | ||
<?php echo lang_get( 'plugin_Purger_name' ).': ' . lang_get( 'plugin_Purger_manage' ).': ' . lang_get( 'project' ) .': '. $project_name?> | ||
</h4> | ||
</div> | ||
<div class="widget-body"> | ||
<div class="widget-main no-padding"> | ||
<div class="table-responsive"> | ||
<table class="table table-bordered table-condensed table-striped"> | ||
|
||
<form action="<?php echo plugin_page( 'start_purging' ) ?>" method="post"> | ||
|
||
<tr> | ||
<td class="category"> | ||
<?php echo lang_get( 'plugin_Purger_age' ); ?> | ||
</td> | ||
<td> | ||
<?PHP | ||
$t_date_to_display = date($t_date_format); | ||
echo '<input ' . helper_get_tab_index() . ' type="text" id="purge_date" name="purge_date" class="datetimepicker input-sm" ' . | ||
'data-picker-locale="' . lang_get_current_datetime_locale() . | ||
'" data-picker-format="' . config_get( 'datetime_picker_format' ) . '" ' . | ||
'size="20" maxlength="16" value="' . $t_date_to_display . '" />' ?> | ||
<i class="fa fa-calendar fa-xlg datetimepicker"></i> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td class="category"> | ||
<?php echo lang_get( 'plugin_Purger_status' ); ?> | ||
</td> | ||
<td class="category"> | ||
<select name="status"> | ||
<?php print_enum_string_option_list( 'status', plugin_config_get( 'status' ) ) ?>; | ||
</select> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td class="center" colspan="2"> | ||
<?php | ||
echo lang_get( 'plugin_Purger_backup' ) ; | ||
?> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td class="center" colspan="2"> | ||
<input type="submit" class="button" value="<?php echo lang_get( 'plugin_Purger_go' ) ?>" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td class="category"2" > | ||
<?php | ||
echo lang_get( 'plugin_Purger_export' ) ; | ||
?> | ||
</td> | ||
<td> | ||
<?php | ||
$link = "https://github.com/mantisbt-plugins/ZipExport"; | ||
print_link_button( $link, lang_get( 'plugin_Purger_getit' ),'',true ); | ||
?> | ||
</td | ||
</tr> | ||
</form> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<?php | ||
layout_page_end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?PHP | ||
# MantisBT - A PHP based bugtracking system | ||
|
||
# MantisBT is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# MantisBT is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* ZIP export page | ||
* | ||
* @package MantisBT | ||
* @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org | ||
* @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net | ||
* @link http://www.mantisbt.org | ||
* | ||
* @uses core.php | ||
* @uses authentication_api.php | ||
* @uses bug_api.php | ||
* @uses columns_api.php | ||
* @uses config_api.php | ||
* @uses excel_api.php | ||
* @uses file_api.php | ||
* @uses filter_api.php | ||
* @uses gpc_api.php | ||
* @uses helper_api.php | ||
* @uses print_api.php | ||
* @uses utility_api.php | ||
*/ | ||
require_once( 'core.php' ); | ||
require_api( 'authentication_api.php' ); | ||
require_api( 'bug_api.php' ); | ||
require_api( 'columns_api.php' ); | ||
require_api( 'config_api.php' ); | ||
require_api( 'excel_api.php' ); | ||
require_api( 'file_api.php' ); | ||
require_api( 'filter_api.php' ); | ||
require_api( 'gpc_api.php' ); | ||
require_api( 'helper_api.php' ); | ||
require_api( 'print_api.php' ); | ||
require_api( 'utility_api.php' ); | ||
auth_ensure_user_authenticated(); | ||
$project_id = helper_get_current_project(); | ||
$specific_where = helper_project_specific_where( $project_id ); | ||
$t_status = $_REQUEST['status']; | ||
$t_purgedate = strtotime($_REQUEST['purge_date']); | ||
// first get confirmation | ||
helper_ensure_confirmed( lang_get( 'plugin_Purger_continue' ), lang_get( 'plugin_Purger_ok' ) ); | ||
// now let's do the actual purge of issues | ||
$query = "select id from {bug} where $specific_where and status >= $t_status and last_updated <= $t_purgedate"; | ||
$result = db_query($query); | ||
while ($row = db_fetch_array($result)) { | ||
$t_bug_id = $row[ 'id' ]; | ||
$t_data = array( 'query' => array( 'id' => $t_bug_id ) ); | ||
$t_command = new IssueDeleteCommand( $t_data ); | ||
$t_command->execute(); | ||
} | ||
|
||
print_header_redirect( plugin_page( 'purge_issues',TRUE ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Version: 1.0.0# | ||
Devurl: https://github.com/mantisbt-plugins/Purger/blob/main/version.txt # | ||
Location: https://github.com/mantisbt-plugins/Purger/archive/refs/heads/main.zip # |