Skip to content

Commit

Permalink
Merge upstream v5.18.3
Browse files Browse the repository at this point in the history
commit be5a8dc
Merge: 5490a6e 4148f2c
Author: Adam Warner <[email protected]>
Date:   Fri Jul 5 19:12:15 2024 +0100

    Pi-hole core v5.18.3 (pi-hole#5694)

commit 4148f2c
Author: Adam Warner <[email protected]>
Date:   Fri Jul 5 19:03:40 2024 +0100

    tabs->spaces for editorconfig (Not sure how this has nto been caught before...)

    Signed-off-by: Adam Warner <[email protected]>

commit 2c497a9
Author: DL6ER <[email protected]>
Date:   Tue Apr 30 15:47:57 2024 +0200

    Add protocol validation when downloading blocklist from URL

    Signed-off-by: DL6ER <[email protected]>

commit 548e142
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Jun 22 16:00:48 2024 +0000

    Bump pytest from 8.2.1 to 8.2.2 in /test

    Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.2.1 to 8.2.2.
    - [Release notes](https://github.com/pytest-dev/pytest/releases)
    - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
    - [Commits](pytest-dev/pytest@8.2.1...8.2.2)

    ---
    updated-dependencies:
    - dependency-name: pytest
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit bfc2cf6
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Jun 22 16:01:05 2024 +0000

    Bump tox from 4.15.0 to 4.15.1 in /test

    Bumps [tox](https://github.com/tox-dev/tox) from 4.15.0 to 4.15.1.
    - [Release notes](https://github.com/tox-dev/tox/releases)
    - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst)
    - [Commits](tox-dev/tox@4.15.0...4.15.1)

    ---
    updated-dependencies:
    - dependency-name: tox
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 97324ae
Author: Adam Warner <[email protected]>
Date:   Sat Jun 22 13:49:27 2024 +0100

    remove centos8 tests from development to prevent build fails (yes, I know it's likely that we will merge development-v6 -> development" soon" but.. just in case)

    Signed-off-by: Adam Warner <[email protected]>

commit 1e6fe9c
Merge: 3cf538e fdd5b5c
Author: yubiuser <[email protected]>
Date:   Sat Jun 15 14:16:16 2024 +0200

    Bump actions/checkout from 4.1.6 to 4.1.7 (pi-hole#5686)

commit fdd5b5c
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Jun 15 10:14:34 2024 +0000

    Bump actions/checkout from 4.1.6 to 4.1.7

    Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.6 to 4.1.7.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v4.1.6...v4.1.7)

    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 3cf538e
Merge: 78bd872 36f05cb
Author: yubiuser <[email protected]>
Date:   Sat Jun 1 13:02:37 2024 +0200

    Bump pytest-testinfra from 10.1.0 to 10.1.1 in /test (pi-hole#5672)

commit 36f05cb
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Jun 1 10:29:56 2024 +0000

    Bump pytest-testinfra from 10.1.0 to 10.1.1 in /test

    Bumps [pytest-testinfra](https://github.com/pytest-dev/pytest-testinfra) from 10.1.0 to 10.1.1.
    - [Release notes](https://github.com/pytest-dev/pytest-testinfra/releases)
    - [Changelog](https://github.com/pytest-dev/pytest-testinfra/blob/main/CHANGELOG.rst)
    - [Commits](pytest-dev/pytest-testinfra@10.1.0...10.1.1)

    ---
    updated-dependencies:
    - dependency-name: pytest-testinfra
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 78bd872
Merge: 741b9e1 70376c2
Author: yubiuser <[email protected]>
Date:   Sat Jun 1 12:15:39 2024 +0200

    Bump eps1lon/actions-label-merge-conflict from 3.0.1 to 3.0.2 (pi-hole#5669)

commit 70376c2
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Jun 1 10:01:49 2024 +0000

    Bump eps1lon/actions-label-merge-conflict from 3.0.1 to 3.0.2

    Bumps [eps1lon/actions-label-merge-conflict](https://github.com/eps1lon/actions-label-merge-conflict) from 3.0.1 to 3.0.2.
    - [Release notes](https://github.com/eps1lon/actions-label-merge-conflict/releases)
    - [Changelog](https://github.com/eps1lon/actions-label-merge-conflict/blob/main/CHANGELOG.md)
    - [Commits](eps1lon/actions-label-merge-conflict@v3.0.1...v3.0.2)

    ---
    updated-dependencies:
    - dependency-name: eps1lon/actions-label-merge-conflict
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 741b9e1
Merge: dd64cf7 d15beff
Author: yubiuser <[email protected]>
Date:   Sat May 25 21:54:01 2024 +0200

    Bump pytest from 8.2.0 to 8.2.1 in /test (pi-hole#5665)

commit d15beff
Author: Christian König <[email protected]>
Date:   Sat May 25 21:49:24 2024 +0200

    Fix codespell

    Signed-off-by: Christian König <[email protected]>

commit 01e0c60
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat May 25 10:38:28 2024 +0000

    Bump pytest from 8.2.0 to 8.2.1 in /test

    Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.2.0 to 8.2.1.
    - [Release notes](https://github.com/pytest-dev/pytest/releases)
    - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
    - [Commits](pytest-dev/pytest@8.2.0...8.2.1)

    ---
    updated-dependencies:
    - dependency-name: pytest
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit dd64cf7
Merge: 99e72f6 443c5e8
Author: yubiuser <[email protected]>
Date:   Wed May 22 21:29:54 2024 +0200

    Bump actions/checkout from 4.1.5 to 4.1.6 (pi-hole#5661)

commit 443c5e8
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat May 18 10:31:36 2024 +0000

    Bump actions/checkout from 4.1.5 to 4.1.6

    Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.5 to 4.1.6.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v4.1.5...v4.1.6)

    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 99e72f6
Merge: 1812d9c f478913
Author: yubiuser <[email protected]>
Date:   Sat May 11 22:40:58 2024 +0200

    Bump actions/checkout from 4.1.4 to 4.1.5 (pi-hole#5656)

commit f478913
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat May 11 20:36:33 2024 +0000

    Bump actions/checkout from 4.1.4 to 4.1.5

    Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.4 to 4.1.5.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v4.1.4...v4.1.5)

    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 1812d9c
Merge: c0cc9ba 7426076
Author: yubiuser <[email protected]>
Date:   Sat May 11 22:35:46 2024 +0200

    Bump eps1lon/actions-label-merge-conflict from 3.0.0 to 3.0.1 (pi-hole#5655)

commit 7426076
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat May 11 20:32:20 2024 +0000

    Bump eps1lon/actions-label-merge-conflict from 3.0.0 to 3.0.1

    Bumps [eps1lon/actions-label-merge-conflict](https://github.com/eps1lon/actions-label-merge-conflict) from 3.0.0 to 3.0.1.
    - [Release notes](https://github.com/eps1lon/actions-label-merge-conflict/releases)
    - [Changelog](https://github.com/eps1lon/actions-label-merge-conflict/blob/main/CHANGELOG.md)
    - [Commits](eps1lon/actions-label-merge-conflict@v3.0.0...v3.0.1)

    ---
    updated-dependencies:
    - dependency-name: eps1lon/actions-label-merge-conflict
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit c0cc9ba
Author: Christian König <[email protected]>
Date:   Sat May 11 14:21:51 2024 +0200

    Add Ubuntu 24.04 and Fedora 40, remove Fedora 38

    Signed-off-by: Christian König <[email protected]>

commit 2371f43
Merge: 976dc1c 9f7cd05
Author: yubiuser <[email protected]>
Date:   Sat May 4 13:11:13 2024 +0200

    Bump pytest from 8.1.2 to 8.2.0 in /test (pi-hole#5648)

commit 9f7cd05
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat May 4 10:56:23 2024 +0000

    Bump pytest from 8.1.2 to 8.2.0 in /test

    Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.1.2 to 8.2.0.
    - [Release notes](https://github.com/pytest-dev/pytest/releases)
    - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
    - [Commits](pytest-dev/pytest@8.1.2...8.2.0)

    ---
    updated-dependencies:
    - dependency-name: pytest
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 976dc1c
Merge: cb30943 29d4ed1
Author: yubiuser <[email protected]>
Date:   Sat May 4 12:55:40 2024 +0200

    Bump pytest-xdist from 3.5.0 to 3.6.1 in /test (pi-hole#5647)

commit 29d4ed1
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat May 4 10:15:49 2024 +0000

    Bump pytest-xdist from 3.5.0 to 3.6.1 in /test

    Bumps [pytest-xdist](https://github.com/pytest-dev/pytest-xdist) from 3.5.0 to 3.6.1.
    - [Release notes](https://github.com/pytest-dev/pytest-xdist/releases)
    - [Changelog](https://github.com/pytest-dev/pytest-xdist/blob/master/CHANGELOG.rst)
    - [Commits](pytest-dev/pytest-xdist@v3.5.0...v3.6.1)

    ---
    updated-dependencies:
    - dependency-name: pytest-xdist
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit cb30943
Merge: c19bfb9 b33bbd7
Author: yubiuser <[email protected]>
Date:   Sat Apr 27 13:34:41 2024 +0200

    Bump tox from 4.14.2 to 4.15.0 in /test (pi-hole#5642)

commit c19bfb9
Merge: e6c15c3 b5a7567
Author: yubiuser <[email protected]>
Date:   Sat Apr 27 13:34:01 2024 +0200

    Bump pytest from 8.1.1 to 8.1.2 in /test (pi-hole#5641)

commit e6c15c3
Merge: 091a689 3cebb3f
Author: yubiuser <[email protected]>
Date:   Sat Apr 27 13:33:28 2024 +0200

    Bump actions/checkout from 4.1.3 to 4.1.4 (pi-hole#5640)

commit b33bbd7
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Apr 27 10:53:28 2024 +0000

    Bump tox from 4.14.2 to 4.15.0 in /test

    Bumps [tox](https://github.com/tox-dev/tox) from 4.14.2 to 4.15.0.
    - [Release notes](https://github.com/tox-dev/tox/releases)
    - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst)
    - [Commits](tox-dev/tox@4.14.2...4.15.0)

    ---
    updated-dependencies:
    - dependency-name: tox
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit b5a7567
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Apr 27 10:53:24 2024 +0000

    Bump pytest from 8.1.1 to 8.1.2 in /test

    Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.1.1 to 8.1.2.
    - [Release notes](https://github.com/pytest-dev/pytest/releases)
    - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
    - [Commits](pytest-dev/pytest@8.1.1...8.1.2)

    ---
    updated-dependencies:
    - dependency-name: pytest
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 3cebb3f
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Apr 27 10:46:03 2024 +0000

    Bump actions/checkout from 4.1.3 to 4.1.4

    Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.3 to 4.1.4.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v4.1.3...v4.1.4)

    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 091a689
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sun Apr 21 16:24:45 2024 +0000

    Bump actions/setup-python from 5.0.0 to 5.1.0

    Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.0.0 to 5.1.0.
    - [Release notes](https://github.com/actions/setup-python/releases)
    - [Commits](actions/setup-python@v5.0.0...v5.1.0)

    ---
    updated-dependencies:
    - dependency-name: actions/setup-python
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 44703bb
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Apr 20 10:05:32 2024 +0000

    Bump actions/checkout from 4.1.2 to 4.1.3

    Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.3.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v4.1.2...v4.1.3)

    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 26132fa
Merge: b32f778 81ad1a7
Author: Adam Warner <[email protected]>
Date:   Mon Apr 1 14:23:05 2024 +0100

    Bump eps1lon/actions-label-merge-conflict from 2.1.0 to 3.0.0 (pi-hole#5626)

commit b32f778
Merge: c69e0eb 7aab7d9
Author: Adam Warner <[email protected]>
Date:   Mon Apr 1 14:17:30 2024 +0100

    Bump tox from 4.14.1 to 4.14.2 in /test (pi-hole#5611)

commit c69e0eb
Merge: 9f5d4f0 08dd321
Author: Adam Warner <[email protected]>
Date:   Mon Apr 1 14:17:03 2024 +0100

    Bump pytest from 8.0.2 to 8.1.1 in /test (pi-hole#5607)

commit 9f5d4f0
Merge: 8cfccf9 5490a6e
Author: Adam Warner <[email protected]>
Date:   Sun Mar 31 21:59:44 2024 +0100

    Sync master back into development (pi-hole#5630)

commit 81ad1a7
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Mar 30 10:50:22 2024 +0000

    Bump eps1lon/actions-label-merge-conflict from 2.1.0 to 3.0.0

    Bumps [eps1lon/actions-label-merge-conflict](https://github.com/eps1lon/actions-label-merge-conflict) from 2.1.0 to 3.0.0.
    - [Release notes](https://github.com/eps1lon/actions-label-merge-conflict/releases)
    - [Changelog](https://github.com/eps1lon/actions-label-merge-conflict/blob/main/CHANGELOG.md)
    - [Commits](eps1lon/actions-label-merge-conflict@v2.1.0...v3.0.0)

    ---
    updated-dependencies:
    - dependency-name: eps1lon/actions-label-merge-conflict
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 7aab7d9
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Mar 23 10:34:48 2024 +0000

    Bump tox from 4.14.1 to 4.14.2 in /test

    Bumps [tox](https://github.com/tox-dev/tox) from 4.14.1 to 4.14.2.
    - [Release notes](https://github.com/tox-dev/tox/releases)
    - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst)
    - [Commits](tox-dev/tox@4.14.1...4.14.2)

    ---
    updated-dependencies:
    - dependency-name: tox
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 08dd321
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Mar 16 10:44:52 2024 +0000

    Bump pytest from 8.0.2 to 8.1.1 in /test

    Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.0.2 to 8.1.1.
    - [Release notes](https://github.com/pytest-dev/pytest/releases)
    - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
    - [Commits](pytest-dev/pytest@8.0.2...8.1.1)

    ---
    updated-dependencies:
    - dependency-name: pytest
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>
  • Loading branch information
mgziminsky committed Jul 5, 2024
1 parent c12d77c commit e248f76
Show file tree
Hide file tree
Showing 23 changed files with 320 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
-
name: Checkout repository
uses: actions/[email protected].2
uses: actions/[email protected].7
# Initializes the CodeQL tools for scanning.
-
name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge-conflict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check if PRs are have merge conflicts
uses: eps1lon/actions-label-merge-conflict@v2.1.0
uses: eps1lon/actions-label-merge-conflict@v3.0.2
with:
dirtyLabel: "PR: Merge Conflict"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected].2
uses: actions/[email protected].7
- name: Remove 'stale' label
run: gh issue edit ${{ github.event.issue.number }} --remove-label ${{ env.stale_label }}
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-back-to-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
name: Syncing branches
steps:
- name: Checkout
uses: actions/[email protected].2
uses: actions/[email protected].7
- name: Opening pull request
run: gh pr create -B development -H master --title 'Sync master back into development' --body 'Created by Github action' --label 'internal'
env:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected].2
uses: actions/[email protected].7

- name: Check scripts in repository are executable
run: |
Expand Down Expand Up @@ -55,19 +55,19 @@ jobs:
ubuntu_20,
ubuntu_22,
ubuntu_23,
centos_8,
ubuntu_24,
centos_9,
fedora_38,
fedora_39,
fedora_40,
]
env:
DISTRO: ${{matrix.distro}}
steps:
- name: Checkout repository
uses: actions/[email protected].2
uses: actions/[email protected].7

- name: Set up Python 3.10
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5.1.0
with:
python-version: "3.10"

Expand Down
224 changes: 112 additions & 112 deletions advanced/Scripts/database_migration/gravity-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,119 +13,119 @@
readonly scriptPath="/etc/.pihole/advanced/Scripts/database_migration/gravity"

upgrade_gravityDB(){
local database piholeDir auditFile version
database="${1}"
piholeDir="${2}"
auditFile="${piholeDir}/auditlog.list"
local database piholeDir auditFile version
database="${1}"
piholeDir="${2}"
auditFile="${piholeDir}/auditlog.list"

# Get database version
version="$(pihole-FTL sqlite3 -ni "${database}" "SELECT \"value\" FROM \"info\" WHERE \"property\" = 'version';")"
# Get database version
version="$(pihole-FTL sqlite3 -ni "${database}" "SELECT \"value\" FROM \"info\" WHERE \"property\" = 'version';")"

if [[ "$version" == "1" ]]; then
# This migration script upgrades the gravity.db file by
# adding the domain_audit table
echo -e " ${INFO} Upgrading gravity database from version 1 to 2"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/1_to_2.sql"
version=2
if [[ "$version" == "1" ]]; then
# This migration script upgrades the gravity.db file by
# adding the domain_audit table
echo -e " ${INFO} Upgrading gravity database from version 1 to 2"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/1_to_2.sql"
version=2

# Store audit domains in database table
if [ -e "${auditFile}" ]; then
echo -e " ${INFO} Migrating content of ${auditFile} into new database"
# database_table_from_file is defined in gravity.sh
database_table_from_file "domain_audit" "${auditFile}"
fi
fi
if [[ "$version" == "2" ]]; then
# This migration script upgrades the gravity.db file by
# renaming the regex table to regex_blacklist, and
# creating a new regex_whitelist table + corresponding linking table and views
echo -e " ${INFO} Upgrading gravity database from version 2 to 3"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/2_to_3.sql"
version=3
fi
if [[ "$version" == "3" ]]; then
# This migration script unifies the formally separated domain
# lists into a single table with a UNIQUE domain constraint
echo -e " ${INFO} Upgrading gravity database from version 3 to 4"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/3_to_4.sql"
version=4
fi
if [[ "$version" == "4" ]]; then
# This migration script upgrades the gravity and list views
# implementing necessary changes for per-client blocking
echo -e " ${INFO} Upgrading gravity database from version 4 to 5"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/4_to_5.sql"
version=5
fi
if [[ "$version" == "5" ]]; then
# This migration script upgrades the adlist view
# to return an ID used in gravity.sh
echo -e " ${INFO} Upgrading gravity database from version 5 to 6"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/5_to_6.sql"
version=6
fi
if [[ "$version" == "6" ]]; then
# This migration script adds a special group with ID 0
# which is automatically associated to all clients not
# having their own group assignments
echo -e " ${INFO} Upgrading gravity database from version 6 to 7"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/6_to_7.sql"
version=7
fi
if [[ "$version" == "7" ]]; then
# This migration script recreated the group table
# to ensure uniqueness on the group name
# We also add date_added and date_modified columns
echo -e " ${INFO} Upgrading gravity database from version 7 to 8"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/7_to_8.sql"
version=8
fi
if [[ "$version" == "8" ]]; then
# This migration fixes some issues that were introduced
# in the previous migration script.
echo -e " ${INFO} Upgrading gravity database from version 8 to 9"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/8_to_9.sql"
version=9
fi
if [[ "$version" == "9" ]]; then
# This migration drops unused tables and creates triggers to remove
# obsolete groups assignments when the linked items are deleted
echo -e " ${INFO} Upgrading gravity database from version 9 to 10"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/9_to_10.sql"
version=10
fi
if [[ "$version" == "10" ]]; then
# This adds timestamp and an optional comment field to the client table
# These fields are only temporary and will be replaces by the columns
# defined in gravity.db.sql during gravity swapping. We add them here
# to keep the copying process generic (needs the same columns in both the
# source and the destination databases).
echo -e " ${INFO} Upgrading gravity database from version 10 to 11"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/10_to_11.sql"
version=11
fi
if [[ "$version" == "11" ]]; then
# Rename group 0 from "Unassociated" to "Default"
echo -e " ${INFO} Upgrading gravity database from version 11 to 12"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/11_to_12.sql"
version=12
fi
if [[ "$version" == "12" ]]; then
# Add column date_updated to adlist table
echo -e " ${INFO} Upgrading gravity database from version 12 to 13"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/12_to_13.sql"
version=13
fi
if [[ "$version" == "13" ]]; then
# Add columns number and status to adlist table
echo -e " ${INFO} Upgrading gravity database from version 13 to 14"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/13_to_14.sql"
version=14
fi
if [[ "$version" == "14" ]]; then
# Changes the vw_adlist created in 5_to_6
echo -e " ${INFO} Upgrading gravity database from version 14 to 15"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/14_to_15.sql"
version=15
fi
# Store audit domains in database table
if [ -e "${auditFile}" ]; then
echo -e " ${INFO} Migrating content of ${auditFile} into new database"
# database_table_from_file is defined in gravity.sh
database_table_from_file "domain_audit" "${auditFile}"
fi
fi
if [[ "$version" == "2" ]]; then
# This migration script upgrades the gravity.db file by
# renaming the regex table to regex_blacklist, and
# creating a new regex_whitelist table + corresponding linking table and views
echo -e " ${INFO} Upgrading gravity database from version 2 to 3"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/2_to_3.sql"
version=3
fi
if [[ "$version" == "3" ]]; then
# This migration script unifies the formally separated domain
# lists into a single table with a UNIQUE domain constraint
echo -e " ${INFO} Upgrading gravity database from version 3 to 4"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/3_to_4.sql"
version=4
fi
if [[ "$version" == "4" ]]; then
# This migration script upgrades the gravity and list views
# implementing necessary changes for per-client blocking
echo -e " ${INFO} Upgrading gravity database from version 4 to 5"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/4_to_5.sql"
version=5
fi
if [[ "$version" == "5" ]]; then
# This migration script upgrades the adlist view
# to return an ID used in gravity.sh
echo -e " ${INFO} Upgrading gravity database from version 5 to 6"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/5_to_6.sql"
version=6
fi
if [[ "$version" == "6" ]]; then
# This migration script adds a special group with ID 0
# which is automatically associated to all clients not
# having their own group assignments
echo -e " ${INFO} Upgrading gravity database from version 6 to 7"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/6_to_7.sql"
version=7
fi
if [[ "$version" == "7" ]]; then
# This migration script recreated the group table
# to ensure uniqueness on the group name
# We also add date_added and date_modified columns
echo -e " ${INFO} Upgrading gravity database from version 7 to 8"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/7_to_8.sql"
version=8
fi
if [[ "$version" == "8" ]]; then
# This migration fixes some issues that were introduced
# in the previous migration script.
echo -e " ${INFO} Upgrading gravity database from version 8 to 9"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/8_to_9.sql"
version=9
fi
if [[ "$version" == "9" ]]; then
# This migration drops unused tables and creates triggers to remove
# obsolete groups assignments when the linked items are deleted
echo -e " ${INFO} Upgrading gravity database from version 9 to 10"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/9_to_10.sql"
version=10
fi
if [[ "$version" == "10" ]]; then
# This adds timestamp and an optional comment field to the client table
# These fields are only temporary and will be replaces by the columns
# defined in gravity.db.sql during gravity swapping. We add them here
# to keep the copying process generic (needs the same columns in both the
# source and the destination databases).
echo -e " ${INFO} Upgrading gravity database from version 10 to 11"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/10_to_11.sql"
version=11
fi
if [[ "$version" == "11" ]]; then
# Rename group 0 from "Unassociated" to "Default"
echo -e " ${INFO} Upgrading gravity database from version 11 to 12"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/11_to_12.sql"
version=12
fi
if [[ "$version" == "12" ]]; then
# Add column date_updated to adlist table
echo -e " ${INFO} Upgrading gravity database from version 12 to 13"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/12_to_13.sql"
version=13
fi
if [[ "$version" == "13" ]]; then
# Add columns number and status to adlist table
echo -e " ${INFO} Upgrading gravity database from version 13 to 14"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/13_to_14.sql"
version=14
fi
if [[ "$version" == "14" ]]; then
# Changes the vw_adlist created in 5_to_6
echo -e " ${INFO} Upgrading gravity database from version 14 to 15"
pihole-FTL sqlite3 -ni "${database}" < "${scriptPath}/14_to_15.sql"
version=15
fi
}
6 changes: 3 additions & 3 deletions advanced/Scripts/database_migration/gravity/1_to_2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ BEGIN TRANSACTION;

CREATE TABLE domain_audit
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
domain TEXT UNIQUE NOT NULL,
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int))
id INTEGER PRIMARY KEY AUTOINCREMENT,
domain TEXT UNIQUE NOT NULL,
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int))
);

UPDATE info SET value = 2 WHERE property = 'version';
Expand Down
24 changes: 12 additions & 12 deletions advanced/Scripts/database_migration/gravity/2_to_3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ ALTER TABLE regex RENAME TO regex_blacklist;

CREATE TABLE regex_blacklist_by_group
(
regex_blacklist_id INTEGER NOT NULL REFERENCES regex_blacklist (id),
group_id INTEGER NOT NULL REFERENCES "group" (id),
PRIMARY KEY (regex_blacklist_id, group_id)
regex_blacklist_id INTEGER NOT NULL REFERENCES regex_blacklist (id),
group_id INTEGER NOT NULL REFERENCES "group" (id),
PRIMARY KEY (regex_blacklist_id, group_id)
);

INSERT INTO regex_blacklist_by_group SELECT * FROM regex_by_group;
Expand All @@ -32,19 +32,19 @@ CREATE TRIGGER tr_regex_blacklist_update AFTER UPDATE ON regex_blacklist

CREATE TABLE regex_whitelist
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
domain TEXT UNIQUE NOT NULL,
enabled BOOLEAN NOT NULL DEFAULT 1,
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
comment TEXT
id INTEGER PRIMARY KEY AUTOINCREMENT,
domain TEXT UNIQUE NOT NULL,
enabled BOOLEAN NOT NULL DEFAULT 1,
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
comment TEXT
);

CREATE TABLE regex_whitelist_by_group
(
regex_whitelist_id INTEGER NOT NULL REFERENCES regex_whitelist (id),
group_id INTEGER NOT NULL REFERENCES "group" (id),
PRIMARY KEY (regex_whitelist_id, group_id)
regex_whitelist_id INTEGER NOT NULL REFERENCES regex_whitelist (id),
group_id INTEGER NOT NULL REFERENCES "group" (id),
PRIMARY KEY (regex_whitelist_id, group_id)
);

CREATE VIEW vw_regex_whitelist AS SELECT DISTINCT domain
Expand Down
20 changes: 10 additions & 10 deletions advanced/Scripts/database_migration/gravity/3_to_4.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ BEGIN TRANSACTION;

CREATE TABLE domainlist
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
type INTEGER NOT NULL DEFAULT 0,
domain TEXT UNIQUE NOT NULL,
enabled BOOLEAN NOT NULL DEFAULT 1,
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
comment TEXT
id INTEGER PRIMARY KEY AUTOINCREMENT,
type INTEGER NOT NULL DEFAULT 0,
domain TEXT UNIQUE NOT NULL,
enabled BOOLEAN NOT NULL DEFAULT 1,
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
comment TEXT
);

ALTER TABLE whitelist ADD COLUMN type INTEGER;
Expand Down Expand Up @@ -41,9 +41,9 @@ DROP TABLE regex_whitelist_by_group;
DROP TABLE regex_blacklist_by_group;
CREATE TABLE domainlist_by_group
(
domainlist_id INTEGER NOT NULL REFERENCES domainlist (id),
group_id INTEGER NOT NULL REFERENCES "group" (id),
PRIMARY KEY (domainlist_id, group_id)
domainlist_id INTEGER NOT NULL REFERENCES domainlist (id),
group_id INTEGER NOT NULL REFERENCES "group" (id),
PRIMARY KEY (domainlist_id, group_id)
);

DROP TRIGGER tr_whitelist_update;
Expand Down
Loading

0 comments on commit e248f76

Please sign in to comment.