Download the PHP package lwplugins/lw-migration without Composer

On this page you can find all versions of the php package lwplugins/lw-migration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lw-migration

LW Migration

Lightweight backup, restore and migration for WordPress, compatible with .wpress archives.

[!WARNING] Alpha version. LW Migration is still in alpha: it is not recommended for production sites. Try it on a test or staging site, and keep another backup of anything you cannot afford to lose.

Website: lwplugins.com GitHub: github.com/lwplugins/lw-migration

What it does

Long jobs run in short steps driven by the open admin page (or by WP-CLI), so they finish on hosts with short request time limits and small upload limits. An upload goes in resumable slices that shrink when the web server refuses a large request. A job whose page was closed is offered again — it is never resumed or cancelled by itself. While a job runs, its card shows when it started and how long it has run, the percentage beside what is happening now, and a line with one segment per phase; the note under it asks to keep the tab open, and Cancel asks for confirmation inside the card. Past the point of no return (once a restore or a reset has replaced the database, or the other site of a push may be replacing its content) Cancel is off and the note says why; a stopped job shows when it last made progress, with Continue and Cancel.

Limits to know when restoring:

Encrypted archives use AES-256-CBC, the scheme existing .wpress archives use, so they stay readable by other tools. File names inside an archive are not encrypted.

The encryption protects confidentiality only. It is the format's own scheme: a 128-bit key from a single unsalted SHA-1 pass over the password, and no authentication code, so a changed archive is not detected cryptographically (only a checksum guards against damage). Use a long, random password, because a short one can be guessed offline, and keep backups on storage you trust.

Install

With Composer:

Or download the release ZIP from the Releases page and install it through Plugins → Add New → Upload Plugin. A clone of this repository runs as it is: without vendor/ it uses its own autoloader, and the built admin screen (build/) is committed. npm ci && npm run build is needed only after changing src/.

Requirements: WordPress 6.6+, PHP 8.0+ (64-bit).

The screen is LW Plugins → Migration; on a multisite network it is Network Admin → Settings → Migration (see below). By default backups are stored in wp-content/lw-migration-<random>/backups/, a folder with its own protection files; Settings can move them to another folder (below). Deleting the plugin removes its settings and temporary data, never the backups.

The first section, Overview, is where the screen opens. It shows at a glance how the site is backed up: the newest backup with its size and where it is kept, a ring counting the days with a backup among the last 14, and a plain note when the last scheduled backup failed, an upload of the newest backup failed, the newest backup is late (later than the switched-on schedule's rhythm plus 12 hours, or older than two days without one), the backups folder needs a look, or a job is running now. Below that: what needs a look (for example a destination that must be connected again), quick actions to back up now, restore or move a site, a 30-day history of the backups, the cloud destinations with their state, the next scheduled run with its latest results, and the connected sites. Drawing it only reads: nothing is contacted or opened, no secret is shown, and days and times follow the site's time zone. Back up now starts a full backup right on the page, with the Backup section's defaults; the other actions lead to the section that does them. On a multisite network it shows the network's backups, destinations and schedules; connections join single sites only, so they are not shown there.

The Restore section

Restoring is three steps, shown at the top: Source, Check and Restore.

  1. Source — four tiles: a backup already on the server (this plugin's backups and the older .wpress folder, with tags for encrypted backups, backups made on another site and the ones also kept in the cloud), a file uploaded in the browser, an http(s) address, or a file in a cloud destination. Continue to the check reads the archive; nothing is written yet. Back from the check returns to the same source with the uploaded file, the typed address and the choice kept.
  2. Check — the archive next to this site, side by side: the old and the new address, the WordPress and PHP versions, the table prefix and when the backup was made, read from the archive's headers only (no file is extracted). A fact the archive does not tell, as with an archive made by another .wpress tool, is shown as unknown and never blocks the restore. Below it, What gets replaced shows the database, media, plugins and themes as replaced, kept or not in the backup. On a network, and when a single site is restored, the grid follows what really happens: a site backup restored into a network adds its sites and never writes plugins or themes, a subsite is taken as a single site with only its own media, and each site has its own address. The sizes are the stored ones: for a compressed or encrypted archive they are the bytes it takes in the archive, not the size after unpacking. An encrypted archive asks for its password here; a wrong one stays on this step with the field marked.

    The same step holds the controls that start the restore: the Safety backup first switch is on by default and backs up the current database before anything is replaced; when the free space is not enough for it, the switch says why and cannot be turned on. You keep the login you restore with: the importing administrator's username and password stay, and if the restore logs you out, log in again and it goes on by itself. Restore now stays off until you type the address of the site that gets replaced (on a network, the network's main address; case does not matter). The typed address is a check in the screen; the restore itself runs with the same checks as from the command line.

  3. Restore — the restore runs on the running-job screen, with its progress and, when it finishes, the result.

Restoring from a connected site, a network restore and an encrypted archive reach the same check with their own facts and inputs (the sites and their addresses, the password).

Scheduled backups

Schedules runs backups on its own through WP-Cron: each schedule starts a backup at its time and moves it on in short steps until it is done. A missed run is made up once; a backup that makes no progress for 30 minutes is given up and logged as failed. The newest backup and the ones taken before a restore or a reset are never removed by a schedule's retention, and deleting a schedule keeps the backups it made.

The Schedules section opens on a ruler of the next 7 days with one lane per schedule and a mark for every run (point at a mark, tap it, or reach it with Tab and the arrow keys for its time); when two schedules are due in the same minute it says so, and the second waits until the first is done. When WP-Cron is switched off, or runs are late, a box gives the server command with a Copy button. Each schedule is a card with its next runs, a strip of its last 14 results (with the reason when the last run failed) and what it backs up and where it goes; a running schedule shows its progress, when it started and its phase. Run now, Edit and Run log sit on the card, and Duplicate and Delete schedule in its menu. With no schedule yet, three starters (daily at night, weekly, the database every 6 hours) fill the editor, and nothing is saved until Save schedule. The editor opens as a sheet from the right, with a sentence that says in plain words what the schedule does and a preview of its next runs.

On sites with few visitors, or with WP-Cron switched off, run the due schedules from the server's crontab:

The exit status is 1 when a run failed or could not be continued and 2 when the due schedules wait for another backup or restore. wp lw-migration schedule list shows the schedules and their next run, schedule run <id> runs one now (without e-mail), schedule log <id> shows its run log.

Backups folder

Settings → Backups folder (or wp lw-migration backup-dir) moves every backup into another folder, and back to the default one.

On Windows servers the backups stay in the default folder.

Connected sites: push and pull

Connections (single sites only, not on a multisite network) joins two of your sites:

Each request between the two sites is signed with a 256-bit secret both sites keep sealed with their own keys; it is never shown, logged or put into a backup. Things to know:

Reset tools

Reset (and wp lw-migration reset) has five tools. Each shows what goes and what stays before it asks for your password, and backs up the whole site first unless you switch that off. In the admin you choose a tool from five tiles; the layers of the site (plugins, themes, media, the database, and below them what no reset touches) show what goes and what stays, beside the steps before the start, on the page itself without a dialog.

What a reset never touches: LW Migration itself, must-use plugins, drop-ins (object-cache.php, advanced-cache.php, db.php…; a plugin a drop-in, a must-use plugin or auto_prepend_file loads is kept and listed), wp-config.php, the uploads folder's protection files (.htaccess, index.php…), the backups and their folders. A link inside a plugin, theme or uploads folder is removed as a link; its target is never followed.

The password is asked for on a terminal (hidden) or read as one line from standard input; it is never an option. --no-backup skips the backup (--backup, the default, takes it).

Limits to know:

Cloud destinations

Destinations (or wp lw-migration destination) holds up to 20 places backups are uploaded to. The S3 type covers Amazon S3, Backblaze B2, Wasabi, Cloudflare R2, DigitalOcean Spaces, Hetzner Object Storage, Scaleway and any S3-compatible server (MinIO and other self-hosted stores, as a custom address). The connection test writes a small text file, reads it back from its second byte on (as backups are read in parts, so a storage that can only send whole files fails it) and deletes it.

On the screen each destination is a card with its state, where it keeps the backups, the last upload, the schedules that use it and what it keeps. Check connection, Backups there and the card's menu (Edit, Delete) open inside the card, one at a time, and so does a host key or certificate to confirm. Below the list, New destination groups the places by how you get in (with a sign-in, with an access key, on your own server); picking one opens its settings as a draft card right there, with the name and a live line of where the backups will go. Save and check stores a server or a storage and checks the connection on its new card at once; a cloud account is saved and sent to the provider's sign-in (when the sign-in cannot start, the account stays saved: Close closes the draft, and its card offers Connect). Nothing on this screen opens a dialog. A type this site cannot use, and every type once there are 20 destinations, stays on the shelf, closed, with the reason.

The other types:

The secret key is never an option (it would stay in the shell history): destination add asks for it with a hidden prompt on a terminal, or reads it as one line from standard input — printf '%s\n' "$SECRET" | wp lw-migration destination add s3 …. The same goes for a password and a key's passphrase; an SSH private key is read from a file (--private-key-file, never echoed). The user name and the WebDAV address are --username and --address, because WP-CLI keeps --user and --url for itself.

Do not use WP-CLI's global --prompt with destination add: it would show what you type (the command refuses it). upload ends with exit status 1 when not every upload succeeded; export --to ends with 0 and a warning, because the backup exists.

Limits to know:

WP-CLI

<source> is a backup name from list, a path to a .wpress file, or an http(s) address. The archive password has three forms, the safe ones first: --password-file=<path> (a file holding the password; at most 16 KB, the path is never printed), --password without a value (a hidden prompt on a terminal, otherwise one line from standard input: printf '%s\n' "$BACKUP_PASSWORD" | wp lw-migration export --password), and --password=<value>, which stays in the process list and the shell history. One trailing line ending is cut; an empty password is refused; --password and --password-file together are an error. import and delete ask for confirmation unless --yes is given (required when not run from a terminal). On a multisite network the commands run on the main site: export --sites=2,5 backs up only those sites (without it the whole network), and import --site-url=<url>[,<url>...] gives the new address of each site of a site or single-site backup, in archive order.

backup share prints the transfer link once; --expires takes 30m, 24h, 7d and similar values from 5 minutes to 7 days.

Permissions

Every REST route (lw-migration/v1) needs a logged-in user with the manage_options capability (on a multisite network manage_network_options, on the main site) and the REST cookie nonce. The capability can be changed with the lw_migration_capability filter. Download links are short-lived tokens bound to the user and the login session; a link never carries the REST nonce.

Transfer links are the exception that needs no login: GET /backups/shared?share=<token> serves the one backup the link names until the link expires or is revoked. Every refused link gets the same 404 answer, so a wrong, expired or revoked link cannot be told apart. After a link expires or is revoked, every new request with it is refused; a part that is already being sent still finishes, so a restore over the link stops at its next part (start it again with a new link). Like any address with a token, a link can end up in the web server's access log. A security plugin that blocks anonymous REST API requests blocks transfer links as well; allow the lw-migration/v1/backups/shared route there if you use them.

Connections need no login either: the routes under lw-migration/v1/link are open, but every request must be signed with the connection's secret within 5 minutes of its time and is accepted only once; every refused request gets the same 401 answer. They exist on single sites only.

Development

End-to-end tests run against throwaway WordPress sites on a Docker database (PHP 8.x, WP-CLI, Docker and rsync required):

bin/test-cloud.sh uses images pinned by tag and digest: MinIO, OpenSSH (two servers with different host keys), vsftpd (FTPS, plain FTP, and plain FTP without REST) and Nextcloud (about 1.3 GB). LWM_CLOUD_SERVICES="minio sftp ftp nextcloud" picks which of them start (the tests of the others skip themselves). Docker Hub does not serve the MinIO images without a login, and may refuse anonymous pulls of the others: load them into the local Docker cache (docker login, then docker pull the pinned references in the script), or point LWM_MINIO_IMAGE, LWM_MC_IMAGE, LWM_SFTP_IMAGE, LWM_FTP_IMAGE and LWM_NEXTCLOUD_IMAGE at images you have.

The browser tests use the Chromium build of the pinned @playwright/test; if the run says it is missing: npx playwright install chromium.

License

GPL-2.0-or-later.

SFTP support bundles a trimmed copy of phpseclib 3.0.57 and constant_time_encoding 3.1.3, both under the MIT license, with their namespaces changed so they cannot clash with other plugins. They are in includes/Vendor/ together with their license files.

Credits

Icons from Font Awesome Free (https://fontawesome.com), CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/), and the Backblaze, Wasabi and Hetzner marks from Simple Icons (https://simpleicons.org), CC0 1.0. Brand marks belong to their owners.


All versions of lw-migration with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
composer/installers Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lwplugins/lw-migration contains the following files

Loading the files please wait ...