[Solved] Uploading OJS 2.4.X to OJS 3.2 error

Hello.

We are uploading ojs 2.4.x to OJS 3.2

php tools/upgrade.php upgrade

In the stage:

[code: Installer Installer::convertSupplementaryFiles]

error:

<h1>Unknown locale component </h1>ojs2: Unknown locale component 

And script stops.

Can i do something?

Thanks.

Hi @juanito,

Are there any warnings displayed, either in the upgrade script output or in your PHP error log?

Regards,
Alec Smecher
Public Knowledge Project Team

I try now from 2.4.8 to 3.1.2-4 and

[code: Installer Installer::provideSupplementaryFilesForReview]
PHP Notice:  unserialize(): Error at offset 44 of 176 bytes in /ojs-3.1.2-4/lib/pkp/classes/db/DAO.inc.php on line 352
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /ojs-3.1.2-4/lib/pkp/classes/submission/SubmissionFile.inc.php:618
Stack trace:
#0 /ojs-3.1.2-4/lib/pkp/classes/submission/SubmissionFileDAODelegate.inc.php(91): SubmissionFile->_generateName(true)
#1 /ojs-3.1.2-4/lib/pkp/classes/submission/SubmissionFileDAO.inc.php(310): SubmissionFileDAODelegate->insertObject(Object(SubmissionFile), NULL, false)
#2 /ojs-3.1.2-4/lib/pkp/classes/file/SubmissionFileManager.inc.php(182): SubmissionFileDAO->insertObject(Object(SubmissionFile), NULL)
#3 /ojs-3.1.2-4/classes/install/Upgrade.inc.php(1477): SubmissionFileManager->copyFileToFileStage('2232', 1, 4, NULL, true)
#4 /ojs-3.1.2-4/lib/pkp/classes/install/Installer.inc.php(421): Upgrade->provideSupplementaryFilesForReview(Object(Upgrade), Array)
#5 /ojs-3.1.2-4/lib/pkp/cla in /home/mari/Escritorio/JSC/9/ojs-3.1.2-4/lib/pkp/classes/submission/SubmissionFile.inc.php on line 618

Thanks @asmecher

Hi @juanito,

I’d suggest staying with one version of OJS and working through problems. Can you try again with 3.2 and check for errors/warnings?

The message above with 3.1.2-4:

Call to a member function getUsername() on null in /ojs-3.1.2-4/lib/pkp/classes/submission/SubmissionFile.inc.php:618

…suggests that you have a data error; an entry in your submission_files directory indicates an uploader_user_id that does not exist in the users table. The safest thing to do would be to update that entry in submission_files to point to a user that does exist.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks, i am going to test sql sentences to search phantom user.

Hello @asmecher

How can i detect what file is the problem?

i see this sentence

$suppFilesResult = $submissionFileDao->retrieve('SELECT a.context_id, sf.* FROM article_supplementary_files sf, submissions a WHERE a.submission_id = sf.article_id AND sf.file_id <> 0 AND sf.show_reviewers = 1 AND sf.remote_url IS NULL and sf.file_id in (select f.file_id from submission_files f)');

Thanks

Hi @juanito,

You can use a LEFT JOIN to identify the missing user_id:

SELECT sf.uploader_user_id FROM submission_files sf LEFT JOIN users u ON (u.user_id = sf.uploader_user_id) WHERE u.user_id IS NULL;

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hello @asmecher.
Ojs 2 hasn’t table:

submission_files
MariaDB [dbs259740]> SELECT sf.uploader_user_id FROM submission_files sf LEFT JOIN users u ON (u.user_id = sf.uploader_user_id) WHERE u.user_id IS NULL;
ERROR 1146 (42S02): Table 'dbs259740.submission_files' doesn't exist

Thanks

I have this table with upgrade ‘broken’

MariaDB [dbs259740]> SELECT sf.uploader_user_id FROM submission_files sf LEFT JOIN users u ON (u.user_id = sf.uploader_user_id) WHERE u.user_id IS NULL;
....
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
|             NULL |
+------------------+
2603 rows in set (0.001 sec)

Hi @juanito,

You can use article_files in place of submission_files with an OJS 2.x database.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

How file is related with ‘uploader’ in OJS 2? Thanks

MariaDB [dbs259740]> describe article_files;
+--------------------+--------------+------+-----+---------+----------------+
| Field              | Type         | Null | Key | Default | Extra          |
+--------------------+--------------+------+-----+---------+----------------+
| file_id            | bigint(20)   | NO   | PRI | NULL    | auto_increment |
| revision           | bigint(20)   | NO   | PRI | NULL    |                |
| source_file_id     | bigint(20)   | YES  |     | NULL    |                |
| source_revision    | bigint(20)   | YES  |     | NULL    |                |
| article_id         | bigint(20)   | NO   | MUL | NULL    |                |
| file_name          | varchar(90)  | NO   |     | NULL    |                |
| file_type          | varchar(255) | NO   |     | NULL    |                |
| file_size          | bigint(20)   | NO   |     | NULL    |                |
| original_file_name | varchar(127) | YES  |     | NULL    |                |
| file_stage         | bigint(20)   | NO   |     | NULL    |                |
| viewable           | tinyint(4)   | YES  |     | NULL    |                |
| date_uploaded      | datetime     | NO   |     | NULL    |                |
| date_modified      | datetime     | NO   |     | NULL    |                |
| round              | tinyint(4)   | NO   |     | NULL    |                |
| assoc_id           | bigint(20)   | YES  |     | NULL    |                |
+--------------------+--------------+------+-----+---------+----------------+
15 rows in set (0.027 sec)
$suppFilesResult = $submissionFileDao->retrieve('SELECT a.context_id, sf.* FROM article_supplementary_files sf, submissions a WHERE a.submission_id = sf.article_id AND sf.file_id <> 0 AND sf.show_reviewers = 1 AND sf.remote_url IS NULL and sf.file_id in (select f.file_id from submission_files f)');

Break here, i think

// Retrieve the supp file last revision number, although they probably only have revision 1.
$revisionNumber = $submissionFileDao->getLatestRevisionNumber($suppFilesRow['file_id']);

Debuging upgrade.php. Before error

suppFilesRowArray
(
    [context_id] => 1
    [supp_id] => 96
    [file_id] => 2232
    [article_id] => 480
    [type] => 
    [language] => 
    [date_created] => 2019-03-06
    [show_reviewers] => 1
    [date_submitted] => 2019-03-06 18:22:17
    [seq] => 0
    [remote_url] => 
)


            [sql] => SELECT * FROM review_rounds WHERE submission_id = '480' AND stage_id = 3 ORDER BY stage_id ASC, round ASC

submissionFileManagerSubmissionFileManager Object
(
    [_submissionId] => 480
    [contextId] => 1
    [filesDir] => /ojs-3.1.2-2/ficheros/journals///articles//
)
revisionNumber1PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /ojs-3.1.2-2/lib/pkp/classes/submission/SubmissionFile.inc.php:618

But SQL:

Screenshot_2020-03-16%20awpruebas%20es%20localhost%20c1dbs259740%20review_rounds%20phpMyAdmin%204%206%206deb4

@asmecher i am lost

Hi @juanito,

Does an article/submission with ID 480 exist in your database? Does that journal have at least one designated journal manager?

Regards,
Alec Smecher
Public Knowledge Project Team

Thnaks @asmecher.

That journal have at least one designated journal manager

Yes, article 480 exist:

 MariaDB [dbs259740]> SELECT * FROM articles WHERE article_id=480\G
*************************** 1. row ***************************
          article_id: 480
              locale: en_US
             user_id: 1
          journal_id: 1
          section_id: 0
            language: en
      comments_to_ed: <p>Dear Editors;<br /><br />This is an abstract submission to the Science and Cycling conference.</p><p>If our work is accepted, my co-author ****** will present it orally.<br /><br />Kind regards;<br />Arthur *******</p>
           citations: NULL
      date_submitted: 2019-03-06 18:20:38
       last_modified: 2020-03-13 16:48:06
date_status_modified: 2019-08-26 13:16:21
              status: 3
 submission_progress: 0
       current_round: 1
  submission_file_id: NULL
     revised_file_id: NULL
      review_file_id: 2257
      editor_file_id: 2258
               pages: 39-40
        fast_tracked: 0
         hide_author: 0
     comments_status: 0
1 row in set (0.001 sec)

debug=On
before break

submissionFileManagerSubmissionFileManager Object
(
    [_submissionId] => 480
    [contextId] => 1
    [filesDir] => /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/ficheros/journals///articles//
)
PKP-Database-Logger 1584408321.4825: -----
(mysqli): SELECT MAX(revision) AS max_revision FROM submission_files WHERE file_id = 2232 
   
-----

revisionNumber1PKP-Database-Logger 1584408321.4825: -----
(mysqli): SELECT DISTINCT
				sf.file_id AS submission_file_id, sf.revision AS submission_revision,
				af.file_id AS artwork_file_id, af.revision AS artwork_revision,
				suf.file_id AS supplementary_file_id, suf.revision AS supplementary_revision,
				s.locale AS submission_locale,
				sf.*, af.*, suf.*
			FROM	submission_files sf
				LEFT JOIN submission_artwork_files af ON sf.file_id = af.file_id AND sf.revision = af.revision
				LEFT JOIN submission_supplementary_files suf ON sf.file_id = suf.file_id AND sf.revision = suf.revision
				LEFT JOIN submissions s ON s.submission_id = sf.submission_id WHERE  sf.file_id = 2232 AND sf.revision = 1 ORDER BY sf.submission_id ASC, sf.file_stage ASC, sf.file_id ASC, sf.revision DESC 
   
-----

PKP-Database-Logger 1584408321.4825: -----
(mysqli): SELECT * FROM submission_file_settings WHERE file_id = '2232' 
   
-----

PKP-Database-Logger 1584408321.4825: -----
(mysqli): SELECT	s.*, ps.*, s.submission_id AS submission_id,
				COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
			COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
			FROM	submissions s
				LEFT JOIN published_submissions ps ON (s.submission_id = ps.submission_id)
				JOIN sections se ON se.section_id = s.section_id
			LEFT JOIN section_settings stpl ON (se.section_id = stpl.section_id AND stpl.setting_name = 'title' AND stpl.locale = 'en_US')
			LEFT JOIN section_settings stl ON (se.section_id = stl.section_id AND stl.setting_name = 'title' AND stl.locale = 'en_US')
			LEFT JOIN section_settings sapl ON (se.section_id = sapl.section_id AND sapl.setting_name = 'abbrev' AND sapl.locale = 'en_US')
			LEFT JOIN section_settings sal ON (se.section_id = sal.section_id AND sal.setting_name = 'abbrev' AND sal.locale = 'en_US')
			WHERE	s.submission_id = 480
				 
   
-----

PKP-Database-Logger 1584408321.4825: -----
(mysqli): SELECT	s.*, ps.*, s.submission_id AS submission_id,
				COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
			COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
			FROM	submissions s
				LEFT JOIN published_submissions ps ON (s.submission_id = ps.submission_id)
				JOIN sections se ON se.section_id = s.section_id
			LEFT JOIN section_settings stpl ON (se.section_id = stpl.section_id AND stpl.setting_name = 'title' AND stpl.locale = 'en_US')
			LEFT JOIN section_settings stl ON (se.section_id = stl.section_id AND stl.setting_name = 'title' AND stl.locale = 'en_US')
			LEFT JOIN section_settings sapl ON (se.section_id = sapl.section_id AND sapl.setting_name = 'abbrev' AND sapl.locale = 'en_US')
			LEFT JOIN section_settings sal ON (se.section_id = sal.section_id AND sal.setting_name = 'abbrev' AND sal.locale = 'en_US')
			WHERE	s.submission_id = 480
				 
   
-----

PKP-Database-Logger 1584408321.4825: -----
(mysqli): INSERT INTO submission_files
				(revision, submission_id, source_file_id, source_revision, file_type, file_size, original_file_name, file_stage, date_uploaded, date_modified, viewable, uploader_user_id, assoc_type, assoc_id, genre_id, direct_sales_price, sales_type)
				VALUES
				(1, 480, 2232, 1, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 32340, 'S&C abstract.docx', 4, '2019-03-06 18:22:16', '2020-03-17 01:57:40', 1, NULL, NULL, NULL, 1, NULL, NULL) 
   
-----

PKP-Database-Logger 1584408321.4825: -----
(mysqli): SELECT * FROM genres WHERE genre_id = 1 ORDER BY seq 
   
-----

PKP-Database-Logger 1584408321.4825: -----
(mysqli): SELECT * FROM genre_settings WHERE genre_id = '1' 
   
-----

PKP-Database-Logger 1584408321.4825: -----
(mysqli): SELECT * FROM users WHERE user_id = 0 
   
-----

PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/lib/pkp/classes/submission/SubmissionFile.inc.php:618
Stack trace:
#0 /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/lib/pkp/classes/submission/SubmissionFileDAODelegate.inc.php(91): SubmissionFile->_generateName(true)
#1 /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/lib/pkp/classes/submission/SubmissionFileDAO.inc.php(310): SubmissionFileDAODelegate->insertObject(Object(SubmissionFile), NULL, false)
#2 /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/lib/pkp/classes/file/SubmissionFileManager.inc.php(182): SubmissionFileDAO->insertObject(Object(SubmissionFile), NULL)
#3 /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/classes/install/Upgrade.inc.php(1496): SubmissionFileManager->copyFileToFileStage('2232', 1, 4, NULL, true)
#4 /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/lib/pkp/classes/install/Installer.inc.php(421): Upgrade->provideSupplementaryFilesForReview(Object(Upgrade), Array)
#5 /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/lib/pkp/cla in /home/mari/Escritorio/JSC/9/ojs-3.1.2-2/lib/pkp/classes/submission/SubmissionFile.inc.php on line 618

Hello @asmecher.

With OJS 3.2.0

PKP-Database-Logger 1584450425.9621: -----
(mysqli): select * from `publications` as `p` where `p`.`submission_id` in (33) 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM submissions WHERE submission_id = 33 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM submission_settings WHERE submission_id = '33' 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): select * from `publications` as `p` where `p`.`submission_id` in (33) 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): DELETE FROM submission_files
			 WHERE file_id = 207 AND revision = 1 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM submission_files WHERE file_id = 207 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): DELETE FROM submission_file_settings WHERE file_id = 207 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): DELETE FROM item_views WHERE assoc_type = 515 AND assoc_id = '207-1' 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM submissions WHERE submission_id = 33 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM submission_settings WHERE submission_id = '33' 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): select * from `publications` as `p` where `p`.`submission_id` in (33) 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): INSERT INTO submission_files
				(file_id, revision, submission_id, source_file_id, source_revision, file_type, file_size, original_file_name, file_stage, date_uploaded, date_modified, viewable, uploader_user_id, assoc_type, assoc_id, genre_id, direct_sales_price, sales_type)
				VALUES
				(207, 1, 33, NULL, NULL, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 78478, 'Lanferdini 2012_Science and Cycling_Tables and Figures.docx', 10, '2012-11-24 00:18:42', '2012-11-24 00:18:42', 0, 1, NULL, NULL, 4, NULL, NULL) 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM genres WHERE genre_id = 4 ORDER BY seq 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM genre_settings WHERE genre_id = '4' 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM users WHERE user_id = 1 
   
-----

PKP-Database-Logger 1584450425.9621: -----
(mysqli): SELECT * FROM user_settings WHERE user_id = '1' 
   
-----

<h1>Unknown locale component </h1>ojs2: Unknown locale component 
mari@debians:~/Escritorio/JSC/9/ojs-3.2.0$ 

data = invisible data


Database changed
MariaDB [dbs259740]> SELECT * FROM user_settings WHERE user_id = '1'  \G
*************************** 1. row ***************************
      user_id: 1
       locale: 
 setting_name: filterEditor
   assoc_type: 256
     assoc_id: 1
setting_value: 0
 setting_type: int
*************************** 2. row ***************************
      user_id: 1
       locale: 
 setting_name: filterSection
   assoc_type: 256
     assoc_id: 1
setting_value: 1
 setting_type: int
*************************** 3. row ***************************
      user_id: 1
       locale: 
 setting_name: profileImage
   assoc_type: 256
     assoc_id: 0
setting_value: NULL
 setting_type: string
*************************** 4. row ***************************
      user_id: 1
       locale: en_US
 setting_name: affiliation
   assoc_type: 0
     assoc_id: 0
setting_value: 
 setting_type: string
*************************** 5. row ***************************
      user_id: 1
       locale: en_US
 setting_name: biography
   assoc_type: 0
     assoc_id: 0
setting_value: 
 setting_type: string
*************************** 6. row ***************************
      user_id: 1
       locale: en_US
 setting_name: signature
   assoc_type: 0
     assoc_id: 0
setting_value: 
 setting_type: string
*************************** 7. row ***************************
      user_id: 1
       locale: es_ES
 setting_name: affiliation
   assoc_type: 0
     assoc_id: 0
setting_value: data data, Pamplona, Spain.
 setting_type: string
*************************** 8. row ***************************
      user_id: 1
       locale: es_ES
 setting_name: biography
   assoc_type: 0
     assoc_id: 0
setting_value: Universidad data data data, Pamplona, Spain.
 setting_type: string
*************************** 9. row ***************************
      user_id: 1
       locale: es_ES
 setting_name: familyName
   assoc_type: 0
     assoc_id: 0
setting_value: data
 setting_type: string
*************************** 10. row ***************************
      user_id: 1
       locale: es_ES
 setting_name: givenName
   assoc_type: 0
     assoc_id: 0
setting_value: Manuel
 setting_type: string
*************************** 11. row ***************************
      user_id: 1
       locale: es_ES
 setting_name: gossip
   assoc_type: 0
     assoc_id: 0
setting_value: 
 setting_type: string
*************************** 12. row ***************************
      user_id: 1
       locale: es_ES
 setting_name: signature
   assoc_type: 0
     assoc_id: 0
setting_value: data data data
 setting_type: string
12 rows in set (0.000 sec)

MariaDB [dbs259740]> 

Hi @juanito,

Can you send me (privately) a copy of your OJS 2.x database dump and an archive of your files directory (files_dir in config.inc.php)?

Regards,
Alec Smecher
Public Knowledge Project Team