You've already forked wc-licensed-product
Prepare v0.1.0 release - code review and documentation updates
- Conducted comprehensive security and best practices review - Fixed VersionManager null format handling for attachment updates - Improved input sanitization in AdminController for page context checks - Updated README.md with complete feature documentation - Updated CHANGELOG.md with 0.1.0 release notes - Updated translations (.pot, .po, .mo files) to version 0.1.0 - Bumped version to 0.1.0 in plugin header and constant Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -167,8 +167,20 @@ class VersionManager
|
||||
}
|
||||
|
||||
if ($attachmentId !== null) {
|
||||
$data['attachment_id'] = $attachmentId > 0 ? $attachmentId : null;
|
||||
$formats[] = $attachmentId > 0 ? '%d' : null;
|
||||
if ($attachmentId > 0) {
|
||||
$data['attachment_id'] = $attachmentId;
|
||||
$formats[] = '%d';
|
||||
} else {
|
||||
// Set to NULL using raw SQL instead of adding to $data
|
||||
global $wpdb;
|
||||
$tableName = Installer::getVersionsTable();
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"UPDATE {$tableName} SET attachment_id = NULL WHERE id = %d",
|
||||
$versionId
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data)) {
|
||||
|
||||
Reference in New Issue
Block a user