isCssJsSubpage() ) { return null; } $revision = Revision::newFromTitle( $title ); if ( !$revision ) { return null; } return $revision->getRawText(); } /* Methods */ public function getScript( ResourceLoaderContext $context ) { $scripts = ''; foreach ( $this->getPages( $context ) as $page => $options ) { if ( $options['type'] !== 'script' ) { continue; } $script = $this->getContent( $page, $options['ns'] ); if ( $script ) { $ns = MWNamespace::getCanonicalName( $options['ns'] ); $scripts .= "/* $ns:$page */\n$script\n"; } } return $scripts; } public function getStyles( ResourceLoaderContext $context ) { $styles = array(); foreach ( $this->getPages( $context ) as $page => $options ) { if ( $options['type'] !== 'style' ) { continue; } $media = isset( $options['media'] ) ? $options['media'] : 'all'; $style = $this->getContent( $page, $options['ns'] ); if ( !$style ) { continue; } if ( $this->getFlip( $context ) ) { $style = CSSJanus::transform( $style, true, false ); } if ( !isset( $styles[$media] ) ) { $styles[$media] = ''; } $ns = MWNamespace::getCanonicalName( $options['ns'] ); $styles[$media] .= "/* $ns:$page */\n$style\n"; } return $styles; } public function getModifiedTime( ResourceLoaderContext $context ) { $hash = $context->getHash(); if ( isset( $this->modifiedTime[$hash] ) ) { return $this->modifiedTime[$hash]; } $titles = array(); foreach ( $this->getPages( $context ) as $page => $options ) { $titles[$options['ns']][$page] = true; } $modifiedTime = 1; // wfTimestamp() interprets 0 as "now" if ( $titles ) { $dbr = wfGetDB( DB_SLAVE ); $latest = $dbr->selectField( 'page', 'MAX(page_touched)', $dbr->makeWhereFrom2d( $titles, 'page_namespace', 'page_title' ), __METHOD__ ); if ( $latest ) { $modifiedTime = wfTimestamp( TS_UNIX, $latest ); } } return $this->modifiedTime[$hash] = $modifiedTime; } }