*
* @param ResourceLoaderContext $context
* @return array List of CSS strings or array of CSS strings keyed by media type.
- * like array( 'screen' => '.foo { width: 0 }' );
- * or array( 'screen' => array( '.foo { width: 0 }' ) );
+ * like [ 'screen' => '.foo { width: 0 }' ];
+ * or [ 'screen' => [ '.foo { width: 0 }' ] ];
*/
public function getStyles( ResourceLoaderContext $context ) {
// Stub, override expected
* load the files directly. See also getScriptURLsForDebug()
*
* @param ResourceLoaderContext $context
- * @return array Array( mediaType => array( URL1, URL2, ... ), ... )
+ * @return array [ mediaType => [ URL1, URL2, ... ], ... ]
*/
public function getStyleURLsForDebug( ResourceLoaderContext $context ) {
$resourceLoader = $context->getResourceLoader();
// Try in-object cache first
if ( !isset( $this->fileDeps[$vary] ) ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$deps = $dbr->selectField( 'module_deps',
'md_deps',
[
]
);
- $dbw->onTransactionResolution( function () use ( &$scopeLock ) {
- ScopedCallback::consume( $scopeLock ); // release after commit
- } );
+ if ( $dbw->trxLevel() ) {
+ $dbw->onTransactionResolution( function () use ( &$scopeLock ) {
+ ScopedCallback::consume( $scopeLock ); // release after commit
+ } );
+ }
}
} catch ( Exception $e ) {
wfDebugLog( 'resourceloader', __METHOD__ . ": failed to update DB: $e" );
// Styles
if ( $context->shouldIncludeStyles() ) {
$styles = [];
- // Don't create empty stylesheets like array( '' => '' ) for modules
+ // Don't create empty stylesheets like [ '' => '' ] for modules
// that don't *have* any stylesheets (bug 38024).
$stylePairs = $this->getStyles( $context );
if ( count( $stylePairs ) ) {
*
* @code
* $summary = parent::getDefinitionSummary( $context );
- * $summary[] = array(
+ * $summary[] = [
* 'foo' => 123,
* 'bar' => 'quux',
- * );
+ * ];
* return $summary;
* @endcode
*