Every calculated day adds a line in the asset history

未关闭 适合新手
#396 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
backend

调研方向

Issue 提到了 CarbonEmission 和 AbstractImpact,并指出二者都继承 CommonDBChild,但没有重写 $logs_for_parent。阅读这些类的定义,并检查父类如何处理此属性。完成的标准是:计算出的行不再向资产历史记录添加条目,同时计算继续保持不变。

由索引模型根据 Issue 内容生成。

描述

GLPI version: 11.0.11
Plugin version: 1.3.1 (same code in 1.4.0)

Bug description
CarbonEmission and AbstractImpact extend CommonDBChild without overriding $logs_for_parent. Each row they create writes "Add an item" in the history of the asset: one line per calculated day and per asset, plus one per embodied impact.
After a few months an asset has hundreds of these lines, and a catch-up run writes thousands at once. We had 1.17 million of them. They bury the real changes, and the history is what we read to know who changed what on an asset.

Relevant log output

94342612  08-11-2026 08:58  cron_UsageImpact  Emission de carbone  Ajout d'un élément : Emission de carbone (N/A (1061053))
93102748  07-11-2026 08:58  cron_UsageImpact  Emission de carbone  Ajout d'un élément : Emission de carbone (N/A (1060639))

Anything else?
We applied public static $logs_for_parent = false; on both classes locally. Calculations are unchanged and the history stays readable.

Laurent Tison, Afnic

主要语言
PHP
星标
5
派生
7
平均合并
2 小时 26 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pluginsGLPI/carbon 的其他 Issue

查看 pluginsGLPI/carbon 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。