mirror of
https://github.com/typecho/typecho.git
synced 2025-01-17 04:28:17 +01:00
Fix pgsql reset id error (#1369)
This commit is contained in:
parent
7ebfe82de1
commit
c78f7fda68
@ -189,7 +189,12 @@ class Backup extends BaseOptions implements ActionInterface
|
||||
if (!empty($_FILES)) {
|
||||
$file = array_pop($_FILES);
|
||||
|
||||
if (0 == $file['error'] && is_uploaded_file($file['tmp_name'])) {
|
||||
if(UPLOAD_ERR_NO_FILE == $file['error']) {
|
||||
Notice::alloc()->set(_t('没有选择任何备份文件'), 'error');
|
||||
$this->response->goBack();
|
||||
}
|
||||
|
||||
if (UPLOAD_ERR_OK == $file['error'] && is_uploaded_file($file['tmp_name'])) {
|
||||
$path = $file['tmp_name'];
|
||||
} else {
|
||||
Notice::alloc()->set(_t('备份文件上传失败'), 'error');
|
||||
@ -270,7 +275,7 @@ class Backup extends BaseOptions implements ActionInterface
|
||||
}
|
||||
|
||||
// 针对PGSQL重置计数
|
||||
if (false !== strpos($this->db->getVersion(), 'pgsql')) {
|
||||
if (false !== strpos(strtolower($this->db->getAdapterName()), 'pgsql')) {
|
||||
foreach ($this->lastIds as $table => $id) {
|
||||
$seq = $this->db->getPrefix() . $table . '_seq';
|
||||
$this->db->query('ALTER SEQUENCE ' . $seq . ' RESTART WITH ' . ($id + 1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user