Upgrade from OJS 2.4.7 to 3.0.1 fails

Hello all,

For some days now I’m trying to do a test upgrade on our OJS. Several minor problems like convert file extensions to lower case, empty date fields, and articles with no section_id were already corrected, but I’m still getting the error:

[code]

PHP Warning:  assert(): Assertion failed in /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 380
PHP Stack trace:
PHP   1. {main}() /ojs_temp/rc-3.0.1/tools/upgrade.php:0
PHP   2. UpgradeTool->execute() /ojs_temp/rc-3.0.1/tools/upgrade.php:34
PHP   3. UpgradeTool->upgrade() /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php:64
PHP   4. Installer->execute() /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php:88
PHP   5. Installer->executeInstaller() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:186
PHP   6. Installer->executeAction() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:265
PHP   7. call_user_func:{/ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415}() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415
PHP   8. Upgrade->convertSupplementaryFiles() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415
PHP   9. PKPSubmissionFileDAO->updateObject() /ojs_temp/rc-3.0.1/classes/install/Upgrade.inc.php:1267
PHP  10. assert() /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php:380
<h1>There are no readable files in this directory tree. Are safe mode or open_basedir active?</h1>ojs2: There are no readable files in this directory tree. Are safe mode or open_basedir active?

I’ve added the following to line 379 of PKPSubmissionFileDAO.inc.php:

echo "$previousFilePath -> $targetFilePath".PHP_EOL;

To find out which file is missing, and when I ran the upgrade again I got this:

[code]

/ojs_temp/rc-3.0.1_files/journals/2//articles/6434/attachment/6434-1-33005-2-13-20120920.docx -> /ojs_temp/rc-3.0.1_files/journals/2//articles/6434/submission/6434-16-33005-2-2-20120920.docx
/ojs_temp/rc-3.0.1_files/journals/2//articles/868/attachment/868-1-3522-1-13-20080125.jpg -> /ojs_temp/rc-3.0.1_files/journals/2//articles/868/submission/868-14-3522-1-2-20080125.jpg
 ->
PHP Warning:  assert(): Assertion failed in /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 380
PHP Stack trace:
PHP   1. {main}() /ojs_temp/rc-3.0.1/tools/upgrade.php:0
PHP   2. UpgradeTool->execute() /ojs_temp/rc-3.0.1/tools/upgrade.php:34
PHP   3. UpgradeTool->upgrade() /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php:64
PHP   4. Installer->execute() /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php:88
PHP   5. Installer->executeInstaller() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:186
PHP   6. Installer->executeAction() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:265
PHP   7. call_user_func:{/ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415}() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415
PHP   8. Upgrade->convertSupplementaryFiles() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415
PHP   9. PKPSubmissionFileDAO->updateObject() /ojs_temp/rc-3.0.1/classes/install/Upgrade.inc.php:1267
PHP  10. assert() /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php:380
<h1>There are no readable files in this directory tree. Are safe mode or open_basedir active?</h1>ojs2: There are no readable files in this directory tree. Are safe mode or open_basedir active?

It seems that an empty file name is being passed here, but I was not able to find where the problem is. Our OJS is old and have indeed some missing files due to a hard disk crash on the server some years ago.

We are using:

Ubuntu 16.04.1 LTS
PHP 5.6.27-1+deb.sury.org~xenial+1
mysql Ver 14.14 Distrib 5.7.16
OJS 2.4.7-1

Any help is appreciated. Thanks!

Oberdan

Hi @Oberdan,

Before I dive into this, are you handy with git? You might consider using the ojs-stable-3_0_1 branch there rather than the 3.0.1 tarball – there have been a few tweaks to the upgrade process that might affect the issue you’re working with.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello Alec,

I’ll try using the git branch then, and will let you know if it worked.

Thanks!

Oberdan

Hello again Alec,

I tried the upgrade using the source from github, and got the same error.

Regards,

Oberdan

Hi @Oberdan,

I’d suggest adding a debug output to FileManager::mkdirtree to catch what it’s being called on in the first place. It’s a recursive function and the failing recursion is likely a few iterations in.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

As you suggested, I’ve added:

echo "MKDIRTREE : $dirPath".PHP_EOL;

at the beginning of FileManager::mkdirtree, and the output now was the following:

[code]
MKDIRTREE : /ojs_temp/rc-3.0.1_files/journals/18//articles/6005
MKDIRTREE : /ojs_temp/rc-3.0.1_files/journals/18//articles/7550//attachment
MKDIRTREE : /ojs_temp/rc-3.0.1_files/journals/18//articles/7550

/ojs_temp/rc-3.0.1_files/journals/2//articles/6434/attachment/6434-1-33005-2-13-20120920.docx -> /ojs_temp/rc-3.0.1_files/journals/2//articles/6434/submission/6434-16-33005-2-2-20120920.docx
/ojs_temp/rc-3.0.1_files/journals/2//articles/868/attachment/868-1-3522-1-13-20080125.jpg -> /ojs_temp/rc-3.0.1_files/journals/2//articles/868/submission/868-14-3522-1-2-20080125.jpg
 ->
PHP Warning:  assert(): Assertion failed in /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 380
PHP Stack trace:
PHP   1. {main}() /ojs_temp/rc-3.0.1/tools/upgrade.php:0
PHP   2. UpgradeTool->execute() /ojs_temp/rc-3.0.1/tools/upgrade.php:34
PHP   3. UpgradeTool->upgrade() /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php:64
PHP   4. Installer->execute() /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php:88
PHP   5. Installer->executeInstaller() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:186
PHP   6. Installer->executeAction() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:265
PHP   7. call_user_func:{/ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415}() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415
PHP   8. Upgrade->convertSupplementaryFiles() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415
PHP   9. PKPSubmissionFileDAO->updateObject() /ojs_temp/rc-3.0.1/classes/install/Upgrade.inc.php:1269
PHP  10. assert() /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php:380
MKDIRTREE :
<h1>There are no readable files in this directory tree. Are safe mode or open_basedir active?</h1>ojs2: There are no readable files in this directory tree. Are safe mode or open_basedir active?

I still believe that there is an empty file name or path somewhere… Where in the database is the information about these files stored?

Regards,

Oberdan

Hi @Oberdan,

Could you turn on the show_stacktrace option in config.inc.php? That’ll display a stack trace with the fatal error, which should make it easier to track down.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

Using show_stacktrace = On the result is:

[code]
MKDIRTREE : /ojs_temp/rc-3.0.1_files/journals/18//articles/6005
MKDIRTREE : /ojs_temp/rc-3.0.1_files/journals/18//articles/7550//attachment
MKDIRTREE : /ojs_temp/rc-3.0.1_files/journals/18//articles/7550

/ojs_temp/rc-3.0.1_files/journals/2//articles/6434/attachment/6434-1-33005-2-13-20120920.docx -> /ojs_temp/rc-3.0.1_files/journals/2//articles/6434/submission/6434-16-33005-2-2-20120920.docx
/ojs_temp/rc-3.0.1_files/journals/2//articles/868/attachment/868-1-3522-1-13-20080125.jpg -> /ojs_temp/rc-3.0.1_files/journals/2//articles/868/submission/868-14-3522-1-2-20080125.jpg
 ->
PHP Warning:  assert(): Assertion failed in /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 380
PHP Stack trace:
PHP   1. {main}() /ojs_temp/rc-3.0.1/tools/upgrade.php:0
PHP   2. UpgradeTool->execute() /ojs_temp/rc-3.0.1/tools/upgrade.php:34
PHP   3. UpgradeTool->upgrade() /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php:64
PHP   4. Installer->execute() /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php:88
PHP   5. Installer->executeInstaller() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:186
PHP   6. Installer->executeAction() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:265
PHP   7. call_user_func:{/ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415}() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415
PHP   8. Upgrade->convertSupplementaryFiles() /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php:415
PHP   9. PKPSubmissionFileDAO->updateObject() /ojs_temp/rc-3.0.1/classes/install/Upgrade.inc.php:1269
PHP  10. assert() /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php:380
MKDIRTREE :
<h1>There are no readable files in this directory tree. Are safe mode or open_basedir active?</h1><h4>Stack Trace:</h4>
<strong>File:</strong> /ojs_temp/rc-3.0.1/lib/pkp/classes/file/FileManager.inc.php line 157<br />
<strong>Function:</strong> FileManager->mkdirtree("")<br />
<br/>
<strong>File:</strong> /ojs_temp/rc-3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php line 383<br />
<strong>Function:</strong> FileManager->copyFile(Null, Null)<br />
<br/>
<strong>File:</strong> /ojs_temp/rc-3.0.1/classes/install/Upgrade.inc.php line 1269<br />
<strong>Function:</strong> PKPSubmissionFileDAO->updateObject(Object(SubmissionFile))<br />
<br/>
<strong>File:</strong> (unknown) line (unknown)<br />
<strong>Function:</strong> Upgrade->convertSupplementaryFiles(Object(Upgrade), Array(1))<br />
<br/>
<strong>File:</strong> /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php line 415<br />
<strong>Function:</strong> call_user_func(Array(2), Object(Upgrade), Array(1))<br />
<br/>
<strong>File:</strong> /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php line 265<br />
<strong>Function:</strong> Installer->executeAction(Array(3))<br />
<br/>
<strong>File:</strong> /ojs_temp/rc-3.0.1/lib/pkp/classes/install/Installer.inc.php line 186<br />
<strong>Function:</strong> Installer->executeInstaller()<br />
<br/>
<strong>File:</strong> /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 88<br />
<strong>Function:</strong> Installer->execute()<br />
<br/>
<strong>File:</strong> /ojs_temp/rc-3.0.1/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 64<br />
<strong>Function:</strong> UpgradeTool->upgrade()<br />
<br/>
<strong>File:</strong> /ojs_temp/rc-3.0.1/tools/upgrade.php line 34<br />
<strong>Function:</strong> UpgradeTool->execute()<br />
<br/>
ojs2: There are no readable files in this directory tree. Are safe mode or open_basedir active?

Regards,

Oberdan

Hi @Oberdan,

Hmm, would you be willing to provide me with a copy of your database dump prior to upgrade?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

I’ve sent you a message with the link to download the dump.

Regards,

Oberdan

Hi @asmecher,

I got the same error while upgrading from 2.4.6 to 3.0.1:

PHP Warning:  assert(): Assertion failed in /var/www/www.jld.edu.au/versions/3.0.1/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 380
<h1>There are no readable files in this directory tree. Are safe mode or open_basedir active?</h1>ojs2: There are no readable files in this directory tree. Are safe mode or open_basedir active?

Is there a solution found for this yet? I can send you the sql dump of our db before upgrade.

Thanks
Ghazal

Hi,
also I seem affected by the same problem. Looking forward where this ends!

Hi,

Isn’t there any update on this issue yet?

Thanks
Ghazal

Hi @asmecher,

Will there be a fix for this issue in 3.0.2?

Thanks
Ghazal

Hi @salehig,

I’m afraid not – I’m just wrapping up the OJS 3.0.2 release now – but I’ll try to have a look at this shortly, and if need be, will prepare a patch to apply to 3.0.2 to address any issues that turn up.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hi Alec
I have recently taken over from Ghazal Salehi (@salehig ) as she has gone on maternity leave for remaining part of this year. Our OJS upgrade from v2.4.6 to v3.0.1 is still due till this issue of upgrade script failure is resolved. Can you please let me know any update on this issue resolution?
Thanks & kind Regards
Sunil Sinha ( s2.sinha@qut.edu.au)

Hi @sinhsu,

I’ve managed to replicate the problem locally thanks to @Oberdan’s database dump, but haven’t had the time to dive into it thoroughly. It’s high up on my to-do list; thanks for your patience.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi all,

Thanks for your patience. I’ve wrangled through @Oberdan’s database dump and it appears that there is a data error in the OJS 2.4.x data: some of the articles don’t have a valid section.

To check for articles in this situation, run the following in your database:

SELECT a.article_id FROM articles a LEFT JOIN sections s ON (a.section_id = s.section_id) WHERE s.section_id IS NULL;

This will generate a list of article IDs for which a section is needed. You can either go in via the OJS 2.4.x workflow and assign them, or you can edit the database directly. (If working with the database directly, make sure that the section_id you use belongs to the journal the submission is in.)

Once you’ve corrected the data error, take a fresh backup of the database and files area and try the upgrade again.

Regards,
Alec Smecher
Public Knowledge Project Team

2 Likes

@asmecher

The SciELO OJS has 3976 sections in this situation.

mysql> SELECT a.article_id FROM articles a LEFT JOIN sections s ON (a.section_id = s.section_id) WHERE s.section_id IS NULL;
±-----------+
| article_id |
±-----------+
| 109 |
| 843 |

| 137276 |
| 137439 |
±-----------+
3976 rows in set (0.38 sec)

It is a huge number of records to fix them through the interface.

Do you have any suggestion to try to fix these gaps in a fast and secure way?

Hi @fabiobatalha/all,

The first thing to do is establish a policy on how, from a content perspective, you want to assign these articles. Is there already a consistently-named and suitable section in the journals that you want to assign these articles to? Do you want to create a new section for each journal?

Since you have so many journals, the most expedient approach is probably to create a new section for each journal, directly in the database. You can do this with:

INSERT INTO sections (journal_id, seq, editor_restricted, meta_indexed, meta_reviewed, abstracts_not_required, hide_title, hide_author, hide_about) SELECT journal_id, -9999, 1, 1, 0, 1, 1, 0, 1 FROM journals;

This will create a new section for each journal. The seq value of -9999 will cause the section to be listed very high in the table of contents (I suspect you’ll need to preserve the order of article display) but we’re also going to use it below as a convenience to help find these new sections when populating the other data needed.

Now you’ll want to give a title to each section:

INSERT INTO section_settings (section_id, locale, setting_name, setting_value, setting_type) SELECT section_id, 'en_US', 'title', 'New Section Title Here', 'string' FROM sections WHERE seq=-9999;

The above example sets the English (en_US) title to “New Section Title”; adjust the locale and title to suit, and repeat the query as many times as you need for multiple locales. Make sure you provide at least a value in the journal’s primary locales.

Now you’ll need to do a multi-table update in order to assign the unassigned sections to the new sections:

UPDATE articles a LEFT JOIN sections s1 ON (s1.section_id=a.section_id) LEFT JOIN sections s2 ON (a.journal_id=s2.journal_id AND s2.seq=-9999) SET a.section_id=s2.section_id WHERE s1.section_id IS NULL;

NOTE: I’ve run these queries but not tested them comprehensively. Please make sure you have a good backup before executing them, and before going live with the data corrected this way, make sure to review it within the installation to ensure it looks OK.

(These queries are intended for execution on the OJS 2.x database, prior to running the upgrade script.)

Regards,
Alec Smecher
Public Knowledge Project Team