[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Avoid using cascadingDeletes()/cleanupTriggers()

2016-09-19 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Avoid using cascadingDeletes()/cleanupTriggers()
..


Avoid using cascadingDeletes()/cleanupTriggers()

Simplify DB callers by just having one code path.
All but some very old code paths bothered with these.

Change-Id: Iaf7a2f83146a0ed15995f9cfc74edcf16ae5a448
---
M includes/changes/RecentChange.php
M includes/deferred/LinksDeletionUpdate.php
M includes/page/WikiPage.php
M maintenance/rebuildrecentchanges.php
4 files changed, 78 insertions(+), 85 deletions(-)

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



diff --git a/includes/changes/RecentChange.php 
b/includes/changes/RecentChange.php
index 590fd37..306ea06 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -312,7 +312,7 @@
$this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 
'recentchanges_rc_id_seq' );
 
# # If we are using foreign keys, an entry of 0 for the page_id 
will fail, so use NULL
-   if ( $dbw->cascadingDeletes() && $this->mAttribs['rc_cur_id'] 
== 0 ) {
+   if ( $this->mAttribs['rc_cur_id'] == 0 ) {
unset( $this->mAttribs['rc_cur_id'] );
}
 
diff --git a/includes/deferred/LinksDeletionUpdate.php 
b/includes/deferred/LinksDeletionUpdate.php
index 4159166..93b3ef6 100644
--- a/includes/deferred/LinksDeletionUpdate.php
+++ b/includes/deferred/LinksDeletionUpdate.php
@@ -108,87 +108,81 @@
}
}
 
-   // If using cascading deletes, we can skip some explicit deletes
-   if ( !$dbw->cascadingDeletes() ) {
-   // Delete outgoing links
-   $this->batchDeleteByPK(
-   'pagelinks',
-   [ 'pl_from' => $id ],
-   [ 'pl_from', 'pl_namespace', 'pl_title' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'imagelinks',
-   [ 'il_from' => $id ],
-   [ 'il_from', 'il_to' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'categorylinks',
-   [ 'cl_from' => $id ],
-   [ 'cl_from', 'cl_to' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'templatelinks',
-   [ 'tl_from' => $id ],
-   [ 'tl_from', 'tl_namespace', 'tl_title' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'externallinks',
-   [ 'el_from' => $id ],
-   [ 'el_id' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'langlinks',
-   [ 'll_from' => $id ],
-   [ 'll_from', 'll_lang' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'iwlinks',
-   [ 'iwl_from' => $id ],
-   [ 'iwl_from', 'iwl_prefix', 'iwl_title' ],
-   $batchSize
-   );
-   // Delete any redirect entry or page props entries
-   $dbw->delete( 'redirect', [ 'rd_from' => $id ], 
__METHOD__ );
-   $dbw->delete( 'page_props', [ 'pp_page' => $id ], 
__METHOD__ );
-   }
+   $this->batchDeleteByPK(
+   'pagelinks',
+   [ 'pl_from' => $id ],
+   [ 'pl_from', 'pl_namespace', 'pl_title' ],
+   $batchSize
+   );
+   $this->batchDeleteByPK(
+   'imagelinks',
+   [ 'il_from' => $id ],
+   [ 'il_from', 'il_to' ],
+   $batchSize
+   );
+   $this->batchDeleteByPK(
+   'categorylinks',
+   [ 'cl_from' => $id ],
+   [ 'cl_from', 'cl_to' ],
+   $batchSize
+   );
+   $this->batchDeleteByPK(
+   'templatelinks',
+   [ 'tl_from' => $id ],
+   [ 'tl_from', 'tl_namespace', 'tl_title' 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Avoid using cascadingDeletes()/cleanupTriggers()

2016-09-15 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311090

Change subject: Avoid using cascadingDeletes()/cleanupTriggers()
..

Avoid using cascadingDeletes()/cleanupTriggers()

Simplify DB callers by just having one code path.
All but some very old code paths bothered with these.

Change-Id: Iaf7a2f83146a0ed15995f9cfc74edcf16ae5a448
---
M includes/changes/RecentChange.php
M includes/deferred/LinksDeletionUpdate.php
M includes/page/WikiPage.php
M maintenance/rebuildrecentchanges.php
4 files changed, 78 insertions(+), 85 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/90/311090/1

diff --git a/includes/changes/RecentChange.php 
b/includes/changes/RecentChange.php
index 590fd37..306ea06 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -312,7 +312,7 @@
$this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 
'recentchanges_rc_id_seq' );
 
# # If we are using foreign keys, an entry of 0 for the page_id 
will fail, so use NULL
-   if ( $dbw->cascadingDeletes() && $this->mAttribs['rc_cur_id'] 
== 0 ) {
+   if ( $this->mAttribs['rc_cur_id'] == 0 ) {
unset( $this->mAttribs['rc_cur_id'] );
}
 
diff --git a/includes/deferred/LinksDeletionUpdate.php 
b/includes/deferred/LinksDeletionUpdate.php
index 4159166..93b3ef6 100644
--- a/includes/deferred/LinksDeletionUpdate.php
+++ b/includes/deferred/LinksDeletionUpdate.php
@@ -108,87 +108,81 @@
}
}
 
-   // If using cascading deletes, we can skip some explicit deletes
-   if ( !$dbw->cascadingDeletes() ) {
-   // Delete outgoing links
-   $this->batchDeleteByPK(
-   'pagelinks',
-   [ 'pl_from' => $id ],
-   [ 'pl_from', 'pl_namespace', 'pl_title' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'imagelinks',
-   [ 'il_from' => $id ],
-   [ 'il_from', 'il_to' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'categorylinks',
-   [ 'cl_from' => $id ],
-   [ 'cl_from', 'cl_to' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'templatelinks',
-   [ 'tl_from' => $id ],
-   [ 'tl_from', 'tl_namespace', 'tl_title' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'externallinks',
-   [ 'el_from' => $id ],
-   [ 'el_id' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'langlinks',
-   [ 'll_from' => $id ],
-   [ 'll_from', 'll_lang' ],
-   $batchSize
-   );
-   $this->batchDeleteByPK(
-   'iwlinks',
-   [ 'iwl_from' => $id ],
-   [ 'iwl_from', 'iwl_prefix', 'iwl_title' ],
-   $batchSize
-   );
-   // Delete any redirect entry or page props entries
-   $dbw->delete( 'redirect', [ 'rd_from' => $id ], 
__METHOD__ );
-   $dbw->delete( 'page_props', [ 'pp_page' => $id ], 
__METHOD__ );
-   }
+   $this->batchDeleteByPK(
+   'pagelinks',
+   [ 'pl_from' => $id ],
+   [ 'pl_from', 'pl_namespace', 'pl_title' ],
+   $batchSize
+   );
+   $this->batchDeleteByPK(
+   'imagelinks',
+   [ 'il_from' => $id ],
+   [ 'il_from', 'il_to' ],
+   $batchSize
+   );
+   $this->batchDeleteByPK(
+   'categorylinks',
+   [ 'cl_from' => $id ],
+   [ 'cl_from', 'cl_to' ],
+   $batchSize
+   );
+   $this->batchDeleteByPK(
+   'templatelinks',
+   [ 'tl_from' => $id ],
+   [ 'tl_from', 'tl_namespace', 'tl_title' ],
+