GithubHelp home page GithubHelp logo

psaia / peach Goto Github PK

View Code? Open in Web Editor NEW
40.0 6.0 13.0 492 KB

A cute javascript/html5 app to safely migrate a database with serialized PHP objects.

Home Page: http://psaia.github.com/Peach/

CSS 25.11% JavaScript 47.41% HTML 16.20% CoffeeScript 11.29%

peach's Introduction

Why

As you probably know, migrating a WordPress database from one domain to another can be a bit of a hassle. Two major things must happen for it to be a seamless migration; Find & replace the domain and fix the serialized url's containing the old domain. This tool does that for you. No need to run a bash script on every migration. Simply drag the sql dump into the square and set a new domain.

Use

Frontend

For front-end use see ui.js in the assets directory. It's probably easier just to use the online verson: http://psaia.github.io/Peach/

Backend

Peach can be useful for continuous integration when working with Wordpress sites.

var dbdump = fs.readFileSync("./old-database.sql");
var Peach = require("peach");

var oldDomain = Peach.wp_domain(dbdump); // Helper to get current domain name.
var migration = Peach.migrate(dbdump, oldDomain, "http://your-new-domain.com");

migration.processed_file(); // The new sql file.

// Extra public properties.
migration.old_domain;
migration.new_domain;
migration.serialized_count; // Number of serializations.
migration.replaced_count; // Number of replacements.
migration.char_diff; // Difference in characters. e.g. -4 || 2 || -4

Test

Tests are wrtten in mocha.

npm install
npm test

peach's People

Contributors

harre096 avatar psaia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

peach's Issues

Grunt task?

Hey Pete,

I love Peach, been using it for a while and been linking to it every chance I get.

Have you considered making it into a grunt task? That would be awesome!

Contact Form 7 Email Box Empty After Script Runs

I'm using the WordPress plugin Contact Form 7, and running your script on the database causes the mail fields to become empty in the outputted file. I've included original and post script images of the fields in the backend of WordPress if that helps.

It seems to have something to do with the URL being in the "Message Body" section, which leads me to believe the serialization is choking on that particular field in some way as it tries to update the URL, resulting in serialized data Contact Form 7 doesn't know how to show (so it shows nothing). If I remove the URL from the section and instead say something like "sent from the contact page" then the issue doesn't occur.

before

after

Easy enough to get around for now, but I just thought you'd like to know. Thanks for a great product!

Widget link serialized array remains unchanged

Hi @petesaia,

Thank you for the amazing tool and for making it freely available.

I recently encountered an issue where widgets with internal site links do not get corrected character counts in their serialized arrays and they end up breaking after a migration. See here for a more detailed description.

Thanks again for Peach and for looking into this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.