gitlab-org--gitlab-foss/app/services/projects/destroy_service.rb

29 lines
711 B
Ruby
Raw Normal View History

2014-06-17 14:53:26 -04:00
module Projects
2014-06-17 16:49:17 -04:00
class DestroyService < BaseService
def execute
2014-06-17 14:53:26 -04:00
return false unless can?(current_user, :remove_project, project)
2014-06-17 16:49:17 -04:00
project.team.truncate
2014-06-17 14:53:26 -04:00
project.repository.expire_cache unless project.empty_repo?
if project.destroy
GitlabShellWorker.perform_async(
:remove_repository,
project.path_with_namespace
)
GitlabShellWorker.perform_async(
:remove_repository,
project.path_with_namespace + ".wiki"
)
project.satellite.destroy
log_info("Project \"#{project.name}\" was removed")
2014-06-17 15:20:10 -04:00
system_hook_service.execute_hooks_for(project, :destroy)
true
2014-06-17 14:53:26 -04:00
end
end
end
end