Skip to content

Add bulk entry restoration feature to admin console - #13830

Open
shahbaa123 wants to merge 1 commit into
Venus-22.14.0from
Venus-22.14.0-SUP-51155-clean
Open

Add bulk entry restoration feature to admin console#13830
shahbaa123 wants to merge 1 commit into
Venus-22.14.0from
Venus-22.14.0-SUP-51155-clean

Conversation

@shahbaa123

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a new bulk entry restoration tool to the admin console that allows restoring multiple deleted entries at once with validation (dry run) support.

Key Features

  • ✅ Bulk restore multiple entries via file upload, comma-separated, or line-separated input
  • ✅ Dry run mode for validation before actual restoration
  • ✅ Detailed per-entry results showing which entries can be restored and why others cannot
  • ✅ File upload support for large batches (up to 5MB, .txt/.csv files)
  • ✅ Entry ID validation with pattern matching
  • ✅ Partner ID validation to ensure entries belong to the specified partner
  • ✅ Seamless workflow: dry run → review results → proceed with real restoration

Backend Changes

  • New API action: adminconsole_entryadmin.bulkRestoreDeletedEntries
  • Code refactoring: Eliminated ~120 lines of duplicate code between single and bulk restoration by extracting shared helper methods:
    • retrieveEntryFileSyncsAndAssets() - Gets file syncs, assets, and metadata
    • restoreAssets() - Restores asset status
    • restoreEntryStatus() - Restores entry status and recycle bin fields
  • New API types:
    • KalturaBulkRestoreEntryData (input)
    • KalturaEntryRestoreResult (per-entry result)
    • KalturaEntryRestoreResultArray (array of results)
    • KalturaEntryRestoreResultListResponse (API response)

Frontend Changes

  • New admin console page at index/entry-restoration under Developer tab
  • JavaScript toggle for different input modes (textarea/single/file)
  • Results table with color-coded success/error indicators
  • Statistics summary (restorable vs. not restorable counts)

Permissions

  • Added permission configuration for bulkrestoredeletedentries action
  • Permission update script: 2026_03_04_update_adminconsole_entryadmin_bulk_restore_permissions.php
  • Requires RESTORE_DELETED_ENTRY permission

Restoration Process

Both single and bulk restoration now restore the following:

  • ✅ File syncs (with validation for DELETED/PURGED status)
  • ✅ Assets (set to READY status, clear deletedAt)
  • ✅ Category entries (set to ACTIVE status)
  • ✅ Metadata (restore latest version per metadata_profile_id)
  • ✅ Entry status (set to READY, restore thumbnail/data, restore displayInSearch from previousDisplayInSearchStatus, clear recycle bin fields)

Known Limitations

⚠️ Kuser-Entry Relationships: Neither the existing single entry restoration nor the new bulk restoration currently restore kuser-entry relationships. This is consistent with the existing restoration behavior and may need to be addressed in a future enhancement for both restoration methods.

Testing

  • ✅ Tested dry run mode with validation
  • ✅ Tested actual restoration of multiple entries
  • ✅ Tested file upload functionality
  • ✅ Tested validation (invalid partner ID, entry not found, entry not deleted, wrong asset status)
  • ✅ Tested refactored code - both single and bulk restoration work correctly
  • ✅ Verified permission system works correctly

Files Changed

  • admin_console/configs/navigation.xml - Added menu item
  • admin_console/controllers/IndexController.php - Added entryRestorationAction
  • admin_console/views/scripts/index/entry-restoration.phtml - New UI template (178 lines)
  • configurations/admin.template.ini - Added ACL configuration
  • deployment/permissions/service.adminconsole.entryadmin.ini - Added action permission
  • deployment/updates/scripts/add_permissions/2026_03_04_update_adminconsole_entryadmin_bulk_restore_permissions.php - Permission update script
  • plugins/admin_console/lib/api/ - 4 new API type classes
  • plugins/admin_console/services/EntryAdminService.php - Added bulk restoration action and refactored shared code

Stats: 11 files changed, 685 insertions(+), 59 deletions(-)

🤖 Generated with Claude Code

This adds a new bulk entry restoration tool to the admin console that allows
restoring multiple deleted entries at once with validation (dry run) support.

Key features:
- Bulk restore multiple entries via file upload, comma-separated, or line-separated input
- Dry run mode for validation before actual restoration
- Detailed per-entry results showing which entries can be restored
- File upload support for large batches (up to 5MB, .txt/.csv files)
- Entry ID validation with pattern matching
- Partner ID validation to ensure entries belong to the specified partner

Backend changes:
- New API action: adminconsole_entryadmin.bulkRestoreDeletedEntries
- Refactored restoration code to eliminate duplication between single and bulk restoration
- Added 3 helper methods shared by both restoration flows:
  - retrieveEntryFileSyncsAndAssets() - Gets file syncs, assets, and metadata
  - restoreAssets() - Restores asset status
  - restoreEntryStatus() - Restores entry status and recycle bin fields
- New API types: KalturaBulkRestoreEntryData, KalturaEntryRestoreResult, KalturaEntryRestoreResultArray, KalturaEntryRestoreResultListResponse

Frontend changes:
- New admin console page at index/entry-restoration
- JavaScript toggle for different input modes
- Results table with success/error indicators
- Seamless workflow: dry run → review results → proceed with real restoration

Permissions:
- Added permission configuration for bulkrestoredeletedentries action
- Permission update script: 2026_03_04_update_adminconsole_entryadmin_bulk_restore_permissions.php
- Requires RESTORE_DELETED_ENTRY permission

Known limitations:
- Neither single nor bulk restoration currently restore kuser-entry relationships
- This is consistent with existing restoration behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown

@github-copilot suggest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant