Page MenuHomePhorge

File editor extension: updating PhabricatorFile content
Closed, ResolvedPublic

Asked by mturdus on Jun 25 2023, 07:02.
Tags
None
Referenced Files
F314203: image.png
Jun 25 2023, 07:02
Tokens
"Love" token, awarded by valerio.bozzolan.

Details

I'm working on an extension which integrates draw.io into Phorge.
So far, I'm able to create diagrams and reload them:

image.png (832×1 px, 108 KB)

However, when I click on the save button I call the PhabricatorFile::newFromFileData method.
This will always create a new file object with a new ID.
If I have for example a reference to this diagram in a wiki page (e.g. {F70}), and I modify the diagram, the wiki page will still show the old version.

Is it possible to update the content of a file object without changing it's ID?

I found some LiskDAO references to IDS_AUTOINCREMENT and IDS_MANUAL, which seem to determine how the ID should be stored.
But I don't quite understand it how to use these.

Answers

avivey
Updated 291 Days Ago

Is it possible to update the content of a file object without changing it's ID?

No. File contents are immutable.

A good path for this would be to create a Diagram object type, that has a field for a file. It's possible to create a "monogram" for the diagram, so that a reference like {DIAG32} will work in all Remarkup context, but I don't remember the details right now.

Anyway, the Diagrams app looks cool!

This answer has been hidden.

mturdus
Updated 284 Days Ago

Thanks a lot.
I got it working.
I will work on it further this week.

New Answer

Answer

This question has been marked as closed, but you can still leave a new answer.