PLAT-25826: Prevent Duplicate Entry Export - #13960
Conversation
|
@github-copilot suggest |
|
@copilot resolve the merge conflicts in this pull request |
Resolved by merging the latest |
|
@github-copilot suggest |
🤖 AI PR Review🚦 Verdict: 🔴 CRITICALThe PR contains a merge-conflict resolution error that deletes a live error constant used by ShortLinkService, which will cause PHP fatal errors on short link operations, plus a type-mismatch bug in the DC filter that would silently make the duplicate-check logic ineffective. 📌 Context Summary & Code ArchaeologyObjective (PLAT-25826): Prevent duplicate Track classification: Track B — Surgical Fix. Files under Sibling search — Origin commit for 📋 Actionable FeedbackFinding 1 — BLOCKER Two constants —
throw new KalturaAPIException(KalturaErrors::INVALID_SHORT_LINK_DOMAIN, $id);After this PR merges, any request that hits the short-link domain validation path will throw a PHP fatal error ( Fix: Restore both deleted constants. The correct state after the merge should be: const INVALID_SHORT_LINK_DOMAIN = "INVALID_SHORT_LINK_DOMAIN;ID;Domain of short link [@ID@] is not allowed";
const INVALID_LINK_PREFIX = "INVALID_LINK_PREFIX;;The provided url must be https";
/*
* Export CSV service
*/
const ENTRY_EXPORT_CSV_IN_PROGRESS = "ENTRY_EXPORT_CSV_IN_PROGRESS;;An entry export job is already in progress. Please wait for it to complete before starting a new export.";Finding 2 — MAJOR
The correct call — consistent with all other DC assignments in this same file (lines 1566 and 1678) — is $c->add(BatchJobPeer::DC, kDataCenterMgr::getCurrentDcId());Finding 3 — MAJOR Even after correcting Finding 2, the DC filter introduces a scope problem. CSV export jobs are partner-scoped operations (the result is emailed to the user regardless of which DC processes it). Filtering by the current DC means that if a partner's first export job was submitted via DC 0 and the duplicate request arrives at DC 1, Furthermore, The duplicate check should be per-partner across all DCs. Remove the DC criterion: public static function hasActiveEntryExportJob($partnerId)
{
$c = new Criteria();
$c->add(BatchJobPeer::PARTNER_ID, $partnerId);
$c->add(BatchJobPeer::JOB_TYPE, BatchJobType::EXPORT_CSV);
$c->add(BatchJobPeer::JOB_SUB_TYPE, ExportObjectType::ENTRY);
$c->add(BatchJobPeer::STATUS, BatchJobPeer::getUnClosedStatusList(), Criteria::IN);
$existingJob = BatchJobPeer::doSelectOne($c);
// ...
} |
Pull Request Checklist
Please complete the following before submitting:
General notes -
New Kaltura Types
New Kaltura Services / Actions
Questions
What is the purpose of this PR?
Does this change affect production code or infrastructure?
If yes, what is the rollback plan?