Esempio n. 1
0
 public function fulfill()
 {
     $number = $this->input->get_post('number');
     $success = FALSE;
     $reason = 'NO_ERROR';
     $this->db->trans_begin();
     $ticket = $this->read_ticket($number, TRUE);
     if ($ticket) {
         $values = array();
         foreach ($ticket['fields'] as $key => $field) {
             $values[$key] = $this->input->get_post($key);
         }
         $ret = make_job($ticket, $values);
         if ($ret == 'SUCCESS') {
             $this->db->where('number', $number)->update('ticket', array('state' => 1, 'fulfill_time' => time()));
             $success = TRUE;
         } else {
             $reason = $ret;
         }
     }
     if (!$success || $this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         $success = FALSE;
     } else {
         $this->db->trans_commit();
     }
     echo json_encode(array('success' => $success, 'reason' => $reason));
 }
function make_jobs($dir, $appid, $calibration)
{
    $batchid = bossa_batch_create($appid, date(DATE_RFC822), $calibration);
    if (!$batchid) {
        exit("bossa_create_batch() failed\n");
    }
    $d = opendir("../user/{$dir}");
    while ($file = readdir($d)) {
        if (!strstr($file, ".png")) {
            continue;
        }
        make_job("{$dir}/{$file}", $batchid, $appid, $calibration);
    }
    closedir($d);
}
/**
 * make (All component)
 */
function run()
{
    global $do_chown, $builds_dir, $tests_path, $user, $jobs_dir, $jobs_tmp_dir;
    foreach (new DirectoryIterator($tests_path) as $d) {
        $name = null;
        $component = null;
        $tests = null;
        $replace_phpunitxml = false;
        if ($d->isDot() || $d->isDir() && in_array($d, array('AllTests', '_files'))) {
            continue;
        }
        if ($d->isFile() && in_array($d->getFileName(), array('DebugTest.php', 'RegistryTest.php', 'VersionTest.php'))) {
            $component = substr($d->getFilename(), 0, -8);
            $tests = "../../tests/Zend/" . $d->getFileName();
            make($component, $tests, $user, $do_chown, true, $component . '.php');
            make_job($component, $builds_dir, $jobs_tmp_dir, $user, $do_chown);
        } else {
            if ($d->getFilename() == 'Service') {
                foreach (new DirectoryIterator($d->getRealpath()) as $s) {
                    if ($s->isDot()) {
                        continue;
                    }
                    $component = "Service" . $s->getFilename();
                    $tests = "../../tests/Zend/Service/" . $s->getFilename();
                    make($component, $tests, $user, $do_chown, false, "Service/" . $s->getFilename());
                    make_job($component, $builds_dir, $jobs_tmp_dir, $user, $do_chown);
                }
            } else {
                $component = $d->getFilename();
                $tests = "../../tests/Zend/" . $d->getFileName();
                make($component, $tests, $user, $do_chown, false, $d->getFilename());
                make_job($component, $builds_dir, $jobs_tmp_dir, $user, $do_chown);
            }
        }
    }
}