From: Robert Stojnić Date: Thu, 3 Apr 2008 15:09:56 +0000 (+0000) Subject: Suboptimal solution for one of the issues behind bug 12049 (i.e. that X-Git-Tag: 1.31.0-rc.0~48643 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=b4dff524096696ae345a0005fb99e16ce00ef9f9;p=lhc%2Fweb%2Fwiklou.git Suboptimal solution for one of the issues behind bug 12049 (i.e. that don't get deleted from search index) : * hooks ArticleDelete[Complete] are now called from FileDeleteForm as well, this seems to be the expected behavior by most extensions (OAI, TitleKey, Rsync, ...). * delete via API however still misses these hooks Other possible solutions: * move hooks into backend - bad since we want a clean backend * create FileDelete hook (per bug 11276) - seems to me as unnecessary duplication of code logic since article might or might not be deleted during file deletion * make a new Article function and wrap calls - will pollute clean Article doDelete and doDeleteArticle calls --- diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index 8a6f058884..8d6fc9ae2a 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -91,8 +91,11 @@ class FileDeleteForm { $status = $this->file->delete( $reason, $suppress ); if( $status->ok ) { // Need to delete the associated article - $article = new Article( $this->title ); - $article->doDeleteArticle( $reason, $suppress ); + $article = new Article( $this->title ); + if( wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason)) ){ + if( $article->doDeleteArticle( $reason, $suppress ) ) + wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason)); + } } } if( $status->isGood() ) wfRunHooks('FileDeleteComplete', array(