{"id":15136209,"url":"https://github.com/alddesign/nextcloud-backup","last_synced_at":"2026-02-01T22:32:13.409Z","repository":{"id":236850650,"uuid":"793274524","full_name":"alddesign/nextcloud-backup","owner":"alddesign","description":"Simple PHP script to backup nextclound instances running on a shared webspace.","archived":false,"fork":false,"pushed_at":"2024-07-24T20:22:47.000Z","size":21,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T02:31:59.819Z","etag":null,"topics":["nextcloud","nextcloud-back","php","shared-hosting"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alddesign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-28T22:16:07.000Z","updated_at":"2024-07-24T20:24:40.000Z","dependencies_parsed_at":"2024-04-28T23:29:21.574Z","dependency_job_id":"f25c5504-c08f-45f1-8188-8514f7eae23a","html_url":"https://github.com/alddesign/nextcloud-backup","commit_stats":null,"previous_names":["alddesign/nextcloud-backup"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/alddesign/nextcloud-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alddesign%2Fnextcloud-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alddesign%2Fnextcloud-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alddesign%2Fnextcloud-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alddesign%2Fnextcloud-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alddesign","download_url":"https://codeload.github.com/alddesign/nextcloud-backup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alddesign%2Fnextcloud-backup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262103279,"owners_count":23259424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nextcloud","nextcloud-back","php","shared-hosting"],"created_at":"2024-09-26T06:04:33.475Z","updated_at":"2026-02-01T22:32:13.396Z","avatar_url":"https://github.com/alddesign.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nextcloud-backup\nSimple PHP script to backup nextclound hub instances running on a shared webspace.  \nBecause [How hard can it be](#how-hard-can-it-be) \n\n[Requirements](#requirements)  \n[Installation](#installation)  \n[Configuration](#configuration)  \n[Run Backups](#run-backups)  \n[Perform Restore](#perform-restore)  \n[Notes](#notes)  \n\n## Requirements\n- PHP 8.x\n- PHP needs read/write access to the nextcloud and backup directory\n- PHP has to be able to run shell commands: *zip* and *mysqldump* (in a future release there might be an option to use pure PHP)\n- Nextclound hub running on a *mysql* database\n\n## Installation\nUpload this repository to a place on your webspace which is accessible over the internet. If possible: not into your nextcloud directory. \n\n## Configuration\nThe file `config.php` is used for configuration. Everything you need is documented in this file. *You have to modify this file.*\n\n## Run Backups\nTo run a backup, make a HTTP GET request to the `index.php`. You can do this manually or via WebCRON (which most hosting providers offer). Supply the following parameters:\n- `key` The KEY defined in `config.php`\n- `target` The name of the target to backup, like definded in `config.php`\n- `all=1` Backup all targets defined in `config.php`\n\nExamples:  \n`https://myhost.com/nextcloud-backup/index.php?key=123456\u0026target=my-nextcloud`\n`https://myhost.com/nextcloud-backup/index.php?key=123456\u0026all=1`  \n\n## Perform Restore\nVery straight forward - for more infos see [Backup files](#backup-files)\n- Restore the *Nextcloud Database* using the `.sql` file.  \nYou can import it using [phpMyAdmin](https://www.phpmyadmin.net/) which most hosting providers offer out of the box.\n- Restore the *Nextcloud Directory* by extracting the `.zip` file.  \nThere are plenty of ways to do this: use the file management tool your hosting provider provides, use [Tiny File Manager](https://tinyfilemanager.github.io/), etc. \n- The same goes for the `.data.zip` (optionally, only if you specified a separate nextcloud data directory)\n- Disable maintenance mode by removing this line from nextclouds `config/config.php`:\n  ```php \n  $CONFIG[\"maintenance\"] = true; /*added by nextcloud-backup*/\n  ``` \n\n## Notes\n### Attention\nThis script is tested only briefly on two nextcloud instance. Use at your own risk. I am not responsible for any data loss or corruption.\n\n### Responses\n- If everything worked correctly, the response text is `nextcloud-backup-successful` alongside with a `HTTP 200` response code.\n- When there is an error, the response text contains the **error message** alongside with a `HTTP 500` response code.\nAddidtional infos can be found in the `.log` file.\n\n### Backup files\nA backup consists of these files:\n  - `.sql` the nextcloud database as a full dump.\n  - `.zip` the entire nextcloud directory.\n  - `.data.zip` *(optional)* the nextcloud data directory (only if `dataDir` is specified in target)\n  - `.log` contains infos about the backup process, PHP and nextcloud. Do not delete or modify this file. Nextcloud-backup needs data stored in this file to handle automatic deletion of old backups.\n\n### MAINTAIN_WAIT\nImporant notes about `MAINTAIN_WAIT` in `config/config.php`:  \nYou need to account for PHP *opcache.revalidate_freq* value in your nextcloud environment, because the maintainance mode is enabled/disabled by editing nextclouds *config.php*.  \nYou might also want to wait a little bit longer so that all nextcloud operations and background jobs have finished before the backup starts.  \n***opcache.revalidate_freq* + 30 seconds is a good value.**\n\nFor more information: https://docs.nextcloud.com/server/28/admin_manual/installation/server_tuning.html#enable-php-opcache \n\n### How hard can it be\n(Rant) Simple solutions which \"just work\" do not exist, or are not free...\n\nThe nextcloud backup app: While offering good options for where and how to store backups, simply does not work that well (not at all on most shared web spaces). Restore, while flexible, is complicated and requires *ooc*, direct shell access and exporting a key (good luck if you forgot about that and your nextcloud is dead). The whole thing is far from intuitive, and when you want to backup NOW - good luck, maybe in a few hours or so. Oh and the documentation is always \"still in writing\".\n\nTo be fair, this solution has its weaknesses too. Only full backups, no built-in schedule, no encryption or upload to external locations like ftp, g-drive or whatever.  \nOn the other hand: the backup method is dead-simple and reliable. Its installation and configuration is done in minutes. Restore is easy and doable on any webspace. It can be configured to backup multiple nextcloud instances and also has some sort of quota management. Its independent from nextcloud: Nextcloud updates will not break this script, and this script will not break nextcloud. I think its a good solution for smaller instances and when you \"just want a backup\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falddesign%2Fnextcloud-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falddesign%2Fnextcloud-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falddesign%2Fnextcloud-backup/lists"}