Repository navigation
Fix #15561 - Add a checkbox to empty protected BLOB and binary columns - #20529
Open
bhaskargurram-ai wants to merge 1 commit into
Open
bhaskargurram-ai wants to merge 1 commit into
bhaskargurram-ai wants to merge 1 commit into
Conversation
…ary columns When a BLOB or BINARY column is protected by $cfg['ProtectBinary'], the insert/edit form only shows "Binary - do not edit" and its size. A BLOB can be replaced by uploading a file, but there is no way to empty the column from the form. Add an "Empty" checkbox next to protected columns. When it is checked, the column is set to an empty value on UPDATE and INSERT (including "Insert as new row", where the original content is no longer copied). An uploaded file still takes precedence, and the Null checkbox still sets the column to NULL. Signed-off-by: Bhaskar Gurram <gurrambhaskar.ai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds a way to empty a BLOB or BINARY column from the insert/edit form when the column is protected by
$cfg['ProtectBinary'](the default protects BLOBs).At the moment a protected column only shows "Binary - do not edit" and its size. You can upload a new file into a BLOB, but you cannot empty it. I added an "Empty" checkbox next to the size:
UPDATE ... SET `col` = ''. For "Insert as new row" it inserts''instead of copying the original content, and it skips theSELECTthat would have fetched that content.NULL.I used a checkbox rather than a JS button so that it is sent with the form, works without JavaScript, and behaves like the existing Null checkbox. Rows added with "Continue insertion" pick it up without JS changes, because the cloning code already renames every
multi_editinput. The earlier attempt in #15562 only reset the file input in the browser, so the stored value never changed. This version sends afields_emptyflag thatReplaceControllerpasses toInsertEditthroughEditField.Tests: I added cases to
InsertEditTest(insert and update SQL, plus the rendered checkbox for eachProtectBinarymode) and an end-to-end case toReplaceControllerTestthat expects the exactUPDATEquery. The new tests fail without the change and pass with it, and the full unit suite passes. I also added a ChangeLog entry and a sentence to theProtectBinarydocs, and bumped the phpstan/psalm baseline counts for the new line inReplaceController, which follows the same pattern as the lines around it.Fixes #15561
Before submitting pull request, please review the following checklist:
Signed-off-byline as described in our DCO. This ensures that the work you're submitting is your own creation.