OJS3.4升级到3.5出错常见问题及处理方法

所属栏目:OJS期刊管理系统 来源: 丁老师原创 更新时间:2025-07-05 09:11 IP属地: 深圳
OJS升级服务
点击阅读全文

OJS当前最新版本为3.5,很多使用OJS3.4.X的同学,在升级时都遇到了或多或少的问题,丁老师几乎每天都收到有关升级失败的咨询。以下是丁老师整理的常见OJS3.4升级3.5的失败问题及处理方法(持续更新中):

Error 1: MariaDB SQL Syntax Incompatibility

ERROR: Upgrade failed: DB: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB 
server version for the right syntax to use near '''' at line 1 (Connection: mysql, SQL: alter table `email_templates_default_data` modify `locale` 
varchar(28) not null default ''en'')

Error 2: Column Rename Conflicts

ERROR: Upgrade failed: DB: SQLSTATE[42S21]: Column already exists: 1060 
Duplicate column name 'redirect_context_id' 
(Connection: mysql, SQL: alter table `site` rename column `redirect` to `redirect_context_id`)

Error 3: Missing Column Dependencies

ERROR: Upgrade failed: DB: SQLSTATE[42S22]: Column not found: 1054 
Unknown column 'context' in 'notification_subscription_settings' 
(Connection: mysql, SQL: alter table `notification_subscription_settings` rename column `context` to `context_id`)

Error 4: Schema Inconsistency

ERROR: Upgrade failed: DB: SQLSTATE[42S22]: Column not found: 1054 
Unknown column 'redirect' in 'site' 
(Connection: mysql, SQL: alter table `site` modify `redirect` bigint null)

Error 5: Schema Inconsistency

ojs upgrade A database error has occurred: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘’‘’ at line 1 (Connection: mysql, SQL: alter table email_templates_default_data modify locale varchar(28) not null default ‘‘en’’)

上述问题是,默认值引用不正确,在MariaDB/Mysql上出现的语法错误,导致在创建或修改表列时,Illuminate Database工具集无法正确转义基于字符串的列默认值,从而引起OJS3.5升级失败。是属于官方程序的一个bug。
解决方法:当提供字符串字面量时,转义应该由Laravel处理。

    /**
     * Format a value so that it can be used in "default" clauses.
     *
     * @param  mixed  $value
     * @return string
     */
    protected function getDefaultValue($value)
    {
        if ($value instanceof Expression) {
            return $this->getValue($value);
        }

        if ($value instanceof BackedEnum) {
            return "'{$value->value}'";
        }

        return is_bool($value)
            ? "'".(int) $value."'"
            : "'".(string) $value."'";
    }

Error 6: Table‘journals’already exists

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘journals’ already exists (Connection: mysql, SQL: create table journals (journal_id bigint not null auto_increment primary key, path varchar(32) not null, seq float(53) not null default ‘0’ comment ‘Used to order lists of journals’, primary_locale varchar(28) not null, enabled smallint not null default ‘1’ comment ‘Controls whether or not the journal is considered "live" and will appear on the website. (Note that disabled journals may still be accessible, but only if the user knows the URL.)’, current_issue_id bigint null) default character set utf8 collate ‘utf8_general_ci’)

Error 7: Table‘invitations’already exists

2025-07-02 15:50:28 [pre-install]
2025-07-02 15:50:28 [load: upgrade.xml]
2025-07-02 15:50:28 [version: 3.5.0.0]
2025-07-02 15:50:28 [code: Installer Installer::checkPhpVersion]
2025-07-02 15:50:28 [code: Installer Installer::installDefaultNavigationMenus]
[02-Jul-2025 15:50:28 UTC] WARNING: The NavigationMenu (ContextId: 1, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
[02-Jul-2025 15:50:28 UTC] WARNING: The NavigationMenu (ContextId: 1, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
[02-Jul-2025 15:50:28 UTC] WARNING: The NavigationMenu (ContextId: , Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
2025-07-02 15:50:28 [code: Installer Installer::migrateStaticPagesToNavigationMenuItems]
2025-07-02 15:50:28 [migration: PKP\migration\upgrade\v3_4_0\I10249_FixProfileImageDataLoss]
2025-07-02 15:50:28 [migration: PKP\migration\upgrade\v3_4_0\I9627_AddUsageStatsTemporaryTablesIndexes]
2025-07-02 15:50:29 [migration: PKP\migration\upgrade\v3_4_0\I9535_FixEmptyFileStage]
2025-07-02 15:50:29 [migration: PKP\migration\upgrade\v3_4_0\I9830_FixEmptyUserLocales]
2025-07-02 15:50:29 [migration: PKP\migration\upgrade\v3_4_0\I8592_SiteNotificationSubscriptions]
2025-07-02 15:50:29 [migration: APP\migration\upgrade\v3_4_0\I9813_QuickSubmitSubmissionProgressType]
2025-07-02 15:50:29 [migration: APP\migration\upgrade\v3_5_0\I11241_MissingDecisionConstantsUpdate]
2025-07-02 15:50:29 [migration: PKP\migration\upgrade\v3_5_0\PreflightCheckMigration]
2025-07-02 15:50:29 [migration: APP\migration\upgrade\v3_5_0\I8333_AddMissingForeignKeys]
2025-07-02 15:50:33 [migration: APP\migration\upgrade\v3_5_0\I9892_FloatToDecimalColumnTypeUpdate]
2025-07-02 15:50:33 [migration: PKP\migration\upgrade\v3_5_0\I9895_AddAppKeyToConfigFile]
2025-07-02 15:50:33 [migration: PKP\migration\upgrade\v3_5_0\I9678_RemoveScheduledTasksTable]
2025-07-02 15:50:33 [migration: PKP\migration\upgrade\v3_5_0\InstallEmailTemplates]
2025-07-02 15:50:33 [migration: PKP\migration\upgrade\v3_5_0\I9197_MigrateAccessKeys]
2025-07-02 15:50:33 [revert migration: PKP\migration\upgrade\v3_5_0\InstallEmailTemplates]
2025-07-02 15:50:33 [revert migration: PKP\migration\upgrade\v3_5_0\I9678_RemoveScheduledTasksTable]
2025-07-02 15:50:33 [revert migration: PKP\migration\upgrade\v3_5_0\I9895_AddAppKeyToConfigFile]
2025-07-02 15:50:33 [revert migration: APP\migration\upgrade\v3_5_0\I9892_FloatToDecimalColumnTypeUpdate]
2025-07-02 15:50:33 [revert migration: APP\migration\upgrade\v3_5_0\I8333_AddMissingForeignKeys]
2025-07-02 15:50:33 [downgrade for "APP\migration\upgrade\v3_5_0\I8333_AddMissingForeignKeys" unsupported: Downgrade not supported]
ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'invitations' already exists (Connection: mysql, SQL: create table `invitations` (`invitation_id` bigint not null auto_increment primary key, `key_hash` varchar(255) null, `type` varchar(255) not null, `user_id` bigint null, `inviter_id` bigint null, `expiry_date` datetime null, `payload` json null, `status` enum('INITIALIZED', 'PENDING', 'ACCEPTED', 'DECLINED', 'CANCELLED') not null, `email` varchar(255) null comment 'When present, the email address of the invitation recipient; when null, user_id must be set and the email can be fetched from the users table.', `context_id` bigint null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

解决方法:
1.备份旧数据库;
2.删除提示已存在的表“如journals、invitations表”;
3.升级;
4.从旧数据库,恢复导入旧表的数据至新表。

总结:
OJS软件版本分支较多,每个版本的迭代,都是很大规模的更新。因为涉及数据关联、插件兼容性等问题,一些OJS版本在升级时可能会遇到一些意想不到的问题,而这些问题往往很难找到正确的处理方法。

丁老师从事专业的OJS期刊软件安装搭建、二次开发、版本升级服务,对OJS系统有着深入的研究,可以解决各种OJS软件的疑难杂症及故障。同时,丁老师提供OJS版本升级服务,需要升级OJS版本的同学,可以联系丁老师咨询。

下一篇:没有了

相关文章

ojs系统提示无法上传图片的原因和解决办法

近日,出版社客户在使用OJS系统时,突然遇到这个问题Youdonothaveenoughspaceinyouruserdirectory.Thefileyouareuploadingis2917kbandyouhave12kbremai...

OJS3.3存在升级报错的问题

近日有使用OJS期刊系统的客户和丁老师反馈,OJS3.3.X版本无法升级到3.5,升级到一半总是报错,是怎么回事呢?错误代码:A database error has occurred: SQLSTATE[42S22]: Column ...

OJS中文出现##navigation.su...

在使用OJS系统时,用户设置了语言环境为中文,在后台中经常会出现##navigation.submissions##、##submission.shortAuthor##、##plugins.block##等错误代码,是怎么回事呢?其实...

OJS3.5版本不再支持手动添加后台用户

从OJS3.5版本开始,OJS不再支持从后台直接添加用户,而是采用了邀请用户的方式进行添加。即OJS无法再从后台,直接添加用户和角色,只能通过邮件邀请用户的方式,并获得用户授权同意后才可以添加用户及对应角色。OJS3.5添加用户方式:O...

推荐文章

OJS期刊首页不显示期刊和article的解...

近日,有使用OJS期刊系统的客户提出,怎么突然我的ojs系统期刊首页不显示期刊信息了,而且submissionarticle也不显示了,具体是怎么回事呢?需要丁老师协助帮忙。经过丁老师研究发现,其实这是因为客户没有仔细的学习ojs系统的使用...

谷歌学术Google Scholar介绍及文...

谷歌学术GoogleScholar(官网https://scholar.google.com)是谷歌推出的免费学术搜索引擎,可以用于检索全球范围内的学术文献、论文、专利、技术报告等专业内容。核心功能1.跨学科检索:覆盖自然科学、社会科学、人...

OJS中如何绑定Crossref注册内容并存...

openjournalsystem(开放期刊投稿系统)发布文章时,可以绑定crossfef信息,从而每当发布带有DOI的信息时,DOI和元数据都可以自动存入crossref中,具体的设置方法如下:启用Crossrefmanageplugin...

ojs期刊投稿系统上传文件提示“Slim A...

ojs期刊投稿系统,在MakeaSubmission,UploadFiles时文件上传失败,提示SlimApplicationError错误,可能是以下几点原因造成的:1.php没有启用fileinfo模块;2.文件上传目录设置错误;3.文...

QQ咨询 微信咨询