You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 2, 2024. It is now read-only.
|`dir`|string |current directory |The directory where the database files are stored. |
97
+
|`backupLocation`|string |current directory (`/backups`) |The directory where the backup zip files will be stored. |
96
98
|`format`|object |`\Filebase\Format\Json`|The format class used to encode/decode data |
97
99
|`validate`|array ||Check [Validation Rules](https://github.com/tmarois/Filebase#6-validation-optional) for more details |
98
100
|`cache`|bool |false |Stores [query](https://github.com/tmarois/Filebase#8-queries) results into cache for faster loading. |
@@ -400,13 +402,34 @@ Cached queries will only be used if a specific saved cache is less than the expi
400
402
## (10) Database Backups
401
403
By default you can backup your database using `$db->backup()->save()`, this will create a `.zip` file of your entire database based on your `dir` path.
402
404
403
-
### Methods used with invoking the Backup class:
404
-
These methods can be used when invoking `$db->backup()` on your `Database`.
405
+
### Methods:
406
+
These methods can be used when invoking `backup()` on your `Database`.
405
407
406
-
-`save()` Saves a backup of your database.
407
-
-`clean()` Purges all existing .zip files within the backup location
408
+
-`save()` Saves a backup of your database (in your backup location `.zip`)
409
+
-`clean()` Purges all existing backups (`.zip` files in your backup location)
408
410
-`find()` Returns an `array` of all existing backups (array key by `time()` when backup was created)
409
-
-`rollback()` Restore your database to an existing backup. (by default restores the latest backup if any exist)
411
+
412
+
**Example:**
413
+
414
+
```php
415
+
416
+
// invoke your database
417
+
$database = new \Filebase\Database([
418
+
'dir' => '/storage/users',
419
+
'backupLocation' => '/storage/backup',
420
+
]);
421
+
422
+
// save a new backup of your database
423
+
// will look something like /storage/backup/1504631092.zip
424
+
$database->backup()->save();
425
+
426
+
// delete all existing backups
427
+
$database->backup()->clean();
428
+
429
+
// get a list of all existing backups (organized from new to old)
0 commit comments