Docs: Importer

The importer

Bring a ProcessWire or WordPress site into Tilspire: Layouts, pages, images, links, redirects and menus, with a dry run and an undo.

The importer brings another site's content into Tilspire: its page types, pages, images, links, redirects and menus. It reads ProcessWire sites, and WordPress sites with or without Advanced Custom Fields. It arrived in 1.17.0, is free, and is off until you enable it. Since 1.21.0 the panel calls the module Migrate, because it also lets you take your content out: see Export.

What it brings over #

  • Page types become Layouts, with their fields: text, rich text, numbers, options, checkboxes, images, page references and repeaters.
  • Pages in their tree, with their addresses, original dates and status (an unpublished page becomes a draft). WordPress posts and pages, with their categories and ACF fields.
  • Images: the originals only. Tilspire makes its own sizes. Since 1.19.0 they go into the media library, in month folders.
  • Links in rich text are rewritten to the new pages and images.
  • Redirects: a permanent redirect for every page whose address changed, so old links and search results keep working.
  • Menus, with their order and nesting.
  • Order, hidden and options (since 1.20.2): a page's place among its siblings becomes its Sort value, a hidden page or post stays hidden, and a select's option values come with its values.
  • Blog post fields (since 1.20.2): a post's own custom fields. A ProcessWire row with a category part offers every category's fields, each marked with the category it belongs to; a WordPress row offers exactly its category's. Nothing is guessed from a key's likeness, and a published post missing a required value is skipped and named.
  • WordPress scheduled posts stay scheduled Blog posts; if their time has already passed they become drafts. A password-protected post stays a draft. Border colour, list style and table width styles in rich text are kept.
  • WordPress comments, approved and waiting, through the Comments module. Spam, trash and pingbacks stay behind, and so does a commenter's email and address.

Users, roles and the old site's admin settings are not imported.

Before you start #

Copy the old site's database into a database on your server, and its uploaded files into a folder outside your web root. Then add that source. Since 1.19.2 you can do it in the panel: the Source step lets you add, test, edit and remove a source. Saving a password asks for your password and a code, and the password is encrypted under a key Tilspire writes to site/config/config.php. It is never shown again, so back that file up. You can still name a source in site/config/config.php instead, as before; the steps are in the module's README.md. Nothing is fetched over the internet.

Running an import #

Enable Importer under System ▸ Modules, and open System ▸ Import. The wizard has five steps:

  1. Source: pick the old site and test the connection.
  2. Match the fields: for each page type, make a new Layout, use one you have, or leave it out. Since 1.19.0 a Becomes table at the top of this step sends each source category (WordPress) or template (ProcessWire) to Pages, Blog posts or Leave out. Redirects, links and menus follow where each one went. Blog posts need the Blog module to be on. Two options, both off by default, add a post's image fields to the end of its body and import library images that no content uses. Since 1.20.2 Try one page shows what one chosen page would become under the mapping on screen, saved or not, and writes nothing. It reads the source afresh each time, so on a very large site each try takes some seconds.
  3. Dry run: it changes no content, and reports what an import would create, change and leave out. Since 1.20.2 its counts are a plain list of decisions with what a reader would lose, each with an example page that opens Try one page; carrying on is accepting. External links and images are grouped by host, and a host that looks like the old site is offered with one tick to add it. A source in another time zone is offered too, with the switch off.
  4. Import: it takes a database snapshot first, works in small steps and picks up where it stopped if you close the tab. Since 1.20.1 the current step shows a live count, such as 2,661 of 4,924 files, and the bar fills within the step.
  5. Report: what was done, with Undo. Since 1.20.2 it lists What to do next: the time zone still on offer, a home page kept or one that lost a picture, files that did not come, links that lead nowhere and old addresses leading to drafts.

Since 1.19.2 Match is a list beside the open item and saves as you go: close the tab and carry on later, or choose Start over. You can also export your choices to a file and load them again. Authors: each author of the old site is matched to a staff account, picked, made as a new account in a role you choose, or given to you. New accounts start switched off and are listed in the report for you to switch on in Users; an author's address is never kept. Branches (ProcessWire): send a page and everything below it to the Blog, under a category you choose.

Since 1.20.0 every dry run and every import writes a log file, and Download log fetches it from the dry-run result and from the Report step. A log holds no secret and no error text from the old database. The Import logs card sets how many days they are kept, 90 by default.

The same runs are available from the command line, for a large site.

Check the result #

Since 1.20.2, on the done page and any time after, Check the result compares the pages and posts with the source by the last import's own mapping, and lists the redirect and link problems a visitor would meet: pages that are draft, redirected or missing. It writes nothing. Its download gives old address, new address and status. An item someone edited, or whose source changed, is never called a mismatch.

Corrections #

Since 1.20.2 a correction applies one part again, covers, dates, order, values or files, to the items nobody has edited, from the source's card, without starting over. A count comes first and writes nothing, and Apply asks you to confirm again. Edited, deleted, translated and already equal items are reported and left alone. An empty value at the source never clears one here. Bringing files fetches those that turned up later; it rebuilds that gallery from the source as it stands. A corrected item stays the import's own, so Undo still removes it. Old and new dates go into the correction's log. A correction stops, with a reason, if the latest dry run holds a block or the source is gone.

Old image addresses #

Since 1.20.2 each file the importer brought in answers its old address with a permanent redirect to its new one, so links from elsewhere to the old site's images keep working, with no redirect rule per file. A switch in Settings ▸ SEO, on by default, turns it off. The answer only ever points into the media library. The shipped .htaccess sends a missing image under site/assets/files/ or wp-content/uploads/ to Tilspire for this; on nginx those addresses stay a 404, and no server change is needed. A file name with a space never answers.

Sister sites #

Since 1.20.2 a source named in site/config/config.php can declare another site the same owner runs, with sister_sites. Its images and links come in from a local folder you name, and links to it can move to its new address, keeping path, query and fragment. Nothing is fetched from the sister site: a file the folder lacks keeps its old address and is listed in the dry run.

Since 1.21.0 a source set up in the panel has an Other sites card for the other sites that the old site's pages link to or load images from. For each one, at most ten, you give its host, then a folder holding a copy of its uploads, the address it lives at now, or both. The folder must exist, be readable by the web server and be outside this site's own folder, which may not sit inside it. A host may not be the old site's address and may not be named twice. Changing the list is changing the source, so it needs both import permissions, asks you to confirm it is you, and is refused while a run of that source is open. A refused row is marked on the form.

Undo #

Undo removes what the import created, Blog posts and categories included, with the redirects, links and menu items that went with them. Anything a person edited since is kept, and listed in the report.

  • The pages and posts go to the recycle bin. Since 1.21.0 Undo sends them to the site's recycle bin, marked "Undone import", and the row offers Open the recycle bin to anyone who may see it.
  • Layouts stay while a page uses them. A page in the bin keeps its Layout, so a restore never brings it back on a Layout that is gone. Undo therefore keeps the Layouts those pages use, with their groups and fields, and explains each with "A page in the recycle bin still uses it. Delete that page for good, then undo again." The run ends "Done, with problems". Delete those pages from the bin and run Undo again to remove the rest.

Files kept after an undo #

An undo sets the images it takes back aside in the site's drafts folder. Before 1.21.0 nothing ever removed them, so a few imports and undos could leave hundreds of MB. Since 1.21.0 the Importer has a Files kept after an undo card. You can remove one undo's files, or the files no undo names any more, and the card shows what it takes. Removal is for good, asks you to confirm it is you, and is refused while any import, undo or correction is unfinished.

  • Remove set-aside files after (days) is 0 by default, which removes nothing; it can be 0 to 3650. Above 0, a daily job removes the files of an undo that finished longer ago than that. Changing it to a lower number asks you to confirm it is you, because that deletes sooner.
  • Files of an undo whose pages or posts are still in the recycle bin are kept until the bin lets them go. After a removal, a later undo of the same import reports those originals as gone.
  • A page or post restored from the recycle bin does not get back the files an Undo set aside, so its images show missing until someone uploads them again. Restore the page, upload the images again, and leave the removal off until you have checked.
  • Uninstalling the Importer without keeping its data leaves these files, and a later reinstall with days above 0 deletes them all. Set the days to 0 first, or copy the files out, if you want them.

Taking content out #

Since 1.21.0 the same module has an Export page for leaving Tilspire, or keeping a copy of your own: a full archive, a WordPress file and a redirect map. It has its own page: Export.

Who may import #

Importing needs the Import another site's content permission together with the permissions to manage pages, Layouts, media, redirects and menus. Importing comments also needs Manage comment settings, and sending anything to the Blog needs Write and manage blog posts. Setting up a source needs its own permission, Set up, test and remove the sources an import reads from, which the top role holds by default.