• nzrink1

    (@nzrink1)


    I’m currently developing a staging site from scratch which eventually will make it as the new production site.

    In the staging site, once I installed the plugin, what’s the best way to import all the settings (API activation details, section settings, theme settings) from the production into this staging site?

    Also, I’m not sure previously the plugin been verified through the old API settings or the new papi file. Do you know how to check that?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Kevin Fodness

    (@kevinfodness)

    API activation details and theme settings are the easy ones. The API activation details should be contained in a .papi file that you create and test locally with the Apple News API CLI (https://github.com/alleyinteractive/apple-news/wiki/configuration#api-settings) and you can import the same file to both environments. If you’re not on a Mac and can’t use the Apple News API CLI, or would rather do this manually, you can paste the contents of that file into a textarea on the settings screen which is visible by clicking a link in the field description text. If you save the contents of that file, you can paste the same settings in both places. Please remember that once you move to production, you should disconnect your staging site from Apple News so that you don’t accidentally publish staging content to your channel.

    Likewise, themes can be exported and imported. In the Apple News > Themes screen you can export any of your themes from staging and then go to the same screen on production and import them. Exporting the themes generates a JSON file which is what you will import to production.

    The harder settings to migrate are the plugin settings that aren’t included in the theme or the API settings. However, unless your setup is very complex, it’s likely pretty quick to copy those settings by hand. It’s possible to use a database tool to extract these settings (look in the wp_options table, or whatever it is called on your setup, and search for settings that start with “apple_news_”). A possible challenge with copying the data from one database to another is that if any of the database IDs are different between environments (e.g., term IDs) you would need to update those in the database script when moving between environments. That’s why I’d recommend copying those settings manually if you can.

    You’re right that older versions of the plugin didn’t use the .papi file for API settings. Under the hood, the channel ID, key, and secret are still stored in the same options fields, but the way the settings are imported has changed. If you already had your channel configured using the old method, it will continue to work, but for setting up a new environment you will either need a .papi file or a text file with the same contents as a .papi file which you can either upload or copy and paste the contents from into the manual entry textarea.

    I hope this helps!

    Thread Starter nzrink1

    (@nzrink1)

    Hi @kevinfodness ,

    Thank you for that detailed explanation. I’ve 2 more further questions regarding associated apple_news data for article posts.

    1. I managed to import all meta_keys except for apple_news_api_json and apple_news_api_bundle . May I know how important these 2 meta_keys are? Because currently in my staging site, it seems all posts are fine without these 2 meta_keys.
    2. Also I believe under WP Dashboard > Apple News > Articles, the sync status is been set to ‘Needs to be updated’ due to the post’s modified date is newer than the apple_news_api_modified_at value. Will this cause any trouble if later on I switch on the auto publish/update to Apple News?
    Plugin Author Kevin Fodness

    (@kevinfodness)

    1. Those keys store the information about the last push for those posts to Apple News. It’s not necessary to migrate those. The downside would be that you might make a change to an article that would get pushed by the plugin but no material changes would be present and the Apple News API might tell you that the article is already in sync, which is an error message you can safely ignore.
    2. It shouldn’t cause problems, no. Autopublish/update would only trigger when a post is saved by an editor, not in the background.

    Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.