Git Product home page Git Product logo

themarcusbattle / press-sync Goto Github PK

View Code? Open in Web Editor NEW
25.0 3.0 6.0 351 KB

The easiest way to synchronize posts, media, users and more between two WordPress sites.

Home Page: http://presssync.com

JavaScript 3.47% PHP 96.53%
wordpress wordpress-plugin content-management staging-server development-environment migration wordpress-importer wordpress-exporter migration-tool wordpress-site

press-sync's Introduction

Press Sync by Marcus Battle

An easy and straightforward way to syncrchonize users, posts and more between multiple WordPress sites. Activate the plugin on both sites that you want to sync content with and you immediately will have a connection to push content to.

Uses the WP-API. Custom Post Type Support. Currently supports push only. Alpha Version. Use at own risk.

For support, email [email protected]

How to Install/Use

  1. Install the plugin on both servers you want to synchronize
  2. On your target server, create a "PressSync Key" to allow the WordPress site to receive data
  3. On your push server, create a connection to the target server using the "PressSync Key"
  4. Select the type of content you want to push, click "Save"
  5. Press "Sync" to synchronize the data. Done!

Supports syncing the following data:

  • WP Users, WP Posts, WP Media and WP Comments
  • Custom Post Types
  • Featured Images
  • Categories, Tags and Custom Taxonomies
  • Post & User Meta
  • Posts 2 Posts Relationships

Changelog.

v0.9.2

  • [AOTECH-6795] Adds the ability to pass in any Press Sync options to the command line for syncing "All" and "Posts", see the CLI section "Setting Arbitrary Options" below.
  • Press Sync settings can be filtered using the press_sync_settings hook, which is executed immediately before the parsed settings are passed to the application.

v0.9.1

  • [AOTECH-6793] - Post dates of "0000-00-00 00:00:00" are discarded by wp_insert_post - these dates will now be set to the unix epoch before being inserted.
  • "Advanced" tab now shows for all users, however you get a blurb about how to enable the features if you don't have the advanced features filter set in your code.

v0.9.0

  • [AOTECH-6774] - Fix issue where incredibly large payloads were truncating data by adding ability to sync partial term data.
  • [AOTECH-6776] - Fix bad serialization of metadata for featured images.
  • [feature/dashboard-updates] - Cleans up the Dashboard to remove "Advanced Import/Export" and replace with a combined "Advanced" tab. Moving forward, settings should be defined on the source site and propagated to the remote site, regardless of whether the option applies on the sender or receiver.

v0.8.0

  • [AOTECH-6700] - Preserve proper taxonomy terms and meta when syncing posts.
  • [AOTECH-6704] - Fixes author lookups for multisite migrations.
  • [AOTECH-6705] - Adds the ability to migrate posts only after a certain date.

v0.7.3

  • [AOTECH-6678] - Fixes sycning "All" so that the browser doesn't lock.
  • [AOTECH-6691] - Pages weren't syncing due to incorrect handler being used.
  • [AOTECH-6691] - Addressed minor JS bug in single-type migrations.

v0.7.2

  • [AOTECH-6676] - Simplifies ID lookup when "Preserve IDs" is selected under Advanced Export.

v0.7.1

  • [AOTECH-6676] - Add ability to fix broken relationships.

v0.7.0

  • [AOTECH-6661] - Add Taxonomies and Terms as a Sync Object type.
  • [AOTECH-6662] - Add attachment media meta.
  • Better support for finding and syncing missing objects.

v0.6.1

  • Update README for updated Dashboard and installation.
  • Reintroduce SPL autoloader for non-composer setups.

v0.6.0

  • Merge in major functional updates for Bulk Sync.

v0.5.0

  • Overhauled the dashboard for better UX

v0.4.5

  • Update lookup for post parent to be able to ignore post_type.

  • v0.4.1 - Fixed the WP Coding Standards / PHPCS errors

  • v0.4.0 - Replaced CMB2 Support with native WP Options

  • v0.3.0 - Added WP Options migrations to the plugin.

  • v0.2.0 - Addition of CLI support.

  • v0.1.0 - The initial commit and development of Press Sync.

Installation

Using composer

If you have composer on your system, simply run composer dump-autoload to generate an autoloader classmap.

Non-composer

The plugin still works without composer and will register an autoloader using spl_autoload_register.

Usage

WordPress Admin

Press Sync can be found in the WordPress admin under Tools -> Press Sync. There are two tabs for configuring Press Sync - the Sync tab and the Settings tab.

Press Sync Dashboard

The Credentials tab is where you'll conifgure your Press Sync installation to connect to another WordPress site.

  • Press Sync Key - You should make this key unique and complex, and only share it with the other site that will be connecting to this site. It is strongly recommended that you connect to sites over SSL to avoid your key being transmitted in plaintext.
  • Remote Domain - The remote domain of the site you are connecting to. This site should have Press Sync installed and configured.
  • Remote URL Arguments - This is an advanced setting that you can use to supply additional arguments to the request URL. You should format this string as an HTTP GET query string, starting with a ? (question mark). See https://en.wikipedia.org/wiki/Query_string for more details.
  • Remote Press Sync Key - The Press Sync key configured in the Settings tab of the remote site's Press Sync configuration.

Once configured to connect to a remote Press Sync site, you can configure your sync job on the Bulk Sync tab. Options on that tab include.

  • Sync Method - Determine whether you're Pushing content to a remote site or Pulling content from a remote site. Currently the only method available here is "Push".
  • Objects to Sync - This list allows you to pick what type of content to Sync. WordPress built-ins like Post and Page are supported, as well as Custom Post Types.
  • WP Options to Sync - If your Objects to Sync is set to "Options", this field is used as a comma-separated whitelist of options to sync. Only the options specified in this field will be Pushed to the remote site.
  • Duplicate Action - Choose what action Press Sync should take when a duplicate record is found on the receiving side. When Sync is the selected action, non-synced duplicates will receive a Press Sync meta key to allow them to be synced in the future.
  • Force Update - By default, Press Sync only updates content that was modified more recently than it's synced counterpart. If this option is ste to "Yes", content will always be synced regardless of modified date.
  • Ignore Comments - Whether or not Comments should be synced with posts.

Command Line

Press Sync also includes the ability to sync content via the command line using WP-CLI. With Press Sync enabled and WP-CLI installed, you can see a list of basic commands:

$ wp press-sync
usage: wp press-sync media --remote_domain=<remote_domain> --remote_press_sync_key=<remote_press_sync_key> [--local_folder=<local_folder>]
   or: wp press-sync options --remote_domain=<remote_domain> --remote_press_sync_key=<remote_press_sync_key> [--options=<options>] [--local_folder=<local_folder>]
   or: wp press-sync pages --remote_domain=<remote_domain> --remote_press_sync_key=<remote_press_sync_key> [--local_folder=<local_folder>]
   or: wp press-sync posts --remote_domain=<remote_domain> --remote_press_sync_key=<remote_press_sync_key> [--local_folder=<local_folder>]
   or: wp press-sync users --remote_domain=<remote_domain> --remote_press_sync_key=<remote_press_sync_key> [--local_folder=<local_folder>]

Currently, Press Sync's CLI support includes Posts, Pages, Users, Options, and Media.

Common Arguments

All Press Sync CLI commands use the following required parameters:

  • --remote-domain - The remote site you are connecting to.
  • --remote_press_sync_key - The remote site's Press Sync Key, used to authenticate the connection.
  • --local_folder - This option allows you to use JSON files instead of local WordPress data to push to the remote site. More on this below.

Command-Specific Arguments

Some commands take optional parameters.

  • wp press-sync options
    • --options - A comma-separated list of option fields to sync.

Setting Arbitrary Options

For the All and Posts sync commands, any number of arbitrary options may be passed in that are valid Press Sync options. For example, the database option for preserving post-type object IDs can be set at runtime with --ps-preserve-ids=1, e.g.

wp press-sync posts --ps-date-delta="2017/06/23" --ps-fix-terms=false --ps-batch-size=8

This command would sync posts modified after June 23, 2017, would not attempt to fix term relationships (overriding any value set in the database), and specifies a batch size of 8. Note that advanced options are still usable here, even if the press_sync_show_advanced_options filter is not set to return true.

Importing Local JSON

The --local_folder folder option allows you to specify a folder with JSON data to push to the remote site instead of using the hosting WordPress site's data. This is useful for importing data from systems that aren't necessarily WordPress, but that can export their data in an easy-to-use form.

Structurally, your JSON files should be laid out like this:

+--local_folder
|
| ./posts/
| ./posts/YYYY
| ./posts/YYYY/slugged-title.json
| ./attachments.json
| ./users.json
| ./options.json

For Posts (and post-like objects such as Pages or CPTs), the JSON files should be located in a folder called posts/YYYY/, where YYYY is the four-digit year for the post.

All other types supported by CLI should be in the root of the folder specified in --local_folder as such:

  • Media - attachments.json
  • Users - users.json
  • Options - options.json

press-sync's People

Contributors

jrfoell avatar phatsk avatar themarcusbattle 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

Watchers

 avatar  avatar  avatar

press-sync's Issues

Deprecated use of the "options" field parameter as a callback.

The "Objects to Sync" field in the dashboard is using the "options" field parameter as a callback when it should be using "options_cb" instead.

Error

PHP Notice: CMB2_Field::__construct() was called with a parameter that is deprecated since version 2.2.3! Using the "options" field parameter as a callback has been deprecated in favor of the "options_cb" parameter. in ../wp-content/plugins/cmb2/includes/CMB2_Base.php on line 423

Screenshot:
screen shot 2017-04-19 at 1 41 19 pm

Add ability for "Post Sync"

The original vision of this project was to be able to sync individual posts to a remote site. This will be the main task to accomplish to move the project from alpha to beta version and publish.

The sync "all" option runs asynchronously from the dashboard

The ideal way to fix this is to add the parameter "async: false" to the syncData() method in press-sync.js, but @phatsk reported memory issues with this implementation. Logging an issue here so that more research can be done to create a more performant solution.

In the meantime you may notice that using "all" will complete the sync as desired, but jumble the order of the objects as they are communicated via the dashboard.

Status: Not connected

Hello,

I did a test, but status is always Not connected, does it work with wordpress 5.5.1 please?

Thanks

Add Logging to the Main Interface

This should include logging responses from the remote server in some kind of useful way.

Currently, I have logging working for a couple of Object Types - this needs to be refactored into a unified logging interface to support logs from other object types.

Suggest moving "advanced export" features

Hey guys, in doing some testing some advanced export features, I found the user experience workflow to be cumbersome. Mostly because changing a value and (re)syncing takes 4 steps:

press sync news wordpress

Suggest that either the "sync" button gets duplicated on the Advanced Export tab, or that the advanced fields simply get added to the Bulk Sync page (possibly under an advanced heading) once they're enabled.

Multi Credential

Hi team, I want to ask you about multi Credential, because i want to Bulk Sync more multipage with one click so How to make more remote domain in Tab Credential and save them ? Please help me, Thank you so much if you reply me

Need to load CMB2 if the plugin is not activated

Press Sync has a directory for CMB2 inside includes/third-party, but it's empty. If CMB2 is not installed/activated as a plugin, form fields do not render on the Press Sync dashboard. We should probably A) include the library in case the plugin is not installed, and B) check whether the plugin is already installed or active before loading the library we included.

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.