Exemple #1
0
function smwfDIInitializeTables()
{
    global $smwgDIIP;
    require_once $smwgDIIP . '/specials/WebServices/SMW_WebServiceManager.php';
    WebServiceManager::initDatabaseTables();
    require_once $smwgDIIP . '/specials/Materialization/SMW_MaterializationStorageAccess.php';
    $dbAccess = SMWMaterializationStorageAccess::getInstance();
    $db = $dbAccess->getDatabase();
    $db->setup(true);
    return true;
}
/**
 * method is called in the article save complete and
 * the delete hook. it checks for saved materializations
 * which can be removed from the database
 * 
 * @param $articleId
 */
function materializePF_updateDB($articleId)
{
    global $wgsmwRememberedMaterializations;
    $dbAccess = SMWMaterializationStorageAccess::getInstance();
    $db = $dbAccess->getDatabase();
    $savedMaterializations = $db->getCallHashes($articleId);
    foreach ($savedMaterializations as $sourceHash => $dontCare) {
        if (!array_key_exists($sourceHash, $wgsmwRememberedMaterializations)) {
            $db->deleteMaterializationHash($articleId, $sourceHash);
        }
    }
    $wgsmwRememberedMaterializations = array();
}