jenkins-bot has submitted this change and it was merged.

Change subject: Change the status to "deleted" while deleting instead of 
removing record
......................................................................


Change the status to "deleted" while deleting instead of removing record

Avoid losing all history of a translation when it is deleted.
The draft content if any is still hard-deleted, as is the record in
translator table.

We do not allow translating once a translation is published. But there
are cases where a translation is published, and translator does some more
translation that is not published. This translation will be in draft
state and can be removed, causing data loss about translation.
This data is important for providing translation pairs, proper stats etc.

This need a table change as follows

ALTER TABLE cx_translations
MODIFY COLUMN translation_status
ENUM('draft','published', 'deleted');

Bug: T89442
Change-Id: Id100294ca2c7993708bb7ca94350b2e93297677b
---
M includes/Translation.php
M sql/contenttranslation.sql
2 files changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Amire80: Looks good to me, but someone else must approve
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Translation.php b/includes/Translation.php
index 9cf1ca1..ec471e0 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -64,8 +64,9 @@
 
        public static function delete( $translationId ) {
                $dbw = Database::getConnection( DB_MASTER );
-               $dbw->delete(
+               $dbw->update(
                        'cx_translations',
+                       array( 'translation_status' => 'deleted' ),
                        array( 'translation_id' => $translationId ),
                        __METHOD__
                );
diff --git a/sql/contenttranslation.sql b/sql/contenttranslation.sql
index 9e9bbb4..9afbdc8 100644
--- a/sql/contenttranslation.sql
+++ b/sql/contenttranslation.sql
@@ -24,7 +24,7 @@
     translation_target_url text binary not null,
     -- Status of translation - Draft or published status.
     -- There is no final status. A published translation can be draft again to 
update again
-    translation_status enum('draft', 'published') default null,
+    translation_status enum('draft', 'published', 'deleted') default null,
     -- Start date of this translation
     translation_start_timestamp varchar(14) binary not null,
     -- Last updated date of this translation

-- 
To view, visit https://gerrit.wikimedia.org/r/194046
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id100294ca2c7993708bb7ca94350b2e93297677b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: Springle <sprin...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to