提交 f3815178 编写于 作者: R Ryan Campbell 提交者: Nicolas De Loof

Add a WorkspaceListener extension point

上级 851a999c
......@@ -1761,6 +1761,9 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
FilePath ws = b!=null ? b.getWorkspace() : null;
if (ws!=null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) {
ws.deleteRecursive();
for (WorkspaceListener wl : WorkspaceListener.all()) {
wl.afterDelete(this);
}
return new HttpRedirect(".");
} else {
// If we get here, that means the SCM blocked the workspace deletion.
......
package hudson.model;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
public abstract class WorkspaceListener implements ExtensionPoint {
/**
* Called after a workspace is deleted successfully.
* @param project
*/
public void afterDelete(AbstractProject project) {
}
/**
* All registered {@link WorkspaceListener}s.
*/
public static ExtensionList<WorkspaceListener> all() {
return Hudson.getInstance().getExtensionList(WorkspaceListener.class);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册