public static function articleDeleteHook(&$article, &$user, $reason) { if ($article->getTitle()->getNamespace() != SMW_NS_WEB_SERVICE) { return true; } $ws = WebService::newFromID($article->getID()); if ($ws) { //triplification processing global $smwgDIIP; require_once $smwgDIIP . "/specials/WebServices/SMW_WSTriplifier.php"; //deal with triplification $articles = WSStorage::getDatabase()->getWSArticles($article->getID(), new SMWRequestOptions()); WSTriplifier::getInstance()->removeWS($article->getID(), $articles); WebServiceCache::removeWS($ws->getArticleID()); $options = new SMWRequestOptions(); $pageIds = WSStorage::getDatabase()->getWSArticles($ws->getArticleID(), $options); foreach ($pageIds as $articleId) { $usedWSs = WSStorage::getDatabase()->getWSsUsedInArticle($articleId); foreach ($usedWSs as $usedWS) { if ($usedWS[0] == $ws->getArticleID()) { WSStorage::getDatabase()->removeWSArticle($ws->getArticleID(), $usedWS[1], $articleId); $parameterSetIds = WSStorage::getDatabase()->getUsedParameterSetIds($usedWS[1]); if (sizeof($parameterSetIds) == 0) { WSStorage::getDatabase()->removeParameterSet($usedWS[1]); } } } } $ws->removeFromDB(); } self::$mNewWebService = null; self::$mOldWebservice = null; return true; }