jasonwang-tw/wp-pcloud-backup
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
=== WP pCloud Backup === Contributors: Jason Author URI: https://jasonwang.tw Plugin URI: https://jasonwang.tw Tags: backup, pcloud, database, files, cloud storage, scheduled backup Requires at least: 5.8 Tested up to: 6.7 Requires PHP: 7.4 Stable tag: 1.6.2 License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html Automatically backup your WordPress files and database to pCloud cloud storage on a scheduled basis. == Description == WP pCloud Backup lets you schedule automatic backups of your entire WordPress installation — including `wp-content` files and the MySQL database — directly to your pCloud account. **Features** * Backup `wp-content` (or any custom path) and the MySQL database into a single `.zip` archive * Upload directly to pCloud (supports both **US** and **EU** servers) * Scheduled backups: daily, weekly, or monthly via WP-Cron * Manual backup trigger from the admin panel * Retention policy: automatically delete remote backups older than N days * Restore a previous backup with a single click * Backup log showing time, filename, size, status, and duration * Passwords stored encrypted (AES-256-CBC using `AUTH_KEY`) * Test connection button to verify credentials before saving == Installation == 1. Upload the `wp-pcloud-backup` folder to `/wp-content/plugins/`, or install via **Plugins → Add New → Upload Plugin**. 2. Activate the plugin through the **Plugins** menu. 3. Go to **pCloud Backup** in the WordPress admin sidebar. 4. Enter your pCloud **email** and **password**, select the correct **server** (US or EU), and click **Test Connection**. 5. Configure your backup path, frequency, and retention policy, then click **Save Settings**. == Frequently Asked Questions == = How do I know whether to select US or EU server? = If your pCloud account was registered at [pcloud.com](https://www.pcloud.com), choose **US**. If it was registered at [ecloud.com](https://ecloud.com) or you selected the European region during sign-up, choose **EU**. = Where are the backups stored on pCloud? = By default, backups are uploaded to `/WordPress-Backups` in your pCloud account root. You can change this path in the plugin settings. = Is my password stored securely? = Yes. Your password is encrypted using AES-256-CBC with your site's `AUTH_KEY` before being stored in the WordPress database. It is never stored in plain text. = Can I restore a backup from the admin panel? = Yes. The backup log displays a **Restore** button next to each entry (only visible when your pCloud credentials are valid). Clicking it will download the archive from pCloud, extract files back to their original locations, and re-import the database. = Does it work with large sites? = Yes. The plugin uses PHP's `CURLFile` for streaming uploads, so large archives are sent directly from disk without loading them entirely into memory. = What PHP extensions are required? = * `zip` (ZipArchive) * `curl` * `openssl` == Screenshots == 1. Plugin settings page — account credentials, backup configuration, and manual backup trigger. 2. Backup log — lists recent backups with filename, size, status, duration, and restore button. == Changelog == = 1.6.2 = * Fixed: the real cause of stalled scheduled backups — pCloud blocks automatic username/password logins from a server IP by demanding an email verification "code" even when Two-Factor Authentication is OFF. Once the cached token expired, re-login was blocked and backups silently failed. The plugin now detects the "Please provide 'code'" response and directs the user to the Access Token flow. * Added: "Access Token" section in settings (marked Recommended) with built-in step-by-step instructions for obtaining a long-lived token from the browser, an authorization status indicator, and a "Validate Token" button that confirms the token against pCloud /userinfo and shows the signed-in account and storage usage. * Added: `ensure_auth()` now prefers a saved Access Token (which never auto-expires) over the cached password token; cache lifetime for the password flow extended from 7 to 30 days. * Fixed: Backup Log action column now appears when a manual Access Token is set (previously it only checked the cached token and ignored direct tokens). * Added: `PCloud_API::validate_token()` to verify any token without running a full backup. = 1.6.1 = * Fixed: image URLs in post content are now reliably replaced after restore — added direct SQL REPLACE on wp_posts.post_content and guid as a safety net in addition to the existing PHP chunked pass. * Fixed: images uploaded before an HTTP→HTTPS migration (or vice versa) are now also replaced — restore now checks both the http:// and https:// variants of the backup domain. = 1.6.0 = * Improved: Merged "Remote Backups (pCloud)" section into "Backup Log" — removed the redundant standalone section to reduce UI clutter. * Added: "Refresh from pCloud" button in the Backup Log header to manually re-sync action buttons with current pCloud state. * Added: "Also found on pCloud (not in local log)" sub-section appears automatically below the log when orphan files exist on pCloud (e.g. manually uploaded archives). * Fixed: Backup Log action column now resolves "Checking..." state on page load without requiring any manual button click. * Fixed: After "Test Connection" succeeds, pCloud sync now updates the Backup Log actions instead of the removed remote scan panel. = 1.5.3 = * Fixed: admin.js JavaScript syntax error (missing console.log opening) that prevented all button event bindings from executing. = 1.4.0 = * Fixed: after database restore, all occurrences of the backup's original domain are now replaced with the current site's domain across every table and column — including PHP-serialized data (widgets, postmeta, options), post content, GUIDs, and any other text fields. Previously only siteurl/home were updated, leaving other pages pointing to the old domain. = 1.3.9 = * Fixed: restoring a database backup no longer overwrites the current site's domain — siteurl and home options are saved before import and written back afterwards. = 1.3.8 = * Fixed: restore no longer fails with "mysql: command not found" — if the mysql CLI is unavailable or returns a non-zero exit code, the restore automatically falls back to PHP-based SQL import via wpdb. * Fixed: exec() availability check now reads disable_functions (same fix applied to backup engine previously). = 1.3.7 = * Added: Restore progress bar — restore now runs in the background with a real-time progress bar and step labels (Authenticating, Downloading, Extracting, Importing database, Cleaning up). * Added: Restore polling endpoint (pcloud_restore_status) mirrors the backup status mechanism. * Improved: Page automatically scrolls to the top when restore starts so the progress bar is always visible. = 1.3.6 = * Fixed: Remote Backups "Modified" column now shows correct date/time — pCloud returns timestamps as RFC 2822 strings, which are now parsed with strtotime() instead of a direct integer cast. * Fixed: Retention policy also updated to use strtotime() for the same reason. = 1.3.5 = * Added: Remote Backups section — scan the configured pCloud folder for existing backup files directly from the admin page. * Added: Scan Remote Backups button lists all `.zip` files in the remote folder with filename, size, and modified date. * Added: Restore and Delete buttons available for every remote backup file. * Added: Test Connection now automatically triggers a remote scan after successful authentication. = 1.3.4 = * Fixed: mysqldump no longer blocks the backup indefinitely — added `--connect-timeout=30` to prevent hanging on DB connection failures, and a shell-level `timeout 300` wrapper (Linux/macOS) to cap total mysqldump runtime. * Fixed: if mysqldump fails for any reason (timeout, not found, empty output), the backup now automatically falls back to the PHP-based database dump instead of aborting the entire backup. * Added: Cancel Backup button shown during an active backup run. * Added: Show Log button to display a real-time debug log panel in the admin page. * Added: Force Clear Stuck Backup button inside the log panel to manually reset a stuck backup state. = 1.3.1 = * Fixed: database backup (Include database) no longer gets stuck — mysqldump deprecation warnings are now suppressed (redirected to /dev/null instead of the SQL file). * Fixed: exec() availability check now reads disable_functions to detect hosts where exec is defined but blocked. * Fixed: PHP fallback database dump now fetches rows in chunks of 500 (LIMIT/OFFSET) instead of loading entire tables into memory, preventing OOM on large databases. * Improved: mysqldump now uses --single-transaction --quick flags for safer, faster dumps on InnoDB tables. = 1.3.0 = * Added: granular backup schedule — choose exact time (HH:MM) for daily, day-of-week + time for weekly, and day-of-month + time for monthly. * Added: "Next run" preview shown below the schedule selector after saving. * Improved: scheduler now calculates the precise next-run timestamp instead of using relative intervals. = 1.2.1 = * Fixed: backup timestamp now uses WordPress site timezone (Asia/Taipei) instead of UTC. = 1.2.0 = * Added: Delete button in Backup Log to permanently remove a backup from pCloud and clear the log entry. = 1.1.0 = * Fixed: manual backup AJAX request no longer times out on sites behind Cloudflare or slow connections — backup now runs in the background and the browser polls for completion. * Fixed: large file upload rewritten to use native cURL streaming (`CURLFile`) instead of loading the entire archive into memory, preventing timeouts on backups over 100 MB. * Added: animated progress bar shown during manual backup with smooth easing animation. * Added: progress bar turns green on success, red on failure. * Added: error messages are now displayed inline below the backup button instead of a generic browser alert. * Fixed: correctly detects EU vs US pCloud server — accounts registered on the EU region must select EU in settings. = 1.0.0 = * Initial release. * Backup wp-content + MySQL database to pCloud (US & EU). * Scheduled backups via WP-Cron (daily / weekly / monthly). * Manual backup, connection test, retention policy, and restore from admin panel. == Upgrade Notice == = 1.2.0 = No database changes required. = 1.1.0 = No database changes. Deactivate and reactivate the plugin after upgrading to ensure the background backup scheduler is refreshed. = 1.0.0 = Initial release. No upgrade steps required.