PHPackages                             gggeek/ezdbintegrity - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. gggeek/ezdbintegrity

ActiveEzpublish-legacy-extension[Database &amp; ORM](/categories/database)

gggeek/ezdbintegrity
====================

Allows checking integrity of data in the database

0.28.0(3y ago)59.1k3[3 issues](https://github.com/gggeek/ezdbintegrity/issues)GPL-2.0-or-laterPHP

Since Mar 8Pushed 3y ago3 watchersCompare

[ Source](https://github.com/gggeek/ezdbintegrity)[ Packagist](https://packagist.org/packages/gggeek/ezdbintegrity)[ Docs](http://projects.ez.no/ezdbintegrity)[ GitHub Sponsors](https://github.com/sponsors/tanoconsulting)[ RSS](/packages/gggeek-ezdbintegrity/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (43)Used By (0)

eZ DB Integrity Extension for eZPublish / eZPlatform
====================================================

[](#ez-db-integrity-extension-for-ezpublish--ezplatform)

For eZPlatform 3.0 and later, please check out:

Goals:
------

[](#goals)

Allow checking integrity of data in a database (the eZ Publish one, but any other as well). Allow checking integrity of the eZPublish storage files (images and binary files from content).

Checks supported:
-----------------

[](#checks-supported)

1. Foreign Key integrity

    This applies to databases which have no FK enabled, but where parent-child relationships do in fact exist. The relationships to check are defined via configuration files. The standard configuration has FK definitions for the eZPublish/eZPlatform schema (versions 4.x =&gt; 5.x)
2. Data integrity

    Similar to FK checks, these are custom sql queries which can be executed to find out any type of data inconsistency. The queries to run are defined via configuration files. The standard configuration has many data integrity queries for the eZPublish/eZPlatform schema (versions 4.x =&gt; 5.x)
3. Content Objects integrity

    This checks eZPublish Content Objects, validating every attribute based on its datatype definition. F.e. it checks if attributes are null which should not be, or if image files are missing. NB: not all datatypes are supported for now, just a limited set.
4. Orphan storage files

    This checks all files found on disk in the known eZPublish storage directories, and lists any which are not found in the database, corresponding to the ezmedia, ezimage and ezbinaryfile attributes.

    *NOTE* be warned that:

    - image variations generated via the eZ5 stack are not stored in the ezimage table in the db. As such, they will be reported as orphans. If you delete them, eZ5 will regenerate them, so it's not a huge deal, but that might include many gigs of files which are actually in use

    The script can optionally delete the files as well. We assume no responsibility if you use this feature!

How to use it:
--------------

[](#how-to-use-it)

- run `php extension/ezdbintegrity/bin/php/checkschema.php --help`, `php extension/ezdbintegrity/bin/php/checkattributes.php --help` and `php extension/ezdbintegrity/bin/php/checkstorage.php --help` to get started
- you can define more FKs and attribute types to be checked, in ezdbintegrity.ini.append.php

DISCLAIMER
----------

[](#disclaimer)

!!! DO NOT BLINDLY DELETE ANY DATA IN THE DB WHICH IS REPORTED AS FOREIGN KEY VIOLATION !!!

!!! DO NOT BLINDLY DELETE ANY STORAGE FILE WHICH IS REPORTED AS ORPHAN !!!

We take no responsibility for consequences if you do. You should carefully investigate the reason for such violations. There is a good chance that the problem lies within this extension and not your data - the FK definitions provided have been reverse-engineered from existing codebase and databases, and are not cast in stone.

Running tests:
--------------

[](#running-tests)

The bundle uses PHPUnit to run functional tests.

*NB* the tests do *not* mock interaction with the database, but create/modify/delete many types of data in it. As such, there are good chances that running tests will leave stale/broken data. It is recommended to run the tests suite using a dedicated eZPublish installation or at least a dedicated database.

#### Setting up a dedicated test environment for the bundle

[](#setting-up-a-dedicated-test-environment-for-the-bundle)

A safe choice to run the tests of the extension is to set up a dedicated environment, similar to the one used when the test suite is run on GitHub Actions. The advantages are multiple: on one hand you can start with any version of eZPublish you want; on the other you will be more confident that any tests you add or modify will also pass on GitHub. The disadvantages are that you will need Docker and Docker-compose, and that the environment you will use will look quite unlike a standard eZPublish setup! Also, it will take a considerable amount of disk space and time to build.

Steps to set up a dedicated test environment and run the tests in it:

```
git clone --depth 1 https://github.com/tanoconsulting/euts.git teststack
# if you have a github auth token, it is a good idea to copy it now to teststack/docker/data/.composer/auth.json

# this config sets up a test environment with eZPlatform 2.5 running on php 7.4 / ubuntu jammy
export TESTSTACK_CONFIG_FILE=Tests/environment/.euts.2.5.env

./teststack/teststack build
./teststack/teststack runtests
./teststack/teststack stop

```

Note: this will take some time the 1st time your run it, but it will be quicker on subsequent runs. Note: make sure to have enough disk space available.

In case you want to run manually commands, such as the symfony console:

```
./teststack/teststack console cache:clear

```

Or easily get to a database shell prompt:

```
./teststack/teststack dbconsole

```

Or command-line shell prompt to the Docker container where tests are run:

```
./teststack/teststack shell

```

The tests in the Docker container run using the version of debian/php/mysql/eZPlatform kernel specified in the file `Tests/environment/.euts.2.5.env`, as specified in env var `TESTSTACK_CONFIG_FILE`. If no value is set for that environment variable, a file named `.euts.env` is looked for. If no such file is present, some defaults are used, you can check the documentation in ./teststack/README.md to find out what they are. If you want to test against a different version of eZ/php/debian, feel free to:

- create the `.euts.env` file, if it does not exist
- add to it any required var (see file `teststack/.euts.env.example` as guidance)
- rebuild the test stack
- run tests the usual way

You can even keep multiple test stacks available in parallel, by using different env files, eg:

- create a file `.euts.env.local` and add to it any required env var, starting with a unique `COMPOSE_PROJECT_NAME`
- build the new test stack via `./teststack/teststack. -e .euts.env.local build`
- run the tests via: `./teststack/teststack -e .euts.env.local runtests`

[![License](https://camo.githubusercontent.com/d4feeceb86d6f1f51e290ab870dd0e718f7cd8455ae041ed150c3145b5d4c4ab/68747470733a2f2f706f7365722e707567782e6f72672f67676765656b2f657a6462696e746567726974792f6c6963656e7365)](https://packagist.org/packages/gggeek/ezdbintegrity)[![Latest Stable Version](https://camo.githubusercontent.com/1fffafb58375d030809baf53acaf3ef4a08ae5a1605479b9ced723cbb50bddb2/68747470733a2f2f706f7365722e707567782e6f72672f67676765656b2f657a6462696e746567726974792f762f737461626c65)](https://packagist.org/packages/gggeek/ezdbintegrity)[![Total Downloads](https://camo.githubusercontent.com/6d840e24f1ff7fe8c7b4e30c3b548cd3ce0941073031521fe5dd54fdb27fc051/68747470733a2f2f706f7365722e707567782e6f72672f67676765656b2f657a6462696e746567726974792f646f776e6c6f616473)](https://packagist.org/packages/gggeek/ezdbintegrity)

[![Build Status](https://github.com/gggeek/ezdbintegrity/actions/workflows/ci.yml/badge.svg)](https://github.com/gggeek/ezdbintegrity/actions/workflows/ci.yml)[![Code Coverage](https://camo.githubusercontent.com/ceca10332412f5ed074c03f5bf52a46d25395a35485cd138675fadd6406b4c46/68747470733a2f2f636f6465636f762e696f2f67682f67676765656b2f657a6462696e746567726974792f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/gggeek/ezdbintegrity/tree/main)

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance8

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 93.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~82 days

Recently: every ~115 days

Total

41

Last Release

1155d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f641f7d6edabf83c56f6c4998b04e6c59a00b46bf51ca6699c31b09f9c948677?d=identicon)[gggeek](/maintainers/gggeek)

---

Top Contributors

[![gggeek](https://avatars.githubusercontent.com/u/308634?v=4)](https://github.com/gggeek "gggeek (101 commits)")[![blankse](https://avatars.githubusercontent.com/u/998558?v=4)](https://github.com/blankse "blankse (6 commits)")[![brunofax](https://avatars.githubusercontent.com/u/10075427?v=4)](https://github.com/brunofax "brunofax (1 commits)")

---

Tags

databaseezpublishreferential-integrity

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gggeek-ezdbintegrity/health.svg)

```
[![Health](https://phpackages.com/badges/gggeek-ezdbintegrity/health.svg)](https://phpackages.com/packages/gggeek-ezdbintegrity)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M542](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
