Import articles and galleys with specific IDs

Hi all,

this is a complicated scenario (to me) which I would like to ask you about any ideas:

There is an OJS installation which I would like to transfer to a new server. The journal is ok with that, but they have no means to export their database (I know that’s usually quite easy, but for numerous reasons in that case, it is not feasible). The only interfaces available are the export functions available through the UI and the OAI interface.

Now unfortunately, the internal issue, article and file numbers are not regular. So while I could import the exported XML from the old installation, this would not recreate links like.../article/view/4340/4124, as the numbering is not transferred and new ids are assigned by counting upwards in the current install. But the site has already been active with those URLs and users might have bookmarked or quoted them (unfortuntaly, no DOIs have been used before). So the journal would like to preserve the links for each article, which I think is understandable.

Is there a clever way of changing the internal ids in the database, maybe prior to building the search index to reduce complexity?

The manual solution I have figured out so far is:

  • take an empty OJS database
  • create and delete issues until the id of the next one to come would be the desired id for the first real issue
  • create and discard as many article submissions until the id of the next one to come would be the desired id for the first real article
  • insert “placeholder articles” into the XML file where numbering is irregular (so if an issue should contain articles 1,2,6,8,9, insert placeholder articles as 3,4,5,7 with one galley each (all articles contain one galley in this journal, in the original install, file and article ids are identical) at the corresponding lines in the XML file
  • for irregular galley numbers, attach “placeholder galleys” to the import XML of the last article before the numbering gap so that the next imported galley will get the correct number
  • after successful import, delete the placeholder articles and galleys

As the journal’s newest article id is currently somehwere around 3000, this will be an interesting task to do and I’ll need to create a database dump after every step in case I make a mistake… So any suggestions on an easier way to achieve custom article IDs would be great!

Hi @ojsbsb,

Hmm, I suspect you’re headed for a world of pain – is there no way to get a MySQL database dump out of the old server?

Alec Smecher
Public Knowledge Project Team

HI @asmecher,

there’s no chance to get a database dump at all, unfortunately. There is a number of reasons for this, and some of them are beyond technical repair.

I was just wondering whether it may be able to securely change IDs in the database, maybe prior to creating the search index to reduce the compexity.


Hi @ojsbsb,

I’m not sure if this is an option – but have you seen this thread?

Alec Smecher
Public Knowledge Project Team

Thanks @asmecher, I’ll have a look at that!