$res = $this->doQuery( $sql );
$status = false;
- if ( $res && $row = $this->fetchRow( $res ) ) {
- $status = $row[0]; // can be NULL, -1, or 0+ per the MySQL manual
- if ( ctype_digit( $status ) ) { // success
- $this->lastKnownSlavePos = $pos;
+ if ( $res ) {
+ $row = $this->fetchRow( $res );
+ if ( $row ) {
+ $status = $row[0]; // can be NULL, -1, or 0+ per the MySQL manual
+ if ( ctype_digit( $status ) ) { // success
+ $this->lastKnownSlavePos = $pos;
+ }
}
}
MediaWiki\suppressWarnings();
- if ( ( $this->mLastResult = $stmt = oci_parse( $this->mConn, $sql ) ) === false ) {
+ $this->mLastResult = $stmt = oci_parse( $this->mConn, $sql );
+ if ( $stmt === false ) {
$e = oci_error( $this->mConn );
$this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
}
$sql .= ')';
- if ( ( $this->mLastResult = $stmt = oci_parse( $this->mConn, $sql ) ) === false ) {
+ $this->mLastResult = $stmt = oci_parse( $this->mConn, $sql );
+ if ( $stmt === false ) {
$e = oci_error( $this->mConn );
$this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
}
} else {
/** @var OCI_Lob[] $lob */
- if ( ( $lob[$col] = oci_new_descriptor( $this->mConn, OCI_D_LOB ) ) === false ) {
+ $lob[$col] = oci_new_descriptor( $this->mConn, OCI_D_LOB );
+ if ( $lob[$col] === false ) {
$e = oci_error( $stmt );
throw new DBUnexpectedError( $this, "Cannot create LOB descriptor: " . $e['message'] );
}
$srcTable = $this->tableName( $srcTable );
}
- if ( ( $sequenceData = $this->getSequenceData( $destTable ) ) !== false &&
+ $sequenceData = $this->getSequenceData( $destTable );
+ if ( $sequenceData !== false &&
!isset( $varMap[$sequenceData['column']] )
) {
$varMap[$sequenceData['column']] = 'GET_SEQUENCE_VALUE(\'' . $sequenceData['sequence'] . '\')';
'SELECT version FROM product_component_version ' .
'WHERE UPPER(product) LIKE \'ORACLE DATABASE%\''
);
- if ( !( $row = $rset->fetchRow() ) ) {
+ $row = $rset->fetchRow();
+ if ( !$row ) {
return oci_server_version( $this->mConn );
}
$sql .= ' WHERE ' . $this->makeList( $conds, LIST_AND );
}
- if ( ( $this->mLastResult = $stmt = oci_parse( $this->mConn, $sql ) ) === false ) {
+ $this->mLastResult = $stmt = oci_parse( $this->mConn, $sql );
+ if ( $stmt === false ) {
$e = oci_error( $this->mConn );
$this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
}
} else {
/** @var OCI_Lob[] $lob */
- if ( ( $lob[$col] = oci_new_descriptor( $this->mConn, OCI_D_LOB ) ) === false ) {
+ $lob[$col] = oci_new_descriptor( $this->mConn, OCI_D_LOB );
+ if ( $lob[$col] === false ) {
$e = oci_error( $stmt );
throw new DBUnexpectedError( $this, "Cannot create LOB descriptor: " . $e['message'] );
}
foreach ( $serverIndexes as $i ) {
if ( $i == 0 ) { # Master
$lagTimes[$i] = 0;
- } elseif ( false !== ( $conn = $this->parent->getAnyOpenConnection( $i ) ) ) {
+ continue;
+ }
+ $conn = $this->parent->getAnyOpenConnection( $i );
+ if ( $conn !== false ) {
$lagTimes[$i] = $conn->getLag();
- } elseif ( false !== ( $conn = $this->parent->openConnection( $i, $wiki ) ) ) {
+ continue;
+ }
+ $conn = $this->parent->openConnection( $i, $wiki );
+ if ( $conn !== false ) {
$lagTimes[$i] = $conn->getLag();
# Close the connection to avoid sleeper connections piling up.
# Note that the caller will pick one of these DBs and reconnect,
if ( !$this->repo
|| !isset( $params['physicalWidth'] )
|| !isset( $params['physicalHeight'] )
- || !( $bucket = $this->getThumbnailBucket( $params['physicalWidth'] ) )
- || $bucket == $params['physicalWidth'] ) {
+ ) {
+ return false;
+ }
+
+ $bucket = $this->getThumbnailBucket( $params['physicalWidth'] );
+
+ if ( !$bucket || $bucket == $params['physicalWidth'] ) {
return false;
}
htmlspecialchars( $nt->getText() )
) .
'</div>';
- } elseif ( !( $thumb = $img->transform( $transformOptions ) ) ) {
- # Error generating thumbnail.
- $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: '
- . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">'
- . htmlspecialchars( $img->getLastError() ) . '</div>';
} else {
- /** @var MediaTransformOutput $thumb */
- $vpad = $this->getVPad( $this->mHeights, $thumb->getHeight() );
-
- $imageParameters = array(
- 'desc-link' => true,
- 'desc-query' => $descQuery,
- 'alt' => $alt,
- 'custom-url-link' => $link
- );
-
- // In the absence of both alt text and caption, fall back on
- // providing screen readers with the filename as alt text
- if ( $alt == '' && $text == '' ) {
- $imageParameters['alt'] = $nt->getText();
- }
-
- $this->adjustImageParameters( $thumb, $imageParameters );
-
- Linker::processResponsiveImages( $img, $thumb, $transformOptions );
-
- # Set both fixed width and min-height.
- $thumbhtml = "\n\t\t\t"
- . '<div class="thumb" style="width: '
- . $this->getThumbDivWidth( $thumb->getWidth() ) . 'px;">'
- # Auto-margin centering for block-level elements. Needed
- # now that we have video handlers since they may emit block-
- # level elements as opposed to simple <img> tags. ref
- # http://css-discuss.incutio.com/?page=CenteringBlockElement
- . '<div style="margin:' . $vpad . 'px auto;">'
- . $thumb->toHtml( $imageParameters ) . '</div></div>';
-
- // Call parser transform hook
- /** @var MediaHandler $handler */
- $handler = $img->getHandler();
- if ( $this->mParser && $handler ) {
- $handler->parserTransformHook( $this->mParser, $img );
+ $thumb = $img->transform( $transformOptions );
+ if ( !$thumb ) {
+ # Error generating thumbnail.
+ $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: '
+ . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">'
+ . htmlspecialchars( $img->getLastError() ) . '</div>';
+ } else {
+ /** @var MediaTransformOutput $thumb */
+ $vpad = $this->getVPad( $this->mHeights, $thumb->getHeight() );
+
+ $imageParameters = array(
+ 'desc-link' => true,
+ 'desc-query' => $descQuery,
+ 'alt' => $alt,
+ 'custom-url-link' => $link
+ );
+
+ // In the absence of both alt text and caption, fall back on
+ // providing screen readers with the filename as alt text
+ if ( $alt == '' && $text == '' ) {
+ $imageParameters['alt'] = $nt->getText();
+ }
+
+ $this->adjustImageParameters( $thumb, $imageParameters );
+
+ Linker::processResponsiveImages( $img, $thumb, $transformOptions );
+
+ # Set both fixed width and min-height.
+ $thumbhtml = "\n\t\t\t"
+ . '<div class="thumb" style="width: '
+ . $this->getThumbDivWidth( $thumb->getWidth() ) . 'px;">'
+ # Auto-margin centering for block-level elements. Needed
+ # now that we have video handlers since they may emit block-
+ # level elements as opposed to simple <img> tags. ref
+ # http://css-discuss.incutio.com/?page=CenteringBlockElement
+ . '<div style="margin:' . $vpad . 'px auto;">'
+ . $thumb->toHtml( $imageParameters ) . '</div></div>';
+
+ // Call parser transform hook
+ /** @var MediaHandler $handler */
+ $handler = $img->getHandler();
+ if ( $this->mParser && $handler ) {
+ $handler->parserTransformHook( $this->mParser, $img );
+ }
}
}
if ( !$res ) {
return null;
}
- if ( !( $r = $this->db->fetchRow( $res ) ) ) {
+ $r = $this->db->fetchRow( $res );
+ if ( !$r ) {
return null;
}
if ( !$r2 ) {
return null;
}
- if ( !( $row2 = $this->db->fetchRow( $r2 ) ) ) {
+ $row2 = $this->db->fetchRow( $r2 );
+ if ( !$row2 ) {
return null;
}
$colnames[] = $row2[0];
$this->db->addQuotes( $fkey )
)
);
- if ( !( $row = $this->db->fetchRow( $r ) ) ) {
+ $row = $this->db->fetchRow( $r );
+ if ( !$row ) {
return null;
}
$colours[$pdbk] = '';
} elseif ( $ns == NS_SPECIAL ) {
$colours[$pdbk] = 'new';
- } elseif ( ( $id = $linkCache->getGoodLinkID( $pdbk ) ) != 0 ) {
- $colours[$pdbk] = Linker::getLinkColour( $title, $threshold );
- $output->addLink( $title, $id );
- $linkcolour_ids[$id] = $pdbk;
- } elseif ( $linkCache->isBadLink( $pdbk ) ) {
- $colours[$pdbk] = 'new';
} else {
- # Not in the link cache, add it to the query
- $queries[$ns][] = $title->getDBkey();
+ $id = $linkCache->getGoodLinkID( $pdbk );
+ if ( $id != 0 ) {
+ $colours[$pdbk] = Linker::getLinkColour( $title, $threshold );
+ $output->addLink( $title, $id );
+ $linkcolour_ids[$id] = $pdbk;
+ } elseif ( $linkCache->isBadLink( $pdbk ) ) {
+ $colours[$pdbk] = 'new';
+ } else {
+ # Not in the link cache, add it to the query
+ $queries[$ns][] = $title->getDBkey();
+ }
}
}
}
$this->assertTrue( $re !== false, 'query failed' );
- if ( $row = $re->fetchRow() ) {
+ $row = $re->fetchRow();
+ if ( $row ) {
if ( $value instanceof Blob ) {
$value = $value->fetch();
}
$backend->delete( array( 'src' => $file ), array( 'force' => 1 ) );
}
foreach ( $files as $file ) {
- $tmp = $file;
- while ( $tmp = FileBackend::parentStoragePath( $tmp ) ) {
+ $tmp = FileBackend::parentStoragePath( $file );
+ while ( $tmp ) {
if ( !$backend->clean( array( 'dir' => $tmp ) )->isOK() ) {
break;
}
+ $tmp = FileBackend::parentStoragePath( $tmp );
}
}
}