From 5a3d0fcc2d74298c42f3aff21bb54539a8c7f0e9 Mon Sep 17 00:00:00 2001 From: mwjames Date: Sat, 26 Sep 2015 19:25:38 +0200 Subject: [PATCH] Use QueryResult::getCountValue where available --- src/Maintenance/GlossaryCacheRebuilder.php | 6 +++--- tests/bootstrap.php | 7 ++++--- tests/travis/install-mediawiki.sh | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Maintenance/GlossaryCacheRebuilder.php b/src/Maintenance/GlossaryCacheRebuilder.php index a3ab968..030dff5 100644 --- a/src/Maintenance/GlossaryCacheRebuilder.php +++ b/src/Maintenance/GlossaryCacheRebuilder.php @@ -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 ); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 17a9a1d..98cfbfc 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -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' ); } @@ -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" ); \ No newline at end of file diff --git a/tests/travis/install-mediawiki.sh b/tests/travis/install-mediawiki.sh index e212b58..b0ac03f 100644 --- a/tests/travis/install-mediawiki.sh +++ b/tests/travis/install-mediawiki.sh @@ -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" ]