Support » Plugin: WordPress Gallery Plugin - NextGEN Gallery » Template directory storage location

  • Hello,

    I have moved a site from one server to another. Now, all of the template locations still represent the file structure on the old server.

    [Not a valid template]

    • I have cleared transients.
    • I have ‘reset all options’ from the NextGen admin.
    • I have cleared the image cache
    • I have searched in every file and every database field for where the /old/server/path/template.php/ is even stored to no avail.

    Where is this location string stored so that I can programmatically change it on deployment of my site?

    https://wordpress.org/plugins/nextgen-gallery/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author photocrati

    (@photocrati)

    @chrisphilton – Generally a combination of using the Reset Option (as noted) and clearing the image cache (also as noted) will sort out any migration issues.

    The only thing that would cause this to not work that we have seen is caching plugins/services still maintaining the incorrect path … have you cleared *all* caches on the site (and server) and tested with an anonymous browser window?

    – Cais.

    I have cleared all caches server side and client side, opened in a private window.

    Just for more clarification, this is in regard to already existing posts that have galleries attached to them. The ‘attach new’ dialogue is fine. The already existing posts are what are showing the entire old server path as well as resulting in [Not a Valid Template].

    Honestly, in the Attatch to Post pop dialogue… I can’t find any of the values stored anywhere in the DB or cache at all.

    Are those stored on a 3rd party server? Or hashed in the DB somehow?

    I found display_settings hashed in postmeta.

    1. Why would you hash anything for your plugin? Especially setting information that contains information that is environment specific and potentially needs to be systematically updated?

    2. Is there a way to update all of the display_settings systematically when I go from local -> staging -> production?

    Chris

    Plugin Author photocrati

    (@photocrati)

    @chrisphilton – In most cases simply clearing the image cache under Gallery > Other Options > Miscellaneous will sort out those paths but in some cases you need to run the Reset Option first, especially in “migrated” sites as the inserted displays are designed to maintain their specific settings across the site at all times.

    In the rare cases of the internal Reset Option not sorting this out, then we suggest using our external Reset Tool plugin. Here’s a link for future reference: https://bitbucket.org/photocrati/nextgen-gallery-reset/get/default.zip

    Thanks!

    – Cais.

    @photocrati – I ran the reset tool to no avail. The reset option doesn’t effect individual instances of Attach to Post Display Settings.

    The default display settings change just fine, but the Display Settings per post are hashed in wp_postmeta and do not change.

    – Chris

    @photocrati – Honestly, I’ve been looking through lots of old support forums and many people have this exact same issue.

    You keep saying in those threads, ‘resetting options should fix it’ and ‘migration’ is not a common scenario.

    Many developers have ‘local’, ‘staging’, and ‘production’ environments that they regularly deploy between. I also think that it should be clear to you by now that using your external reset tool doesn’t decrypt hard coded Base64 post attachment settings (WHY WOULD YOU DO THAT?!?!?) and re-encrypt them in the database.

    Do you understand the problem that we all have? If so, why do you keep responding as if you do not?

    https://wordpress.org/support/topic/template-absolute-path-and-migration-to-other-hosting

    Plugin Author photocrati

    (@photocrati)

    @chrisphilton – With the obvious few exceptions the Reset Option / Reset Tool will correct the problems with paths not being changed by clearing the image cache under Gallery > Other Options > Miscellaneous.

    Please send us a Bug Report (http://nextgen-gallery.com/report-bug/ … please reference this topic) so we can get a better look under the page at your site.

    We may need temporary log in (and FTP) credentials for your WordPress installation, please consider those for your Bug Report, too.

    Thanks!

    – Cais.

    Benjamin

    (@benjaminowens)

    Why would you hash anything for your plugin? Especially setting information that contains information that is environment specific and potentially needs to be systematically updated?

    Galleries created by our “Attach to Post” window are stored as a hash in a custom post type to avoid creating another mysql table.

    Is there a way to update all of the display_settings systematically when I go from local -> staging -> production?

    Not “Attach to Post” galleries; their settings are persistent (note that changing global settings in Gallery Settings does not change the settings of an ATP gallery). Shortcodes are easier to manage in that respect.

    Making that dialog generate shortcodes with a visual placeholder is a common feature request we intend to implement soon (ish).

    But why hash? You could instead use something like JSON? You wouldn’t need to make a new table, and you wouldn’t prevent scripts from systematically updating database instances of (unnecessarily) hard coded directories?

    Benjamin

    (@benjaminowens)

    I can’t say with certainty why a hash was chosen over JSON though I will note that NextGen 1.9x didn’t really use JSON at all either.

    Scripters aren’t stopped from updating ATP galleries; it just requires a certain process. One could query wp_posts for post_type = displayed_gallery and then unserialize() its post-content, alter the display gallery object’s ‘template’ path, and then restore.

    You could also add a filter to ‘ngg_gallery_object’ to alter the template attribute at runtime.

    To use the NextGen 2 API you could also do this once:

    $mapper = C_Displayed_Gallery_Mapper::get_instance();
    foreach($mapper->find_all() as $gallery) {
        $gallery->display_settings['template'] = alter_as_needed();
        $mapper->save($gallery);
    }

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Template directory storage location’ is closed to new replies.