Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danielbachhuber/copress-convert

For converting College Publisher 4, College Publisher 5 and other databases to WordPress eXtended RSS
https://github.com/danielbachhuber/copress-convert

Last synced: 19 days ago
JSON representation

For converting College Publisher 4, College Publisher 5 and other databases to WordPress eXtended RSS

Awesome Lists containing this project

README

        

=== CoPress Convert ===
Version 1.0

Current maintainer(s): Daniel Bachhuber
Past contributor(s): Miles Skorpen, Albert Sun, Will Davis, Max Cutler

== Description ==

The CoPress conversion script enables you to convert College Publisher 4, College Publisher 5, and other databases to WordPress eXtended RSS files you can easily import into your existing WordPress website. Quickly and easily migrate your all of your full content data and metadata to a format you can one-click upload into WordPress.

This script can save you hours, if not days, of work migrating your content into WordPress. The final results will not be flawless, however. Frequently, the features available in WordPress and other systems do not perfectly line up, and touch-up would be necessary.

Send suggestions, feature requests, improvements, or bugs to [email protected], or file them on Github http://github.com/danielbachhuber/CoPress-Convert/issues

== Step By Step Instructions ==

First, a Very Important Note: before manipulating any data, make sure you create a valid backup of your entire database (it wouldn't hurt to back up your website as well). Having a full backup of your database means that you can easily restore if something goes wrong with the import process, and SQL copies are preferable over using the WordPress export functionality.

There are a couple of ways you can produce this backup. One, use a desktop program like Sequel Pro http://www.sequelpro.com/ to connect to your server via SSH and download a copy. This is also probably the most straightforward way to restore your database if/when it comes to that. Two, use a plugin like WP DB Backup http://wordpress.org/extend/plugins/wp-db-backup/ to download a copy of your database from the WordPress admin.

A second Important Note, although not as important as the first: between the time you backup your database and the time you've confirmed all of your data was imported successfully, restrict writes to the database. There shouldn't be anyone posting content to your website. If the data migrate doesn't go well, and you need to restore to your backup, then all of the intermediate work will be lost.

With those things in mind, here's how you convert your data:

1) Download the conversion script and place it in a folder you can access from a command line. This conversion script is in Python, which means that you'll need Python installed on your machine.
2) Unzip your archives and place the files in the same folder as the conversion script. College Publisher 4 archives will come with two files, one with your story data and the other mapping image URLs to stories. You should rename these "stories.csv" and "media.csv", respectively. College Publisher 5 archives will just have one file you'll need to rename to "stories.csv"
3) Navigate to the folder in your terminal and run "python CoPress-Convert.py". You should see a notice welcoming you to the conversion script.
4) The conversion script will give you a series of prompts to which you need to respond for it to convert your data:
** If you want to convert a custom database, enter the name of the database. Otherwise, press enter.
** Verbose results will print the output of the script to the screen. This is generally only useful if you need to debug; it makes the entire script run a lot slower otherwise.
** If you only want to import a part of your archives, you specify a date to start from.
** Choose whether or not to import images with this conversion. You'll later be able to specify whether they should be added to the post or appended as custom fields.
** There's a "Run a test" option which will output a test database with default settings to make sure that the database will convert. We recommend running this if repeated iterations are necessary for database are debugging, but these setting should not be used for your final website. If you choose to run a test, you will not be asked to fill in any the settings.
** Add the root URL to your website. This is especially important if you're importing a custom database.
** Indicate whether you want authors imported as users or custom fields. The latter is recommended for databases with 500+ users because, as of 2.9.2, WordPress is not optimized for importing a large number of authors as users.
** Indicate whether you want images imported into each post or appended as custom fields. Custom fields will give you more flexibility over how the images are presented.
5) After the script has run, a folder called "Output" will contain all of the WordPress eXtended RSS files generated. This is what you'll import into WordPress.
6) Log in to your website. If you chose to import your authors as custom fields, make sure you create a user that you want to import the post under. Navigate to Tools -> Import where you'll be presented with a series of systems you can import from. Choose "WordPress" as what you'll be importing.
7) Import each of the WordPress eXtended RSS files generated by the conversion script. With each, you'll be presented with a prompt to first select the file you want to upload and then how you want to map the users. WordPress will generate an output with the status of how each post was imported.
8) After you've imported your content, you'll want to upload your digital assets to a folder called "media" off your web root. The conversion script assumes all images are placed in that folder.
9) If you imported authors as custom fields, that data is stored in a custom field called "author". Likewise, images imported as custom fields are storied in a custom field called "image." You'll need to add PHP to your WordPress theme in order to expose this information where it exists.

If you completed, all of the steps above successfully, congratulations! You've migrated your database.

== How To Use Data Saved In Custom Fields ==

If, in the conversion process, you indicate you'd like either authors or images stored in custom fields, there will be a small amount of additional work you'll need to do. Custom fields make WordPress significantly more flexible, but your theme will need to be modified to handle the data properly.

For exposing author information, you can use a snippet like this:

ID, 'author', true);
if ($author) { echo $author; } else { the_author(); } ?>

What this snippet will do is show the author metadata if it exists in a custom field, otherwise show the WordPress saved user information.

For exposing images, the snippet is a little bit more complex:

ID, 'image');
if ($images) {
foreach ($images as $image) {
$image = explode('{}', $image);
echo '


';
if ($image[1]) {
echo '

' . $image[1] . '

';
}
echo '
';
}
} ?>

Basically, what this snippet does is gets one or multiple custom fields with the key "image", and then displays each image and credit if available.

== Frequently Asked Questions ==

Hooray! There aren't any frequently asked questions yet.

== Changelog ==

= Version 1.0 =
* Fixed issue with CP5 image paths and inserting into posts

= Version 0.9 =
* Fixed adding images as custom fields for both CP4 and CP4
* Support for adding multiple categories to a post
* Fixed date conversion issue
* Migrated code base into one file