// with an old master hostname. Such calls make MASTER_POS_WAIT() return null. Try
// to detect this and treat the replica DB as having reached the position; a proper master
// switchover already requires that the new master be caught up before the switch.
- $replicationPos = $this->getSlavePos();
+ $replicationPos = $this->getReplicaPos();
if ( $replicationPos && !$replicationPos->channelsMatch( $pos ) ) {
$this->lastKnownReplicaPos = $replicationPos;
$status = 0;
*
* @return MySQLMasterPos|bool
*/
- function getSlavePos() {
+ function getReplicaPos() {
$res = $this->query( 'SHOW SLAVE STATUS', __METHOD__ );
$row = $this->fetchObject( $res );
* @since 1.22
*/
public function listViews( $prefix = null, $fname = __METHOD__ ) {
+ // The name of the column containing the name of the VIEW
+ $propertyName = 'Tables_in_' . $this->mDBname;
- if ( !isset( $this->allViews ) ) {
-
- // The name of the column containing the name of the VIEW
- $propertyName = 'Tables_in_' . $this->mDBname;
-
- // Query for the VIEWS
- $result = $this->query( 'SHOW FULL TABLES WHERE TABLE_TYPE = "VIEW"' );
- $this->allViews = [];
- while ( ( $row = $this->fetchRow( $result ) ) !== false ) {
- array_push( $this->allViews, $row[$propertyName] );
- }
+ // Query for the VIEWS
+ $res = $this->query( 'SHOW FULL TABLES WHERE TABLE_TYPE = "VIEW"' );
+ $allViews = [];
+ foreach ( $res as $row ) {
+ array_push( $allViews, $row->$propertyName );
}
if ( is_null( $prefix ) || $prefix === '' ) {
- return $this->allViews;
+ return $allViews;
}
$filteredViews = [];
- foreach ( $this->allViews as $viewName ) {
+ foreach ( $allViews as $viewName ) {
// Does the name of this VIEW start with the table-prefix?
if ( strpos( $viewName, $prefix ) === 0 ) {
array_push( $filteredViews, $viewName );