Ejemplo n.º 1
0
                $url = $solrCoreUrl . 'dataimport?command=full-import&clean=false';
                $index = curl($url);
                log_task($url);
                log_task($index);
                $log_text .= "Success";
                echo 'Success';
            } else {
                echo 'Error: mysql error';
                $log_text .= "Error: mysql error";
            }
            $log_text .= "\n";
            log_task($log_text);
        }
    } else {
        echo 'Error: not allowed extension';
        log_task('Error: not allowed extension');
    }
} else {
    echo 'Error: file not set';
    log_task('Error: file not set');
}
log_task('\\n\\n---------------------------    FINISH PROCESS    ---------------------------\\n\\n\\n\\n\\n');
function curl($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
Ejemplo n.º 2
0
    $result = mysql_query($query) or die('ERROR INSERTING MEDIA');
    $xml_result = "";
    $query = "SELECT * FROM annotations WHERE id_annotations = " . $id_annotations;
    //lancio della query
    $results = mysql_query($query);
    $num_record = mysql_num_rows($results);
    // controllo l'esito
    if (!$result) {
        print "ERROR INSERTING ANNOTATIONS";
    } else {
        if ($num_record != 0) {
            header("Content-type: text/xml; charset=utf-8");
            // creo l'header xml per il refresh della cache
            $xml_result .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
            $xml_result .= "<response><annotations>";
            while ($row = mysql_fetch_assoc($results)) {
                $xml_result .= "<sourceId>" . $row["id_media"] . "</sourceId>";
                $xml_result .= "<start>" . $row["timepoint"] . "</start>";
                $xml_result .= "<keyword>" . $row["title"] . "</keyword>";
                $xml_result .= "<id>" . $id_annotations . "</id>";
            }
            // chiudo l'xml'
            $xml_result .= "</annotations></response>";
        }
        echo $xml_result;
        log_task("\n" . "XML generato nuovo inserimento: {$xml_result}");
    }
} else {
    print "ERROR SET";
}
fclose($fh);