Skip to content

Commit ae91014

Browse files
committed
initial commit
1 parent ab9f24a commit ae91014

File tree

11 files changed

+357
-0
lines changed

11 files changed

+357
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 2
10+
11+
[*.{diff,md}]
12+
trim_trailing_whitespace = false
13+
14+
[*.{php,xml,json}]
15+
indent_size = 4

.gitattributes

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**/.gitattributes export-ignore
2+
**/.gitignore export-ignore
3+
**/.gitmodules export-ignore
4+
**/.github export-ignore
5+
**/.travis export-ignore
6+
**/.travis.yml export-ignore
7+
**/.editorconfig export-ignore
8+
**/.styleci.yml export-ignore
9+
10+
**/phpunit.xml export-ignore
11+
**/tests export-ignore
12+
13+
**/js/dist/**/* -diff
14+
**/js/dist/**/* linguist-generated
15+
**/js/dist-typings/**/* -diff
16+
**/js/dist-typings/**/* linguist-generated
17+
**/js/yarn.lock -diff
18+
**/js/package-lock.json -diff
19+
20+
* text=auto eol=lf

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [android-com-pl, rafaucau]

.github/workflows/backend.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Flarum DB Dumper PHP
2+
3+
on: [workflow_dispatch, push, pull_request]
4+
5+
jobs:
6+
run:
7+
uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@1.x
8+
with:
9+
enable_backend_testing: false
10+
enable_phpstan: false
11+
php_versions: '["8.1", "8.2", "8.3", "8.4"]'
12+
13+
backend_directory: .

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea
2+
.vscode
3+
.fleet
4+
5+
/vendor
6+
composer.lock

.styleci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
preset: recommended
2+
3+
enabled:
4+
- logical_not_operators_with_successor_space
5+
6+
disabled:
7+
- align_double_arrow
8+
- blank_line_after_opening_tag
9+
- multiline_array_trailing_comma
10+
- new_with_braces
11+
- phpdoc_align
12+
- phpdoc_order
13+
- phpdoc_separation
14+
- phpdoc_types

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Flarum DB Dumper
2+
3+
Database backup extension for Flarum that allows dumping database content using the `db:dump` command.
4+
5+
## Installation
6+
7+
```sh
8+
composer require acpl/flarum-db-dumper
9+
```
10+
11+
## Usage
12+
13+
Basic usage:
14+
```sh
15+
# Dump to storage/dumps/dump-YYYY-MM-DD-HHMMSS.sql
16+
php flarum db:dump
17+
18+
# Dump to specific path/file
19+
php flarum db:dump /path/to/backup.sql
20+
php flarum db:dump ../backups/forum.sql
21+
22+
# Dump with compression (based on extension)
23+
php flarum db:dump /backups/dump.sql.gz # gzip compression
24+
php flarum db:dump /backups/dump.sql.bz2 # bzip2 compression
25+
```
26+
27+
### Options
28+
29+
- `--compress`: Use compression (`gz` or `bz2`), e.g. `--compress=gz` for gzip
30+
- `--include-tables=table1,table2`: Include only specific tables
31+
- `--exclude-tables=table1,table2`: Exclude specific tables
32+
- `--skip-structure`: Skip table structure
33+
- `--no-data`: Skip table data, dump only structure
34+
- `--skip-auto-increment`: Skip AUTO_INCREMENT values
35+
- `--no-column-statistics`: Disable column statistics (for MySQL 8 compatibility)
36+
- `--binary-path=/path/to/binary`: Custom mysqldump binary location
37+
38+
## Requirements
39+
40+
- `mysqldump` binary
41+
- `gzip` for `.gz` compression
42+
- `bzip2` for `.bz2` compression
43+
44+
## Links
45+
46+
- [Packagist](https://packagist.org/packages/acpl/flarum-db-dumper)
47+
- [GitHub](https://github.com/android-com-pl/flarum-db-dumper)

composer.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "acpl/flarum-db-dumper",
3+
"description": "Dump the contents of a Flarum database",
4+
"type": "flarum-extension",
5+
"homepage": "https://github.com/android-com-pl/flarum-db-dumper",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Rafał Całka",
10+
"homepage": "https://github.com/rafaucau",
11+
"role": "Developer"
12+
}
13+
],
14+
"require": {
15+
"php": ">=8.1",
16+
"flarum/core": "^1.8",
17+
"spatie/db-dumper": "^3.7"
18+
},
19+
"autoload": {
20+
"psr-4": {
21+
"ACPL\\FlarumDbDumper\\": "src/"
22+
}
23+
},
24+
"extra": {
25+
"flarum-extension": {
26+
"title": "DB Dumper",
27+
"category": "feature",
28+
"icon": {
29+
"name": "fas fa-database",
30+
"backgroundColor": "#0F9D58",
31+
"color": "#fff"
32+
}
33+
},
34+
"flarum-cli": {
35+
"modules": {
36+
"admin": false,
37+
"forum": false,
38+
"js": false,
39+
"jsCommon": false,
40+
"gitConf": true,
41+
"githubActions": true,
42+
"prettier": false,
43+
"typescript": false,
44+
"bundlewatch": false,
45+
"backendTesting": false,
46+
"editorConfig": true,
47+
"styleci": true,
48+
"css": false
49+
}
50+
}
51+
},
52+
"minimum-stability": "dev",
53+
"prefer-stable": true,
54+
"config": {
55+
"sort-packages": true
56+
}
57+
}

extend.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace ACPL\FlarumDbDumper;
4+
5+
use Flarum\Extend;
6+
7+
return [
8+
(new Extend\Console())->command(DumbDbCommand::class),
9+
];

phpstan.neon

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
includes:
2+
- vendor/flarum/phpstan/extension.neon
3+
4+
parameters:
5+
level: 5
6+
paths:
7+
- src
8+
- extend.php
9+
excludePaths:
10+
- *.blade.php
11+
checkMissingIterableValueType: false
12+
databaseMigrationsPath: ['migrations']

0 commit comments

Comments
 (0)