Page MenuHomePhorge

Add a Before-Destruction Engine
Needs ReviewPublic

Authored by valerio.bozzolan on Mon, May 19, 21:48.

Details

Summary

Allow extensions to run hooks *before* an object is destroyed.

This would easily allow to do things like:

  • before you actually destroy a profile picture, find its active usages and set the builtin profile image (T16074)
  • before you actually destroy something at midnight, allow extensions to throw violently and effectively impede destruction saying "please go to sleep first" in the exception message, visible from command line.

Closes T16079
Ref T16074

Test Plan

Try to destroy something (./bin/remove destroy). Absolutely no regressions.

Diff Detail

Repository
rP Phorge
Branch
arcpatch-D26026
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 2006
Build 2006: arc lint + arc unit

Event Timeline

mainframe98 added inline comments.
src/applications/system/engine/PhabricatorBeforeDestructionEngineExtension.php
37
45–46
valerio.bozzolan added inline comments.
src/applications/system/engine/PhabricatorBeforeDestructionEngineExtension.php
45–46

PHPStan-man @aklapper: is it self[] or array<self>? or same?

valerio.bozzolan marked an inline comment as not done.
  • fix typos
  • add PHPDoc @return
valerio.bozzolan added inline comments.
src/applications/system/engine/PhabricatorBeforeDestructionEngineExtension.php
45–46

I ask since I cannot find none of them in the code 🤔

grep -R -F -- 'array<self>' .
grep -R -F -- 'self[]' .
src/applications/system/engine/PhabricatorBeforeDestructionEngineExtension.php
45–46

@return list<PhabricatorDestructionEngineExtensions> or @return list<PhabricatorDestructionEngine> I'd guess (as Phorge loves to use non-standard types)

  • @return list<PhabricatorDestructionEngineExtension>
valerio.bozzolan marked 2 inline comments as done.
  • fix last typo