예제 #1
0
파일: get.php 프로젝트: pcucurullo/groot
curl_setopt($ch, CURLOPT_URL, $url);
$fp = fopen($dir . "/" . $tempFile, 'w+');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
if ($deleteAppend == "1") {
    \app\models\Database::setDb($db);
    $table = new \app\models\Table($schema . "." . $safeName);
    if (!$table->exits) {
        // If table doesn't exists, when do not try to delete/append
        $o = "-overwrite";
    } else {
        $o = "-append";
        $sql = "DELETE FROM {$schema}.{$safeName}";
        $res = $table->prepare($sql);
        try {
            $res->execute($values);
        } catch (\PDOException $e) {
            // Set the  success of the job to false
            print_r($e);
            \app\models\Database::setDb("gc2scheduler");
            $model = new \app\inc\Model();
            $sql = "UPDATE jobs SET lastcheck=:lastcheck WHERE id=:id";
            $values = array(":lastcheck" => 0, ":id" => $jobId);
            $res = $model->prepare($sql);
            try {
                $res->execute($values);
            } catch (\PDOException $e) {
                print_r($e);
            }