Esempio n. 1
0
<?php

require_once "../../phplib/util.php";
ini_set('max_execution_time', '3600');
assert_options(ASSERT_BAIL, 1);
debug_off();
$mdnSrc = Source::load(21);
$query = "select * from Definition where SourceId = 21 and Status = 0 " . "order by InternalRep, Id";
$defs = Definition::populateFromDbResult(mysql_query($query));
$idsToDelete = array();
foreach ($defs as $i => $d) {
    if ($i) {
        $prev = $defs[$i - 1];
        if (trim($d->internalRep) == trim($prev->internalRep)) {
            print "Deleting extra definition for {$prev->lexicon}\n";
            $idsToDelete[] = $d->id;
        }
    }
}
foreach ($idsToDelete as $id) {
    assert(mysql_query("delete from Comment where DefinitionId = {$id}"));
    assert(mysql_query("delete from LexemDefinitionMap where DefinitionId = {$id}"));
    assert(mysql_query("delete from Definition where Id = {$id}"));
}
Esempio n. 2
0
function loadDefinitions($lexemId)
{
    $query = "select Definition.* from Definition, LexemDefinitionMap " . "where Definition.Id = LexemDefinitionMap.DefinitionId " . "and LexemDefinitionMap.LexemId = {$lexemId} " . "and Status = 0 " . "and SourceId in (1,2,3,4,5,17,21)";
    //    "and SourceId not in (7, 12)";
    $dbResult = mysql_query($query);
    return Definition::populateFromDbResult($dbResult);
}
Esempio n. 3
0
function loadExistingMapByLexicon()
{
    $result = array();
    $query = "select * from Definition where SourceId = 21 and Status = 0";
    $defs = Definition::populateFromDbResult(mysql_query($query));
    foreach ($defs as $def) {
        $l = $def->lexicon;
        if (array_key_exists($l, $result)) {
            $result[$l][] = $def;
        } else {
            $result[$l] = array($def);
        }
    }
    return $result;
}