• Hi there,

    Apparently polylang and wp-migrate-db don’t work greatly side by side.

    I use wp-migrate-db to migrate my db from development to production (changing all the url instances from one place to another).

    But when I’m migrating data with polylang installed I receive a bunch of notices and warnings, apparently the serialize/unserialize functions of wp-migrate-db don’t know what to do with polylang objects…

    Anyone has experience with this? Some idea on how to get around it?

    https://ww.wp.xz.cn/plugins/polylang/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter yivi

    (@yivi)

    I have my a separate fork for wp-migrate-db, so I’d have no problem modifying it; and it seems that the problematic code would be around here, but I’m a bit out of my depth:

    function recursive_unserialize_replace( $data, $serialized = false, $parent_serialized = false ) {
    
            // some unseriliased data cannot be re-serialized eg. SimpleXMLElements
            try {
    
                if ( is_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
                    $data = $this->recursive_unserialize_replace( $unserialized, true, true );
                }
                elseif ( is_array( $data ) ) {
                    $_tmp = array( );
                    foreach ( $data as $key => $value ) {
                        $_tmp[ $key ] = $this->recursive_unserialize_replace( $value, false, $parent_serialized );
                    }
    
                    $data = $_tmp;
                    unset( $_tmp );
                }
                // Submitted by Tina Matter
                elseif ( is_object( $data ) ) {
                    $dataClass = get_class( $data );
                    $_tmp = new $dataClass( );
                    foreach ( $data as $key => $value ) {
                        $_tmp->$key = $this->recursive_unserialize_replace( $value, false, $parent_serialized );
                    }

    Thanks and regards,

    Thread Starter yivi

    (@yivi)

    Maybe using $_tmp clone($data), instead of $new ($dataClass)?

    But the language object should provide a “clone” method, right?

    Plugin Author Chouby

    (@chouby)

    I don’t know wp-migrate-db but I imagine that such migration may going wrong due to some caching done by Polylang. search for the ‘_transient_pll_languages_list’ entry in wp_options and delete it. It should be automatically re-created with hopefully right values at first page load.

    charl0s

    (@charl0s)

    Chouby, I did what you say “search for the ‘_transient_pll_languages_list’ entry in wp_options and delete it. It should be automatically re-created with hopefully right values at first page load”

    Now, when I switch to English language (default is Spanish) I get a 404 page. In Setting page it says that there are pages, posts, categories and tag without language. But When I look for pages all them has the default language version and its english version also.

    Sorry, my english is not very good.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘polylang and wp-migrate-db’ is closed to new replies.