Skip to content

Commit

Permalink
改進 table-build.php 處理錯誤的方法
Browse files Browse the repository at this point in the history
新安裝時,table-build.php 的 drop table 指令執行失敗,結果阻礙程式進行。

修改後會偵測錯誤訊息,若果屬於 Unknown Table,則會自動無視。
  • Loading branch information
yookoala committed Jan 7, 2015
1 parent fff9367 commit b73989a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions webdata/scripts/table-build.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@
$p = pathinfo($m);
$o = new $p['filename'];
if($o instanceof Pix_Table) {
$o->dropTable();
try {
$o->dropTable();
} catch (Pix_Table_Exception $e) {
echo 'Unable to drop table "'.$p['filename'].'". ';
if (preg_match('/^Table: \w+SQL Error: \(1051\)Unknown table/',
$e->getMessage())) {
echo 'Table missing. Ignored.'."\n";
} else {
echo "\n";
die($e->getMessage());
}
}
$o->createTable();
}
}
}

0 comments on commit b73989a

Please sign in to comment.