public function testCacheEntryInvalidatedSPARQL()
 {
     smwf_om_EditArticle('QRCQueryArticle1', 'PHPUnit', $this->queryArticle2Version2, '');
     global $wgTitle;
     //todo: delete action does not lead to query invalidation
     $wgTitle = Title::newFromText('QRCDataArticle1');
     smwf_om_DeleteArticle('QRCDataArticle1', 'PHPUnit', '');
     smwf_om_EditArticle('QRCDataArticle1', 'PHPUnit', $this->dataArticle1, '');
     $wgTitle = Title::newFromText('QRCDataArticle2');
     smwf_om_EditArticle('QRCDataArticle2', 'PHPUnit', $this->dataArticle1, '');
     smwf_om_EditArticle('QRCDataArticle2', 'PHPUnit', $this->dataArticle2, '');
     smwf_om_EditArticle('QRCDataArticle2', 'PHPUnit', $this->dataArticle4, '');
     smwf_om_EditArticle('QRCDataArticle2', 'PHPUnit', $this->dataArticle5, '');
     smwf_om_EditArticle('QRCDataArticle2', 'PHPUnit', $this->dataArticle5, '');
     $request = json_encode(array('debug' => true));
     $response = smwf_qc_getQueryIds($request);
     $response = json_decode($response);
     $qrcStore = SMWQRCStore::getInstance()->getDB();
     $qId = $response->queryIds[0];
     $queryData = $qrcStore->getQueryData($qId);
     $this->assertEquals(5, $queryData['invalidationFrequency']);
     $this->assertEquals('1', $queryData['dirty']);
     $request = json_encode(array('debug' => true, 'queryId' => $qId));
     $response = smwf_qc_updateQuery($request);
     $response = json_decode($response);
     $queryData = $qrcStore->getQueryData($qId);
     $this->assertEquals(3, $queryData['invalidationFrequency']);
     $this->assertEquals('0', $queryData['dirty']);
 }
function smwf_ti_deleteTermImport($tiName)
{
    global $wgUser;
    smwf_om_DeleteArticle("TermImport:" . $tiName, $wgUser->getName(), 'Deleted via the WebServiceRepository special page.');
    return $tiName;
}
/**
 * Rename an article. This function is invoked by an ajax call.
 * 
 * @param string $pagename The name of the article.
 * @param string $newpagename The new name of the article.
 * @param string $reason A reason why it was renamed.
 * @param string $user The name of the user who requested this action.
 */
function smwf_om_RenameArticle($pagename, $newpagename, $reason, $user)
{
    $newpagename = strip_tags($newpagename);
    if ($newpagename == '') {
        return "false";
    }
    if (smwf_om_userCan($pagename, 'move') === "false") {
        return "false,denied,{$pagename}";
    }
    $titleObj = Title::newFromText($pagename);
    $newTitleObj = Title::newFromText($newpagename);
    $success = false;
    if ($titleObj->exists() && !$newTitleObj->exists()) {
        $success = $titleObj->moveTo($newTitleObj, true, $reason);
        $dummyForm = "";
        wfRunHooks('SpecialMovepageAfterMove', array(&$dummyForm, &$titleObj, &$newTitleObj));
    } else {
        if (smwf_om_IsRedirect($newTitleObj)) {
            // target is redirect, so delete first
            smwf_om_DeleteArticle($newTitleObj->getPrefixedText(), "redirectrename", "Target is redirect");
            $success = $titleObj->moveTo($newTitleObj, true, $reason);
            $dummyForm = "";
            wfRunHooks('SpecialMovepageAfterMove', array(&$dummyForm, &$titleObj, &$newTitleObj));
        }
    }
    return $success === true ? "true" : "false";
}