Skip to content

Pull code, a database, and uploads

Copy the code, database, and uploads of an environment to your computer. Pick any of the three. Staging and previews pull over SSH and Git; live pulls a backup.

ddev wpwaterfall pull copies an environment to your computer. You choose the parts: --code, --db, --uploads, or --all. Install the add-on once with ddev add-on get https://get.wpwaterfall.com/local.tar.gz. Setup and updates are in Develop locally with DDEV.

Where each part comes from

Source Code Database and uploads
Staging or a preview Git, from the WP Waterfall remote SSH: the database streams as a compressed dump, and uploads copy with rsync
Live Git, the commit live runs A backup download. Live takes no account SSH keys and is read only.
Any environment with SSH off, or a connected external repository Your Git host A backup download

To pull data from live, add --from live:

ddev wpwaterfall pull --db --uploads --from live

Live data comes from the newest backup. If it is more than a day old, or there is none, add --fresh-backup to take a new one first. A backup of a large site can take several minutes. Taking one does not change live.

Another way to get live's data without touching live: reset staging from live in the dashboard, then pull staging. Staging then holds live's code, database, and uploads under staging's own address.

Code

Code comes from the repository, never by file copy.

  • The first pull --code clones into the project folder.
  • Later pulls run git pull --ff-only. It stops, and changes nothing, when your branch has diverged or you have uncommitted changes. Commit or stash first, or add --rebase.
  • ddev wpwaterfall code --release live checks out the exact commit live runs.

The repository holds the whole site folder: WordPress core, plugins, themes, and wp-content code. It leaves out uploads, caches, and wp-config.php. A pull never deletes a tracked file.

Database

The dump is made with wp db export --single-transaction, so it is consistent and does not lock tables. It travels compressed. The add-on checks that the dump ended properly before it touches your local database, so a cut connection leaves your local copy as it was.

In the WP-CLI runner of the dashboard and the API, db export needs the credentials permission and a recent sign-in, because the dump holds password hashes, and the runner cannot read password hash fields at all.

After the import, the add-on:

  • Rewrites the site address, and the temporary address, to your local address in every table with your prefix. It handles serialized values safely. It leaves each post's guid alone.
  • Keeps the real table prefix of the server, so a prefix other than wp_ works. See Database table prefix.
  • On a WordPress network, rewrites the network and every subsite address, one subsite at a time. See Networks.
  • Removes the WP Waterfall settings that came along in the database (a stored sign-in ticket, the login history) from the local copy only.

A site with a large database can take a while. The add-on shows progress. For a database over about 2 GB, or on a slow link, pull from a backup instead with --method backup: the download resumes if it is cut.

Remove personal data

Add --sanitize to a database pull to clean the local copy right after the import:

ddev wpwaterfall pull --db --sanitize
ddev wpwaterfall pull --db --sanitize --sanitize-profile full

It runs only in your local database, lists each step, and never contacts the environment. Running it again changes nothing more. Everyone loses their password except the local admin, so sign in with ddev wpwaterfall login.

Profile What it does
minimal (default) User emails become user_ID@example.test. Passwords are made unusable and session tokens are removed. Comment author emails become comment_ID@example.test, and comment IP addresses, web addresses, and browser strings are cleared.
full Everything in minimal, plus user display names, first and last names, nicknames, and biographies. WooCommerce billing and shipping fields, customer notes, order notes, customer list, and sessions. Entries of Gravity Forms, WPForms, and Flamingo.

It does not change user logins, post content, or uploads. Tables that are not there are skipped, and each subsite of a network is cleaned.

Networks

A WordPress network pulls and opens on your computer under one project address. The address map, subdirectory and subdomain addresses, and pushing a network back are in Local development with Multisite.

Uploads

Uploads copy with rsync and resume if the connection drops. The add-on skips caches (cache/), backup plugin archives (backup*/, updraft/, ai1wm-backups/), database dumps (*.sql, *.sql.gz), logs, and PHP files. See your list with ddev wpwaterfall exclude list. You can add your own with ddev wpwaterfall exclude add PATTERN.

Useful options:

  • --max-size 50M skips files larger than that.
  • --uploads-days 30 pulls only files changed in the last 30 days.

Uploads you already have are not copied again.

What the pull leaves alone

The pull never deletes a file that is in your Git repository. The WP Waterfall plugin is part of the server, so it never comes down. If your repository holds a cache or database drop-ins such as object-cache.php, they stay, and the add-on warns you. Pass --disable-dropins to rename an untracked one to NAME.wpwaterfall-disabled. For a tracked one it prints the line to put in a local wp-config.php override instead.

What the database holds

A pulled database holds user emails and password hashes, and any order and customer data. Keep your disk encrypted and do not share the folder. Email stays on your computer: DDEV catches mail in Mailpit.

Checking the result

ddev wpwaterfall status shows the environment, the branch, and when each part was last pulled. ddev wpwaterfall doctor checks DDEV, Docker, your SSH key, the connection, the host key, rsync, and your API key.

API

  • GET /v1/environments/{id}/local-dev: sizes, the exclude list, the Git remote, and which parts each environment allows.
  • POST /v1/environments/{id}/local-dev/pull-session: records the pull and returns the plan.
  • GET /v1/environments/{id}/backups, POST /v1/environments/{id}/backups, POST /v1/backups/{id}/download, and POST /v1/backups/{id}/download-link: the backup path.

Still stuck?

Email support at wpwaterfall dot com with your site name and what you tried, or send us a message.