Project

General

Profile

Delete project plugin

Added by Anthony Paul almost 14 years ago

Hi all,

I wrote a plugin which adds an ACL to allow non-admin users to delete their projects.
Note that until you configure the settings, this plugin won't actually delete any project.

http://www.redmine.org/wiki/redmine/Plugin_List#Delete-Project-plugin

  • First of all, unarchive the .tar.gz file in ${REDMINE_ROOT}/vendor/plugins/
  • Restart Redmine
  • As an admin, check the box "Delete project" in Roles & Permissions (ie for the Manager profile)
  • Still as an admin, in the plugin info page, click "configure" in front of "Delete project", then you could set different settings:
    - Really delete the project from the database or set a special status (default is 1001)
    - Make a 'chmod 000' on the repository (tested only with SVN under Linux)

Tested with Redmine 0.9.3, packaged version for Debian Squeeze (testing).


Replies (22)

RE: Delete project plugin - Added by Luis Serrano Aranda almost 13 years ago

I think it is better modify the 16 line in the delete project controller

from
res= Project.find_by_sql("SELECT * FROM projects WHERE parent_id=#{project_id}")
to
res= Project.find_by_sql("SELECT * FROM projects WHERE (parent_id=#{project_id} and status!=1001)")

Whit this option is it possible "delete-hidden" project with "deleted-hiddens" subprojects

RE: Delete project plugin - Added by Luis Serrano Aranda almost 13 years ago

It's better add this lines

from
res= Project.find_by_sql("SELECT * FROM projects WHERE parent_id=#{project_id}")
to
status_number= Setting['plugin_redmine_delete_project']['status_number'].to_i
res= Project.find_by_sql("SELECT * FROM projects WHERE (parent_id=#{project_id} and status!=#{status_number})")

RE: Delete project plugin - Added by Anthony Paul almost 13 years ago

Hello Luis, and thank you for the feedback,

I totally didn't think about this (sorry!) so I really appreciate your notice.

I have patched this plugin which is now on version 0.0.4 and available here:
http://anthony.perso.info.unicaen.fr/redmine_delete_project/redmine_delete_project.tar.gz

Thanks!!

PS: I thank you in a commented line of the controller, so if you want I remove your name, let me know...

RE: Delete project plugin - Added by Robert Mavrinac about 12 years ago

In config/locales/*.yml:

{{ok}} should be %{ok}
and {{dead_project}} should be %{dead_project}

RE: Delete project plugin - Added by Luis Serrano Aranda almost 12 years ago

I think a good option are add to the plugin the posibility to delete from the disk the projects deleted with this plugin project (from a updated data) or watch this projects inside the project administration menu and deleted from it.

RE: Delete project plugin - Added by Anthony Paul almost 12 years ago

Thank you all for the feeback!
Unfortunately, I've changed my job recently, and I have no redmine instance at my new job, so right now, I'm not able (no time...) to improve this plugin... :(

RE: Delete project plugin - Added by Luis Serrano Aranda almost 12 years ago

Thanks Antonhy, if I have time I try to do

RE: Delete project plugin - Added by Brad Rushworth almost 12 years ago

If anyone has problems with this plugin after upgrading to Redmine 1.4, go to #9778.

RE: Delete project plugin - Added by Cyril Lamy over 11 years ago

Does anyone have this plugin working with redmine 2.x.x ?

RE: Delete project plugin - Added by Brad Rushworth over 11 years ago

The original download location for this plugin seems to have disappeared. I have provided a URL mirror:

RE: Delete project plugin - Added by Koji Chikamoto about 11 years ago

I fixed it work with my redmine-2.2.0 environment.
Please try.

Note: I also made delete_project as a project module, because people can delete the project uneasily.

RE: Delete project plugin - Added by Brad Rushworth almost 11 years ago

Koji Chikamoto wrote:

I fixed it work with my redmine-2.2.0 environment.
Please try.

I've tried this with Redmine 2.3 and it sort of works however it causes my Roadmap and News pages to return 404 errors whenever the Delete Project module is activated.

Any ideas how to fix this?

Started GET "/projects/hosted-redmine/roadmap" for xxx at 2013-06-01 16:21:13 +1000
Processing by VersionsController#index as HTML
  Parameters: {"project_id"=>"hosted-redmine"}
  Current user: xxx
  Rendered versions/_overview.html.erb (20.8ms)
  Rendered versions/_overview.html.erb (12.1ms)
  Rendered versions/index.html.erb within layouts/base (83.9ms)
Completed 500 Internal Server Error in 228ms

ActionController::RoutingError (No route matches {:project_id=>#<Project id: 1, name: "HostedRedmine.com Support", description: "This is the \"HostedRedmine.com\":http://www.hostedre...", homepage: "", is_public: true, parent_id: nil, created_on: "2010-03-26 13:03:00", updated_on: "2011-06-09 08:47:06", identifier: "hosted-redmine", status: 1, lft: 2197, rgt: 2198, inherit_members: false>, :controller=>"delete_project"}):
  lib/redmine/menu_manager.rb:150:in `render_single_menu_node'
  lib/redmine/menu_manager.rb:102:in `render_menu_node'
  lib/redmine/menu_manager.rb:91:in `block in render_menu'
  lib/redmine/menu_manager.rb:168:in `block in menu_items_for'
  lib/redmine/menu_manager.rb:165:in `each'
  lib/redmine/menu_manager.rb:165:in `menu_items_for'
  lib/redmine/menu_manager.rb:90:in `render_menu'
  lib/redmine/menu_manager.rb:80:in `render_main_menu'
  app/views/layouts/base.html.erb:45:in `_app_views_layouts_base_html_erb__2436738832657946533_17243283420'

RE: Delete project plugin - Added by Brad Rushworth almost 11 years ago

Brad Rushworth wrote:

Any ideas how to fix this?

The fix to get the Redmine Delete Project plugin working again is changing plugins/redmine_delete_project/config/routes.rb to:

RedmineApp::Application.routes.draw do
  match 'projects/:project_id/delete_project/:action', :to => 'delete_project', :via => [:get, :post]
end

I was inspired by the following article:

http://blog.engineyard.com/2010/the-lowdown-on-routes-in-rails-3

RE: Delete project plugin - Added by Pierre BLONDEAU over 10 years ago

Hy,

I have make some changes on the plugin to be compatible with redmine 1.4.4 ( on debian wheezy ) and normaly with redmine 2.x but i can't test.
I have add the japanese translation from one archives which is proposed here.

To use with rails3, you must change line 10 in app/views/delete_project/index.html.erb by add "=" after <%

Wikipage : https://forge.greyc.fr/projects/redmine-delete-project/wiki
Repository : https://forge.greyc.fr/projects/redmine-delete-project/repository

Regards

RE: Delete project plugin - Added by Koji Chikamoto over 10 years ago

Hello, Pierre BLONDEAU

Than you very much for your contribution.

You wrote this in the Wikipage shown above, could you show the sql also in your repository?

Active the module in all old project

Load procedure to MySQL and run it :

mysql redmine < vendor/plugins/procedure.sql
mysql redmine -e "call update_project_enable_module ;"

Regards

RE: Delete project plugin - Added by Pierre BLONDEAU over 10 years ago

Sorry,

It's now OK.

Regards

RE: Delete project plugin - Added by Koji Chikamoto over 10 years ago

Thanks, Pierre BLONDEAU

RE: Delete project plugin - Added by Pierre BLONDEAU over 10 years ago

It's works for you ? with which version ?

RE: Delete project plugin - Added by omatrix omatrix over 9 years ago

I just have some little problems with this when I delete a subproject. It deletes the subproject well but I can still see it on overview of the parent project.
I'm using 2.5

RE: Delete project plugin - Added by Pierre BLONDEAU over 9 years ago

I havn't the problem, but I use an older version of redmine. May be there is a cache, that the plugins doesn't clean. Have you try to restart your webserver ?

Regards

RE: Delete project plugin - Added by omatrix omatrix over 9 years ago

Thanks for your reply
I found that the project still exists in the database. I could find it in the projects table of the database. I simply deleted the row from DB and it disappeared from the main project page. there's also other related things that I had to delete manually, like repositories of the project and other things. I also tried to delete a project from administrator panel, in that way all related data of that project removed from database.
Regards

RE: Delete project plugin - Added by Pierre BLONDEAU over 9 years ago

Remember that the plugin don't really remove the project.

It changes only the status ( to 1001 by default ). If you want completely remove it, you should make a cron.

For example in shell. WARNING, 1 -> I didn't test it, mine is more complex , 2 -> This script remove Data :

RRUNNER="/usr/bin/ruby -W0 /usr/share/redmine/script/runner -e production " 
res=`mysql redmine --disable-column-name --batch -e "SELECT identifier FROM projects WHERE status=1001;"`
for p in ${RES} ; do
    ${RRUNNER} "Project.find_by_identifier('${p}').destroy" 
    /bin/rm -Rf /var/svn/${p}
done
    (1-22/22)