Skip to content

Commit

Permalink
Use QueryResult::getCountValue where available
Browse files Browse the repository at this point in the history
  • Loading branch information
mwjames committed Sep 26, 2015
1 parent 727e8d6 commit 5a3d0fc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Maintenance/GlossaryCacheRebuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ private function buildQuery() {
$countQuery = new Query( $description, false, false );
$countQuery->querymode = Query::MODE_COUNT;

$numberOfPages = (int)$this->store->getQueryResult( $countQuery );
$queryResult = $this->store->getQueryResult( $countQuery );
$numberOfPages = $queryResult instanceof \SMWQueryResult ? $queryResult->getCountValue() : $queryResult;

$resultQuery = new Query( $description, false, false );

// FIXME SMWQuery setLimit
// @see SMW\Store\Maintenance\DataRebuilder
// FIXME use Query::setUnboundLimit, SMW 2.0
$beforeMaxLimitManipulation = $GLOBALS['smwgQMaxLimit'];
$GLOBALS['smwgQMaxLimit'] = $numberOfPages;
$resultQuery->setLimit( $numberOfPages, false );
Expand Down
7 changes: 4 additions & 3 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
die( 'Not an entry point' );
}

if ( is_readable( $autoloaderClassPath = __DIR__ . '/../../SemanticMediaWiki/tests/autoloader.php' ) ) {
print( "\nSemanticMediaWiki " . SMW_VERSION . " ({$GLOBALS['wgDBtype']}) test autoloader ...\n" );
} else {
if ( !is_readable( $autoloaderClassPath = __DIR__ . '/../../SemanticMediaWiki/tests/autoloader.php' ) ) {
die( 'The SemanticMediaWiki test autoloader is not available' );
}

Expand All @@ -18,3 +16,6 @@
$autoloader->addClassMap( array(
'SG\Maintenance\RebuildGlossaryCache' => __DIR__ . '/../maintenance/rebuildGlossaryCache.php',
) );

print( "Semantic MediaWiki: " . SMW_VERSION . " ({$GLOBALS['smwgDefaultStore']}, {$GLOBALS['wgDBtype']})\n" );
print( "Semantic Glossary: " . SG_VERSION . "\n\n" );
5 changes: 3 additions & 2 deletions tests/travis/install-mediawiki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ mv mediawiki-* mw
cd mw

## MW 1.25 requires Psr\Logger
if [ "$MW" == "master" ]
if [ -f composer.json ]
then
composer install
composer self-update
composer install --prefer-source
fi

if [ "$DB" == "postgres" ]
Expand Down

0 comments on commit 5a3d0fc

Please sign in to comment.