Snapshots can't back up uploads folder if Wordpress is installed in a subfolder.

Our wordpress install is in a sub-folder. Snapshot can't create a backup of uploads folder, but can backup plugins and themes folder. I noticed that the Media files (uploads) folder path is the file system path (Drive/directory/wp-content/uploads).

  • Paul

    @Cornell Birds,

    I guess my first question back to you is what evidence leads you to believe Snapshot is not including the media files? Give me something that shows it is not, please.

    I just ran a quick test on my own development system. I quickly setup WordPress in a /wp/ sub-directory. I then uploaded some images I had handy. I then installed Snapshot and ran a quick backup including themes, plugins and media files along with all database tables.

    When I inspect the zip archive I see all expected files. See below

    >$ unzip snapshot-1400184634-140515-201034-9caaecce.zip
    Archive: snapshot-1400184634-140515-201034-9caaecce.zip
    inflating: wp_commentmeta.sql
    inflating: wp_comments.sql
    inflating: wp_links.sql
    inflating: wp_options.sql
    inflating: wp_postmeta.sql
    inflating: wp_posts.sql
    inflating: wp_term_relationships.sql
    inflating: wp_term_taxonomy.sql
    inflating: wp_terms.sql
    inflating: wp_usermeta.sql
    inflating: wp_users.sql
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1453-150x150.png
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1453-300x213.png
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1453-672x372.png
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1453.png
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1454-150x150.png
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1454-228x300.png
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1454-545x372.png
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1454-545x576.png
    inflating: www/wp-content/uploads/2014/05/2014-04-11_1454.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_1456-150x150.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_1456-300x135.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_1456.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_1832-150x150.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_1832-300x81.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_1832-672x262.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_1832.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_2000-150x150.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_2000-300x61.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_2000-672x204.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_2000.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_2001-150x150.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_2001-300x94.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_2001-672x270.png
    inflating: www/wp-content/uploads/2014/05/2014-04-14_2001.png
    inflating: www/wp-content/plugins/hello.php
    inflating: www/wp-content/plugins/index.php
    inflating: www/wp-content/plugins/akismet/akismet.php
    inflating: www/wp-content/plugins/akismet/class.akismet-admin.php
    inflating: www/wp-content/plugins/akismet/class.akismet-widget.php
    inflating: www/wp-content/plugins/akismet/class.akismet.php
    inflating: www/wp-content/plugins/akismet/index.php
    inflating: www/wp-content/plugins/akismet/readme.txt
    inflating: www/wp-content/plugins/akismet/wrapper.php
    inflating: www/wp-content/plugins/akismet/_inc/akismet.css
    inflating: www/wp-content/plugins/akismet/_inc/akismet.js

  • Cornell Birds

    Here is the snapshot log (just the uploads folder).
    2014-05-16 08:25:00: Backup: init
    2014-05-16 08:25:00: updating snapshot: 1400184241
    2014-05-16 08:25:00: backupZipFolder[]
    2014-05-16 08:25:00: rename: backupZipFile[/Users/tap87/Sites/biology.dev/wp-content/uploads/snapshot/_backup/1400184241/snapshot-backup.zip] backupZipFileFinal[/Users/tap87/Sites/biology.dev/wp-content/uploads/snapshot/snapshot-1400184241-140516-132440-cf92ae16.zip]
    2014-05-16 08:25:00: finish: snapshot-1400184241-140516-132440-cf92ae16.zip

    We have a windows server.

  • Paul

    @Cornell Birds,

    We are using a Windows server

    Ok. Will need to investigate further when I get a chance. Snapshot does work on Windows but not sure how WordPress running in a sub-directory would effect it. Technically snapshot just calls a WordPress function to figure out the directory to the uploads directory.

    Is your uploads path standard? Meaning in a default setup the uploads folder is 'wp-content/uploads'. So does not matter at what level WordPress is installed the wp-content should always be below it.

    Unless of course you are forcing WordPress to use a non-standard location for wp-content/uploads. http://codex.wordpress.org/Editing_wp-config.php#Moving_uploads_folder

    But again snapshot really just calls a WordPress function wp_upload_dir() which returns the path and url to the uploads base.

    I think I have an old GoDaddy Windows host somewhere. Let me do some testing with WordPress installed in a sub-directory.

  • Paul

    @Cornell Birds,

    I have wordpress install in the wp subfolder, but the wp-content folder in in the root folder.

    Then this does contradict your previous reply "Yes, the uploads folder is in the standard location."

    As I mentioned previous in a standard WordPress install the wp-content/uploads folder will always be relative to the WP install location. so for your install (if it were standard) the wp-content/uploads folder would be

    /Users/tap87/Sites/biology.dev/wp/wp-content/uploads/

    but instead you are saying the wp-content is off the root. So you mean

    /Users/tap87/Sites/biology.dev/wp-content/

    And yes, in looking at the log example you provided from the Snapshot run I see wp-content is in face off the root. Hmm. Yet snapshot know to store its own content there.

    So I guess my next question about your setup is how is it you have wp-content off the root instead of within the /wp/ folder? There are configuration options to allow for this and those should invisible to snapshot.

    I guess my quick and final question here is would it be possible to have access to your site directly. Obviously this is getting rather involved and I no longer have confidence in being able to setup a test environment to match your own. So the only real way to get this resolved and see what is going on is to have first hand access to the site and preferably the server so I can add debug output to snapshot.

  • Cornell Birds

    I realized my earlier mistake quickly and sent you the corrected location of wp-content folder.
    Here is the setting in wp-config which make this folder structure work.
    / ========================
    // Custom Content Directory
    // ========================
    $content_directory_name = '/wp-content';
    define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . $content_directory_name );
    define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . $content_directory_name );

    // Custom Plugin Directory
    define( 'WP_PLUGIN_DIR', dirname( __FILE__ ) . $content_directory_name.'/plugins' );
    define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . $content_directory_name.'/plugins');
    define( 'PLUGINDIR', dirname( __FILE__ ) . $content_directory_name.'/plugins' );

    Check this out as well: http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder

  • Paul

    @Cornell Birds,

    Thanks for the details. Yes, I'm aware of the settings to move the wp-content and/or uploads directories. But again snapshot simply calls the wp_upload_dir() to obtain the server path for the uploads folder. As part of this function it considers all the configuration items you posted.

    And from the snapshot logs it knows to add its own data folder '/Users/tap87/Sites/biology.dev/wp-content/uploads/snapshot/' at the correct location. So something is not quite right here. So it should be finding the uploads/ directories.

    One other thoughts. Within the snapshot item in the section where you select the Files. You have not set any excludes files there or on the Snapshots > Settings Global File Excludes, correct?

    Let me try and apply the same changes to my test WP sub-directory to see if I find something new with Snapshot.

    Thanks.

  • Paul

    Thanks @PC, I'm still trying to reproduce things on my end.

    @Cornell Birds, finally getting a chance to add the defines you provided to my test site.

    Can you confirm the location of your wp-config.php file?

    From the first set of lines in the code you provided it would imply the wp-config.php is in the site root. Which is not the same as my setup. In my setup the wp-config.php is in the /wp/ directory.

    I've not seen a WordPress setup where the wp-config.php is not one level up from wp-admin. Unless I'm missing something else about your setup.

  • Paul

    @Cornell Birds,

    Can you please download and install this beta version of Snapshot. I worked over the weekend with a user having similar issues. I was just about to release it when you updated this thread. Wondering if it solves your issue as well. The issue is related to the path separators not being properly filtered for the media/uploads folder path within Snapshot.

    https://dl.dropboxusercontent.com/u/2616987/WPMUDev/snapshot/beta/snapshot-2.4.2.6-Beta2.zip

    If this does not work then I need to request FTP access to your site site I can add some debug output t snapshot in order to see what is going on.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.