Code Duplication    Length = 13-15 lines in 2 locations

includes/libs/lockmanager/PostgreSqlLockManager.php 1 location

@@ 66-78 (lines=13) @@
63
	 * @see QuorumLockManager::releaseAllLocks()
64
	 * @return StatusValue
65
	 */
66
	protected function releaseAllLocks() {
67
		$status = StatusValue::newGood();
68
69
		foreach ( $this->conns as $lockDb => $db ) {
70
			try {
71
				$db->query( "SELECT pg_advisory_unlock_all()", __METHOD__ );
72
			} catch ( DBError $e ) {
73
				$status->fatal( 'lockmanager-fail-db-release', $lockDb );
74
			}
75
		}
76
77
		return $status;
78
	}
79
}
80

includes/filebackend/lockmanager/MySqlLockManager.php 1 location

@@ 122-136 (lines=15) @@
119
	 * @see QuorumLockManager::releaseAllLocks()
120
	 * @return StatusValue
121
	 */
122
	protected function releaseAllLocks() {
123
		$status = StatusValue::newGood();
124
125
		foreach ( $this->conns as $lockDb => $db ) {
126
			if ( $db->trxLevel() ) { // in transaction
127
				try {
128
					$db->rollback( __METHOD__ ); // finish transaction and kill any rows
129
				} catch ( DBError $e ) {
130
					$status->fatal( 'lockmanager-fail-db-release', $lockDb );
131
				}
132
			}
133
		}
134
135
		return $status;
136
	}
137
}
138