Exemplo n.º 1
0
$numRows = mysql_num_rows($dbResult);
$i = 0;
while ($dbRow = mysql_fetch_assoc($dbResult)) {
    $i++;
    print "{$i}/{$numRows} definitions unassociated...\n";
    $def = new Definition();
    $def->populateFromDbRow($dbRow);
    $cdms = ConceptDefinitionMap::loadByDefinitionId($def->id);
    foreach ($cdms as $cdm) {
        $cdm->delete();
    }
}
mysql_free_result($dbResult);
// Go through all the unassociated concepts (that have become unassociated
// during the above step) and delete them and their Words.
$concepts = Concept::loadUnassociated();
$i = 0;
foreach ($concepts as $concept) {
    $i++;
    print "Deleting concept {$i}/" . count($concepts) . "\n";
    $concept->delete();
}
return;
// When merging n words with Priority = 0 and equals Names into one
// word, we'll end up deleting n-1 words. If those words have DeclensionModels,
// transfer those to the one word that we keep. However, make sure not to
// create several DeclensionModels with the same WordId and PartOfSpeechId.
function migrateDeclensionModels($oldWordId, $newWordId)
{
    $oldDmList = DeclensionModel::loadByWordId($oldWordId);
    $newDmList = DeclensionModel::loadByWordId($newWordId);