Academic Tools. Smarter Research.
Open Journal SystemsRecovering Orphaned Files in OJS

Journal Orphaned Files & Submission Data Recovery in OJS

Forensic repair manual for resolving missing files and broken submission workflows in Open Journal Systems. Learn how to reconstruct submission file associations.

Discovering that readers are getting "404 File Not Found" when clicking PDF galleys is every journal editor’s nightmare; here is how to recover lost files and re-link submission records.

Real Problem

Improper server migrations, accidental deletions, or storage corruption often leave database records pointing to non-existent disk files, or leave gigabytes of orphaned manuscripts detached from the submission grid.

Practical Solution

Deploy forensic database-to-filesystem reconciliation scripts, match orphaned files to submission IDs using internal PKP naming conventions, and reconstruct missing galley database entries.

OJS orphaned files recoveryrepair broken submission OJSmissing galley fix OJSreconstruct OJS file repositoryOJS file not found error

Understanding the OJS File Storage Architecture

In Open Journal Systems, manuscript files are never stored under their original uploaded filenames (such as "Smith_Final_Paper_Revised.pdf"). Instead, OJS sanitizes and renames every asset according to an internal structural schema to prevent filename collisions and security vulnerabilities.

When a reader attempts to download a published galley, OJS executes a lookup across three database tiers:

1. publication_galleys: Connects a public galley button to a specific submission_file_id.

2. submission_files: Defines the physical file metadata, including original filename, genre ID, and filesystem path.

3. Physical Disk Storage: The actual binary file located inside files_dir.

If any link in this chain breaks—due to an interrupted migration or partial backup restoration—readers experience an immediate HTTP 404 or "File Not Found" exception.

Diagnosing Orphaned Files and Broken Links

To identify files referenced in your database that do not exist on the filesystem, you can run a diagnostic PHP script in your OJS root:

<?php

require('./tools/bootstrap.php');

$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');

// Iterate through submissions and verify file existence via FilesDirManager

Forensic Decoding of PKP Filename Patterns

If you have a collection of loose files in /var/ojs_files/ without matching database records, you can reverse-engineer their identity using PKP’s standardized naming structures:

In OJS 3.0 to 3.2:

{submissionId}-{fileStage}-{fileId}-{revisionNumber}.{extension}

For example: 452-1-1280-1.pdf

- 452: Submission ID

- 1: File Stage (1 = Submission, 2 = Review File, 4 = Copyedit, 9 = Galley)

- 1280: Unique File ID

- 1: Revision Number

In OJS 3.3 and 3.4:

Files are categorized into folders:

/journals/{journalId}/articles/{submissionId}/submission/

/journals/{journalId}/articles/{submissionId}/attachment/

/journals/{journalId}/articles/{submissionId}/galley/

Rebuilding Broken Galley Database Records

If the physical PDF exists on disk but the database record is missing, you can insert a valid submission_file record and attach it to the publication galley:

1. Insert row into submission_files table.

2. Record original filename in submission_file_settings.

3. Link the new submission_file_id to the publication_galleys table for that article’s active publication.

Step-by-Step Action Plan

1

Audit Database-to-Disk Discrepancies

Execute a PHP verification script that compares submission_files records with physical files on disk in files_dir.

2

Analyze PKP File Naming Schemes

Decode internal file patterns (e.g., submission-123-1-SM.pdf or files/journals/1/articles/123/) to determine true manuscript ownership.

3

Reconstruct Missing submission_files Rows

Generate targeted INSERT queries for submission_file_settings and submission_files matching recovered on-disk files.

4

Verify Galley Publication Links

Confirm that publication_galleys entries reference valid submission_file_id identifiers.

5

Audit Mime Types & File Permissions

Ensure recovered files have www-data ownership and valid application/pdf or text/xml mime types in the database.

Questions People Usually Ask

Why do PDF galleys return a 404 error even when the file exists on the server?

OJS does not serve files based on simple directory URLs. It checks submission_files and publication_galleys in the database. If the submission_file_id is mismatched or the relative path stored in the database does not align with files_dir, OJS throws a 404.

How are manuscript files named across different OJS versions?

In OJS 2.x and 3.2, files followed patterns like articleId-fileId-revisionId-genreId.ext. In OJS 3.3 and 3.4, files are organized into structured directories by journal ID and submission ID (e.g., /journals/1/articles/123/submission/).

Can deleted galleys be recovered from web server logs or Google cache?

Yes. In severe data loss cases, academic web server access logs and web caches can be mined to recover original PDF galleys, which can then be re-ingested into the OJS production grid.

Missing PDF Galleys or Broken Submissions?

AcademiaTech performs forensic file and database recovery for academic journals, reconnecting broken galleys and restoring unlinked archives.