• When I attempt to import settings that I have saved in Nirvana, nothing appears to happen. In my attempt to debug, I have tried this script to unserialize the exported data and look at it:

    <?php
    $s = file_get_contents(“nirvana-export.txt”);
    print $s;
    $x = unserialize($s);
    print_r($x);
    ?>

    It also prints nothing. Any hints on how to debug what’s going on? I’m not seeing any errors or warnings.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter hallcp

    (@hallcp)

    I’ve done a little more checking and I believe the issue is that it is a multi-site installation on a Unix server, and the FTP access is the problem. Does anyone know what files Nirvana is trying to access? If I knew, I could check permissions.

    Thanks.

    Charles.

    Thread Starter hallcp

    (@hallcp)

    OK, I’ve spent two more days on this and I know a lot more now. As written, this functionality will never work with a site using the FTP transport method. Here’s what happens for a direct (non-FTP) scenario:

    1. You browse to your local file, and click import.
    2. The browser uploads the file and checks the user’s file-write-credentials with request_filesystem_credentials(…).
    3. If the user has credentials, the settings are updated.

    But with FTP, the request_filesystem_credentials() triggers an intermediate page that requests FTP credentials. Then you have to check credentials a second time, the function returns true, and you save the file.

    So the two problems with this script are:

    A) It only checks credentials once.
    B) The intermediate page requesting FTP credentials flushes out the newly uploaded settings file from it’s temporary home.

    It would take a total rewrite of this code’s logic to make this work properly.

    Thread Starter hallcp

    (@hallcp)

    Hah! Well here’s a fix. I don’t know why but the code is trying to write out a file called “nirvanas.txt” to the blog’s upload directory. But it then proceeds to load it into the database. Why not just upload the originally uploaded file from it’s temporary location and skip writing out that intermediate file?

    So just comment out all the lines in admin-functions.php nirvana_import_file() function having to do with credentials: 138-140, 142, 144-146, 149, 150, 153-157. And change line 162 from this:

    $data = $wp_filesystem->get_contents($filename);

    to this:

    $data = file_get_contents($_FILES[‘import’][‘tmp_name’]);

    and it works!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Nirvana theme "import settings" not working’ is closed to new replies.