承接 gggeek/ezdbintegrity 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gggeek/ezdbintegrity

Composer 安装命令:

composer require gggeek/ezdbintegrity

包简介

Allows checking integrity of data in the database

README 文档

README

For eZPlatform 3.0 and later, please check out: https://github.com/tanoconsulting/ezdbintegritybundle

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:

  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 => 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 => 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:

  • 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

!!! 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:

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

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 Latest Stable Version Total Downloads

Build Status Code Coverage

gggeek/ezdbintegrity 适用场景与选型建议

gggeek/ezdbintegrity 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.12k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2014 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 gggeek/ezdbintegrity 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 gggeek/ezdbintegrity 我们能提供哪些服务?
定制开发 / 二次开发

基于 gggeek/ezdbintegrity 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2014-03-08