=== Migram – Migration & Backup ===
Contributors: qualymax
Tags: migration, backup, restore, clone, move
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 3.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Back up, restore and migrate WordPress sites with a single file. No upload size limit, scheduled backups and site-to-site migration by URL.

== Description ==

Migram packs the whole site (database, media, plugins, themes and the files outside WordPress you choose) into one .migram file and restores it anywhere: on the same server, on a new host or on a local copy.

= Free features =

* **No upload size limit:** large files are sent in small parts, so the PHP upload limit of the host does not matter.
* **Restore in one click** from the list of stored backups.
* **Site-to-site migration by URL:** create a migration key on the source site, paste it on the destination, and the backup is transferred directly between the two servers.
* **Automatic address and folder update**, safe for serialized data, JSON and URL-encoded values, plus optional find/replace rules.
* **Scheduled backups:** daily, weekly, every two weeks or monthly, keeping the latest N on the server.
* **E-mail notifications** when an automatic backup fails, has warnings or completes.
* **Choose what goes in:** leave out media, plugins, themes, inactive plugins/themes, revisions, spam, transients and cache folders.
* **Files outside WordPress:** favicons, robots.txt, Google and Bing verification files and other folders at the site root, plus an optional .htaccess (a copy of the current one is kept in the backups folder when it is replaced).
* **Single tables and plugins:** export plugin tables with their structure only (great for activity logs) and leave chosen plugins out.
* **wp-config.php settings:** a reference copy without passwords goes in the backup. It never overwrites the new site; after an import, Migram lists the custom settings of the old site so you can copy them.
* **Restore by parts:** restore only the database, the media, the plugins, the themes or the files outside WordPress.
* **Backup browser:** find single files inside a backup and restore or download only them.
* **Works on shared hosting:** every job runs in short, resumable steps and survives timeouts.
* **Safe imports:** the current site keeps working until the very end; the database is loaded into temporary tables and swapped in at once.
* Activity history of every backup, import, restore and migration.
* **Duplicate pages and posts:** clone a page, post or any custom content type as a draft before you edit it, or to start a new one from it. Content, Elementor and page builder layouts, categories, tags, featured image, custom fields (ACF) and SEO data go along. One click in the list, in bulk, in the editor or in the toolbar; Polylang copies keep their language. Turn it on or off in Settings → Writing.

= Optional services =

Everything above is free and complete in this plugin. Optional, paid services are sold per domain at [migram.app](https://migram.app/en/pro-plan/):

* **Migram Cloud (PRO Cloud plans):** a storage service. Backups are kept on the servers of the Migram service, with no account to connect, and can be restored on any server with just the subscription key, even if the original site is gone. The service checks the subscription and the storage space.
* **Migram PRO add-on:** a separate plugin, available at migram.app, adds backups to Google Drive and actions from the agency panel. This plugin does not include those features.

== Installation ==

1. Install Migram from Plugins → Add New, or upload the plugin folder to /wp-content/plugins/.
2. Activate it. A "Migram" menu appears in the dashboard.
3. Migram → Export creates a backup. Migram → Import restores one, uploaded from your computer or pulled from another site with a migration key.
4. Migram → Schedule turns on automatic backups.

== Frequently Asked Questions ==

= Where are backups stored? =

In a folder of its own in wp-content, named migram-backups- followed by a random code (for example wp-content/migram-backups-3f9c…), outside the uploads folder so backups are never mixed with media and work the same on every kind of site. Migram adds deny rules for Apache and IIS, and both the folder name and every backup name have a long random part that cannot be guessed. On Nginx, which ignores those rules, you can also add `location ~ ^/wp-content/migram-backups { deny all; }` to the server block. Define MIGRAM_STORAGE_DIR in wp-config.php to use another folder, for example one outside the public web folder.

= Is there a size limit? =

No. Uploads, downloads and migrations run in parts. The only limit is the free disk space of the server.

= What happens to my login after an import? =

Users come from the imported site, so log in again with a username and password from that site.

= Can I move a site to a different domain? =

Yes. The site address, folders and URLs in the content are updated during the import, including inside serialized data.

= Does Migram copy wp-config.php? =

Not over the new site: it holds the database password of each server. The backup keeps a reference copy with passwords, keys and salts removed. After an import, Migram → Import shows the custom settings of the old site (for example WP_MEMORY_LIMIT) that the new site does not have, ready to copy, and the full copy can be downloaded.

= How do I duplicate a page or post? =

Hover the page or post in the list and click Duplicate, choose Duplicate in the bulk actions, or click Duplicate in the editor or in the toolbar. The copy is saved as a draft named "(copy)" with everything the original has, so you can edit it safely. You can turn it off, or choose the content types, in Settings → Writing. WooCommerce products keep using the Duplicate of WooCommerce.

= Is multisite supported? =

Not yet.

= Do I need an account or license? =

No. Everything in this plugin is free and works without an account. Only Migram Cloud, a storage service, needs a subscription, because the backups are kept on the servers of the service.

== External services ==

Migram works offline by default. It only contacts the services below when you use the feature that needs them.

= Migram service =

Address: https://api.migram.app, run by Qualymax Software (the company behind Migram).

* **Subscription key (Migram → License):** when you activate, check or unlink a key, and once a day while a key is active, it sends the key, the site domain and address, and the Migram and WordPress versions.
* **Migram Cloud (PRO Cloud):** to send, list, download or delete backups it receives the license key, the site domain and the name and size of the backup file. The file itself goes straight to Cloudflare R2 (below).
* **Usage data:** only if you opt in (Migram → License). It sends the site address and domain, the versions of WordPress, PHP and Migram, the site language and the type, result, size and duration of backups and imports. Site content, users, passwords and file names are never sent.
* **Error reports:** only when you click "Send error report". The exact text is shown before it is sent.
* **Agency panel:** only after you link the site with an agency code (Migram → Agency), and until you unlink it. When linking, it sends the code, an anonymous site id, the site address and name, the language and the WordPress, PHP and Migram versions; the service returns a token of this site, used from then on. While linked, after each backup and once a day, it sends the same versions, the plugins, themes and WordPress versions with an update available (names and version numbers), the update log (plugins and themes installed, updated, activated, deactivated or removed and WordPress updates, with the old and new version and the display name and login of the administrator who made the change, or "automatic" / "outside the dashboard") how often the automatic backups run (or that they are off) and, for each backup, its type, result, size, duration and where it was saved. The agency sees this in its panel at https://dash.migram.app. Site content, users, passwords and the backup files are never sent. The agency panel cannot change anything on the site through this plugin.

Terms of use: https://migram.app/en/terms/
Privacy policy: https://migram.app/en/privacy/

= Cloudflare R2 =

Only when Migram Cloud is used (PRO Cloud): backup files are uploaded to and downloaded from Cloudflare R2 (*.r2.cloudflarestorage.com) through short-lived links signed by the Migram service.

Cloudflare terms: https://www.cloudflare.com/website-terms/
Cloudflare privacy policy: https://www.cloudflare.com/privacypolicy/

= Other WordPress sites =

Migration by URL connects only to the site whose migration key you paste, to download the backup you chose there.

== Screenshots ==

1. Export: choose what goes in the backup, see its estimated size and where it will be kept.
2. Import: drop a .migram file of any size, or paste a migration key from another site.
3. Backups: download, restore or create a migration key; Migram Cloud backups below.
4. Schedule: frequency, retention, Migram Cloud and e-mail notifications.
5. History of backups, imports, restores and migrations, with filters.

== Developers ==

Filters:

* migram_capability — capability required to use Migram (default manage_options).
* migram_step_seconds — seconds of work per request (default 15, lower on hosts with short timeouts).
* migram_upload_chunk — upload chunk size in bytes.
* migram_remote_sslverify — verify SSL certificates when pulling a backup from another site (default true).
* migram_service_url — address of the Migram service.
* Backup destinations of other plugins: filter migram_destinations (see includes/class-migram-destinations.php) and actions migram_export_destinations and migram_schedule_destinations( $settings ) for their fields.
* Other extension points: filters migram_notices, migram_site_options, migram_agency_remote_actions and migram_agency_note; actions migram_agency_status_sent( $response ), migram_agency_forget and migram_agency_linked_card.
* Actions migram_scheduled_backup_finished( $job, $ok ) and migram_job_finished( $job, $ok ).
* Duplicate: filters migram_clone_types (content types offered) and migram_clone_skip_meta (custom fields left out of the copy), action migram_post_duplicated( $copy_id, $original ).

Constants: MIGRAM_STORAGE_DIR (backups folder), MIGRAM_SERVICE_URL.

Bundled translations: Brazilian Portuguese, Spanish, German, French and Italian. The admin fonts (Sora and JetBrains Mono, SIL Open Font License) are shipped with the plugin in assets/fonts; nothing is loaded from external servers.

== Upgrade Notice ==

= 3.0.1 =
The backups folder gets a random name (wp-content/migram-backups-…) and the existing backups are moved there. Safer copy of wp-config.php settings in backups.

= 3.0.0 =
Google Drive and the actions from the agency panel moved to the separate Migram PRO add-on. Install it to keep using them; the Drive connection is kept.

= 2.9.0 =
Choose where the Google Drive backups go: any folder of yours, a folder shared with you or a shared drive of your company.

= 2.8.2 =
Two WordPress sites on the same domain (example.com and example.com/shop) sharing a PRO Cloud license no longer delete each other's automatic backups in Migram Cloud.

= 2.8.1 =
The agency panel gets the latest backup and every pending update even when a report was lost, and the Backups and History screens show where each backup was kept.

= 2.8.0 =
New: duplicate pages, posts and other content as a draft, with the Elementor layout, terms and custom fields.

= 2.7.1 =
Sites built with Elementor no longer show images of the old address after an import.

= 2.7.0 =
Layout fixes for the Migram screens on phones and small screens.

= 2.6.0 =
The agency can update plugins, themes and WordPress and make backups from its panel, if you allow it in Migram → Agency.

= 2.5.1 =
The agency panel is updated a few seconds after plugins are updated, activated or deactivated and after a backup is deleted.

= 2.5.0 =
Update log for the agency panel: who installed, updated or removed plugins, themes and WordPress, with the old and new version.

= 2.4.0 =
New Agency screen: link the site to an agency panel (dash.migram.app) to share its backups and pending updates. Nothing is sent unless you link it.

= 2.3.0 =
Migram moved to its own home, migram.app: the plugin now talks to api.migram.app. Licenses, Google Drive connections and Migram Cloud keep working.

= 2.2.0 =
Back up files outside WordPress and .htaccess, export plugin tables with structure only, restore only some parts of a backup or single files.

= 2.1.0 =
New admin design, with the estimated backup size, a progress window you can minimize and translations into Spanish, German, French and Italian.

= 2.0.0 =
Internal names changed from "mig_" to "migram_". Your settings, license, Google Drive connection and history are moved automatically on the first load.

== Changelog ==

= 3.0.1 =
* The backups folder is now wp-content/migram-backups- followed by a random code, so it cannot be guessed on servers that ignore its deny rules (such as Nginx). The existing wp-content/migram-backups folder is renamed once, with its backups. MIGRAM_STORAGE_DIR keeps working.
* The wp-config.php settings kept in a backup are now rebuilt as a list of define() lines with plain values. Passwords, keys, salts, cookie names, variables and anything else are left out, also when importing backups made by older versions.
* When a restore replaces the .htaccess, the copy of the current file is kept in the backups folder under a random name, instead of .htaccess.migram-bak next to it.
* Backups never include symbolic links to files, which could point outside the site.

= 3.0.0 =
* Google Drive backups and the actions from the agency panel (updates and backups started in the panel) moved to Migram PRO, a separate add-on plugin available at migram.app. Sites that use them only need to install the add-on: the Google Drive connection and the schedule settings are kept. Agency actions start turned off in the add-on until an administrator turns them on again.
* Migram itself no longer runs anything asked from outside the dashboard: the agency panel only receives the status of the site.
* New extension point for other plugins to add backup destinations (filter migram_destinations).
* Backup names now end with a 32-character random part, so they cannot be guessed even on servers that ignore the deny rules of the backups folder.
* Restore: files are never written through a symbolic link or junction, or anywhere outside the WordPress folders.
* Restore of single files: the chosen names are checked in full before use.
* Find and replace rules are cleaned when received (valid UTF-8, one line, no control characters, up to 2000 characters).
* Database access goes through $wpdb. A restore that stopped halfway can be resumed safely (tables and rows already loaded are skipped).
* Agency panel: the site reports how often its automatic backups run, so the "no backup" alert waits for the next backup of a weekly, every-two-weeks or monthly schedule instead of firing after a few days.

= 2.9.0 =
* Google Drive: new "Choose folder" (Migram → Schedule). Google's own folder picker opens and Migram creates "migram/<site>" inside the chosen folder: one of yours, one shared with you or a folder of a shared drive. Choosing a folder already called "migram" puts the site folder straight into it. "Use My Drive" goes back to the default. Migram still only sees the files it creates and the folder you picked.
* Google Drive: uploads, folder search and the cleanup of old backups work in shared drives.
* The folder is checked when chosen (it must be a folder where the account can add files), and a backup that cannot reach the chosen folder anymore says so and how to fix it.
* Backups screen: the labels of where each backup is kept no longer change the look of the destination boxes of the Schedule screen (2.8.1).

= 2.8.2 =
* Migram Cloud: the cleanup of old automatic backups only counts the backups made by this WordPress installation. Before, two installations on the same domain (for example a site and a landing page in a subfolder) shared the count, and one could delete the backups of the other. Backups on the server and in Google Drive were already kept apart (each installation has its own folder).

= 2.8.1 =
* Agency panel: every report now carries the latest backup, so a backup whose report was lost on the way shows up in the panel at the next contact (the panel ignores backups it already has).
* Agency panel: updates seen in the dashboard stay in the report until they are installed. Reports made in the background right after an update could leave plugins out while WordPress rebuilt its list of updates.
* Backups screen: each backup shows where it is kept: on this server, in Google Drive and in Migram Cloud, or that sending it failed.
* History: backups also tell whether the copy on this server was saved, not kept (when the copy elsewhere is enough) or deleted later.

= 2.8.0 =
* New: Duplicate pages, posts and custom content types. "Duplicate" link in the lists, bulk action (up to 50 at once), button in the block and classic editors and "Duplicate this" in the toolbar.
* The copy is a draft by the current user with the content, excerpt, parent, order, template, password, categories, tags, custom taxonomies, featured image and all custom fields, so Elementor and other page builder layouts, ACF fields and Yoast or Rank Math data go along.
* Left out of the copy: edit locks, old addresses, pending pings and the Elementor caches (rebuilt on the first view). Comments, revisions and child pages are not copied.
* Polylang: the copy keeps the language of the original and is not linked to its translations.
* Settings → Writing: turn Duplicate on or off and choose the content types. WooCommerce products keep using the Duplicate of WooCommerce.

= 2.7.1 =
* Import: clears the Elementor caches (page element cache, page CSS and its files) after the database is imported. Elementor keeps the widget settings of each page encoded inside that cache, out of reach of the address change, so an imported page could show images and links of the old site until the cache expired.

= 2.7.0 =
* Admin screens checked again against the Migram layout, on desktop and phones.
* Phones and small screens: the tab bar no longer makes the page a few pixels wider than the screen, so the page no longer scrolls sideways.
* Phones and small screens: the cards keep the same space on the right and on the left instead of touching the edge of the screen.
* The privacy card text uses the same size as the other screen texts.

= 2.6.0 =
* Agency panel: new option "Allow actions from the agency panel" (Migram → Agency). When on, the agency can update plugins, themes, translations and WordPress and make a backup of this site from its panel, one site or many at once, with an optional backup right before the updates.
* The site only runs updates from the usual sources and Migram backups; every update shows in the update log with the name of who asked in the panel.
* Off for sites linked before 2.6.0 until an administrator turns it on.

= 2.5.1 =
* Agency panel: after a plugin, theme or WordPress update, an activation or deactivation, or a deleted backup, the site reports to the panel within a few seconds, in the background.
* The list of pending updates no longer shows items that were already updated.
* Deleted backups (by the Delete button or by the retention of automatic backups) go to the update log of the agency panel, with the backup date and size (never the file name).
* Backups: the Delete button shows that the deletion is in progress.

= 2.5.0 =
* Update log: Migram records installs, updates, activations and removals of plugins and themes and WordPress updates, with the old and new version and who made them (an administrator, an automatic update or a change outside the dashboard, such as WP-CLI or FTP).
* While the site is linked to an agency, the log goes to the agency panel with the next report. The log stays on the site (last 300 changes) and is never sent when the site is not linked.
* After an import, the comparison starts again from the imported plugins and themes.

= 2.4.0 =
* New Migram → Agency screen: paste the code of the agency (MGA-XXXX-XXXX-XXXX) to show this site in its panel at dash.migram.app. The screen lists what is sent and what never is.
* While linked, the site reports its status after each backup (result, size, duration, where it was saved) and once a day (WordPress, PHP and Migram versions, plugins, themes and core with an update available).
* The site can be unlinked at any time; when the agency removes it from its panel, the site stops sending on the next report.
* The agency link belongs to the site: importing a backup from another site keeps the current link.

= 2.3.0 =
* The Migram service moved to https://api.migram.app (licenses, Google Drive authorization, Migram Cloud, usage data and error reports). Existing licenses and Google Drive connections keep working, with nothing to redo.
* Links to the subscription page, terms, privacy policy and documentation now point to migram.app, in Portuguese, Spanish or English according to the admin language.
* Automatic backup e-mails link to migram.app.

= 2.2.0 =
* Files outside WordPress: choose the files and folders at the site root to include (small files such as favicons, robots.txt and verification files are suggested). WordPress itself and wp-config.php are never included or overwritten.
* Optional .htaccess (off by default). When it is restored, a copy of the current file is kept in the backups folder.
* Reference copy of wp-config.php without passwords, keys and salts. After an import, the custom settings of the old site are listed on the Import screen, ready to copy.
* Plugin tables can be exported with their structure only, and single plugins can be left out. These choices can also be used by the automatic backups.
* Restore by parts: choose to restore the database, media, plugins, themes, other wp-content files, files outside WordPress and .htaccess.
* Backup browser: search the files of a stored backup and restore or download only the ones you need.
* New layout for the automatic backup e-mails: status, file, size, duration, where the backup was saved and the next backup, with a plain-text version for mail apps without HTML.
* Backups made by older versions keep working.

= 2.1.0 =
* New admin design: overview of the last and next backup, free disk space and active migration keys next to every screen.
* Export shows the size of the database, media, plugins and themes and the estimated size of the backup.
* Progress window with the steps of each export, import, restore and migration; it can be minimized while the job runs.
* Imports and restores ask you to confirm that the site will be replaced before anything changes.
* Clearer schedule: frequency, weekday and retention controls, and a warning before leaving with unsaved changes.
* History can be filtered by backups, imports, restores and migrations, and shows how long each job took.
* License screen compares the plans; the technical data choice lists exactly what is and is not sent.
* Translations into Spanish, German, French and Italian.
* The PRO Cloud plan name is shown correctly in the license details.

= 2.0.0 =
* Ready for WordPress.org: every internal name now uses the "migram_" prefix (options, hooks, AJAX actions, classes and constants). Settings from 1.x are moved automatically.
* E-mail notifications for automatic backups are now free.
* New "External services" section in the readme and suggested text for the site privacy policy.
* Migration keys keep working between 1.x and 2.x sites; MIG_STORAGE_DIR and MIG_SERVICE_URL in wp-config.php are still honored.
* Removed the MIGRAM_PRO development constant.
* Passes the official Plugin Check: error messages are escaped, file and database access is documented, and AJAX input is sanitized.

= 1.4.1 =
* Migram Cloud: "Keep on Migram Cloud" now defaults to the 3 latest automatic backups (was 10), to save storage.

= 1.4.0 =
* Migram Cloud (PRO Cloud plans): send automatic and manual backups to the Migram cloud in resumable 16 MB parts, straight from this server through short-lived signed links.
* Storage bar and retention ("Keep on Migram Cloud"); when the plan storage is full, the oldest automatic backups are removed to make room.
* Backups → Migram Cloud: list, download, restore and delete.
* Import → Restore from Migram Cloud: restore with just the license key on a new server (disaster recovery).
* History shows the Google Drive and Migram Cloud copies of each backup; e-mails mention the Migram Cloud copy.
* License screen shows the plan.

= 1.3.0 =
* New License screen: activate the Migram PRO key on this domain, unlink it to move to another domain, daily automatic check (14-day grace if the service is unreachable).
* Google Drive and e-mail notifications require an active PRO license; Google Drive is also enforced on the Qualymax service.
* Optional, opt-in anonymous usage data (versions, type/result/size/duration of backups and imports).
* "Send error report" button on errors, showing exactly what will be sent.
* Google Drive tokens are now sealed by the Qualymax service and bound to the site's domain.

= 1.2.0 =
* Google Drive layout: migram/<site>/ (shared "migram" folder for every site of the account). Folders from 1.1.0 are moved automatically, keeping their backups.
* New file names: 2026-11-14-site-com-br-12h-11m-46s[-auto]-xxxxxx.migram.
* Export, Import, Backups, Schedule and History are now submenus of Migram.
* New History screen with every backup, import, restore and migration.
* Importing a site keeps this site's Migram settings (schedule, Google Drive, license, history).
* Fix: the Download button shown after an export had a broken link.

= 1.1.0 =
* Automatic backups with schedule, retention, run history and background processing (WP-Cron + self-healing watchdog).
* PRO: Google Drive destination (resumable uploads, own folder, retention in the Drive trash).
* PRO: e-mail notifications for failed, partial and successful automatic backups.
* Developer links to Qualymax Software.

= 1.0.0 =
* First release: export, import with chunked upload, backups list with restore, migration by URL.
