Oh, OK, I see: the other supp files are in another file stage and not as galleys, correct?
Is it sufficient for you to move just those as galleys and thus in the stage = 10 to the submission stage, submission files grid? – for the script to do exactly that…
Before you apply the script below, please check also these following 3 things:
– check if there are any supp files that have dependent files SELECT sf.* FROM submission_files sf, genres g, submission_supplementary_files ssf WHERE sf.file_id = ssf.file_id AND sf.revision = ssf.revision AND sf.file_stage = 10 AND sf.genre_id = g.genre_id AND g.supplementary = 1 AND EXISTS (SELECT sf2.assoc_id FROM submission_files sf2 WHERE sf2.assoc_id = sf.file_id)
– check if there are any remote galleys that need extra attention SELECT * FROM submission_galleys WHERE remote_url <> null OR remote_url <> ''
– check if there are any supp files in the stage_id = 10 but not belonging to a galley SELECT sf.* FROM submission_files sf, genres g, submission_supplementary_files ssf WHERE sf.file_id = ssf.file_id AND sf.revision = ssf.revision AND sf.file_stage = 10 AND sf.assoc_type = NULL AND sf.genre_id = g.genre_id AND g.supplementary = 1
Let me know what are the results of those queries. If any, they would need a special treatment.
Else, the CLI script that you could use to move all galley supp files to submission files grid is here: moveSuppFiles CLI script · bozana/ojs@d3617f6 · GitHub i.e. ojs/moveSuppFiles.php at moveSuppFile · bozana/ojs · GitHub.
You would need to take the script, copy/put it into your folder tools, and then run the script with your journal ID as parameter, like this: php tools/moveSuppFiles <journal_id> (for example php tools/moveSuppFiles 1, where 1 is the journal ID). Very important: Please backup everything before running the script!!! It would be best to either do it first on a copy of your installation in a test environment/server, or to take your installation for some time down/from production, and properly test the result before putting it in production again, i.e. that you can restore your backup again in the worst case.
revistas3=> SELECT count(sf.*) FROM submission_files sf, genres g, submission_supplementary_files ssf WHERE sf.file_id = ssf.file_id AND sf.revision = ssf.revision AND sf.file_stage = 10 AND sf.genre_id = g.genre_id AND g.supplementary = 1 AND EXISTS (SELECT sf2.assoc_id FROM submission_files sf2 WHERE sf2.assoc_id = sf.file_id);
-[ RECORD 1 ]
count | 933
Ah, my fault for the first SQL – something is missing – so could you please try this one: SELECT sf.* FROM submission_files sf, genres g, submission_supplementary_files ssf WHERE sf.file_id = ssf.file_id AND sf.revision = ssf.revision AND sf.file_stage = 10 AND sf.genre_id = g.genre_id AND g.supplementary = 1 AND sf.assoc_type = 515 AND EXISTS (SELECT sf2.assoc_id FROM submission_files sf2 WHERE sf2.assoc_id = sf.file_id)
And for the second SQL – remote supp files – is this a normal galley/full text or a supp file? – it seems that it is a normal galley/full text, so no problem with this…
Sorry for the delay :-
Here is the new script, supporting the parameter “all” meaning all journals: ojs/moveSuppFiles.php at moveSuppFile · bozana/ojs · GitHub.
I haven’t tested it properly, so please use it in a test environment first and make sure everything went fine, before applying it in the production system.
I have run the moveSuppFiles script and it works, the reason was because I have upgraded an OJS 2.4.6 to OJS 3.1.1.4 and I have found the supplementary files as supplementary galleys in the abstract page.
I tried the script on ojs 3.2.1-4 and failed because the changes in the DB model, but a simple replacement in the table names (submission → publication) was enough to make it run again.
PR committed, just in case somebody else falls in same hole: