| @@ 1070-1083 (lines=14) @@ | ||
| 1067 | * Issue COMMIT only on master, only if queries were done on connection |
|
| 1068 | * @param string $fname Caller name |
|
| 1069 | */ |
|
| 1070 | public function commitMasterChanges( $fname = __METHOD__ ) { |
|
| 1071 | $masterIndex = $this->getWriterIndex(); |
|
| 1072 | foreach ( $this->mConns as $conns2 ) { |
|
| 1073 | if ( empty( $conns2[$masterIndex] ) ) { |
|
| 1074 | continue; |
|
| 1075 | } |
|
| 1076 | /** @var DatabaseBase $conn */ |
|
| 1077 | foreach ( $conns2[$masterIndex] as $conn ) { |
|
| 1078 | if ( $conn->trxLevel() && $conn->writesOrCallbacksPending() ) { |
|
| 1079 | $conn->commit( $fname, 'flush' ); |
|
| 1080 | } |
|
| 1081 | } |
|
| 1082 | } |
|
| 1083 | } |
|
| 1084 | ||
| 1085 | /** |
|
| 1086 | * Issue ROLLBACK only on master, only if queries were done on connection |
|
| @@ 1125-1138 (lines=14) @@ | ||
| 1122 | * |
|
| 1123 | * @since 1.28 |
|
| 1124 | */ |
|
| 1125 | public function runPreCommitCallbacks() { |
|
| 1126 | $masterIndex = $this->getWriterIndex(); |
|
| 1127 | foreach ( $this->mConns as $conns2 ) { |
|
| 1128 | if ( empty( $conns2[$masterIndex] ) ) { |
|
| 1129 | continue; |
|
| 1130 | } |
|
| 1131 | /** @var DatabaseBase $conn */ |
|
| 1132 | foreach ( $conns2[$masterIndex] as $conn ) { |
|
| 1133 | if ( $conn->trxLevel() && $conn->writesOrCallbacksPending() ) { |
|
| 1134 | $conn->runOnTransactionPreCommitCallbacks(); |
|
| 1135 | } |
|
| 1136 | } |
|
| 1137 | } |
|
| 1138 | } |
|
| 1139 | ||
| 1140 | /** |
|
| 1141 | * @return bool Whether a master connection is already open |
|