Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,26 @@ jobs:
strategy:
matrix:
include:
- mw: 'REL1_39'
php: 8.0
type: coverage
experimental: false
- mw: 'REL1_39'
php: 8.1
type: normal
experimental: false
- mw: 'REL1_40'
php: 8.1
type: normal
experimental: false
- mw: 'REL1_41'
- mw: 'REL1_43'
php: 8.1
type: normal
experimental: false
- mw: 'REL1_42'
- mw: 'REL1_44'
php: 8.2
type: normal
experimental: false
- mw: 'REL1_43'
- mw: 'REL1_45'
php: 8.3
type: normal
experimental: true
experimental: false
- mw: 'master'
php: 8.4
type: normal
experimental: true
- mw: 'master'
php: 8.5
type: normal
experimental: true

runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
Expand Down
5 changes: 3 additions & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ tools:
php_loc: true
php_analyzer: true
sensiolabs_security_checker: true
external_code_coverage:
timeout: '1200' # timeout in seconds
# TODO: Scrutinizer Ocular coverage disabled due to https://github.com/scrutinizer-ci/ocular/issues/51
# external_code_coverage:
# timeout: '1200' # timeout in seconds

checks:
php:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ configuration it can add a new [gallery][Gallery] mode, and replace normal
[image rendering][Image] with an image modal.

## Requirements
* PHP 8.0 or later
* MediaWiki 1.39 or later
* PHP 8.1 or later
* MediaWiki 1.43 or later

## Documentation
- [Installation and configuration](docs/installation-configuration.md)
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
"source": "https://github.com/oetterer/BootstrapComponents"
},
"require": {
"php": ">=8.0",
"php": ">=8.1",
"composer/installers": "^2|^1.0.1",
"mediawiki/bootstrap": "^5.0"
},
"require-dev": {
"mediawiki/mediawiki-codesniffer": "46.0.0",
"mediawiki/mediawiki-phan-config": "0.15.1",
"mediawiki/mediawiki-phan-config": "0.15.1",
"phpmd/phpmd": "~2.1",
"php": ">=8.0"
"php": ">=8.1"
},
"suggest": {
"mediawiki/scribunto": "Framework for embedding scripting languages into MediaWiki pages"
Expand Down
8 changes: 8 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## Release Notes

### BootstrapComponents 6.0.0

Released on TBD

Breaking changes:
* requires MediaWiki 1.43 or later
* requires PHP 8.1 or later

### BootstrapComponents 5.2.3

Released on 21-May-2026
Expand Down
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license-name": "GPL-3.0-or-later",
"type": "parserhook",
"requires": {
"MediaWiki": ">= 1.39.0"
"MediaWiki": ">= 1.43.0"
},
"ConfigRegistry": {
"BootstrapComponents": "GlobalVarConfig::newInstance"
Expand Down
8 changes: 4 additions & 4 deletions src/AbstractComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace MediaWiki\Extension\BootstrapComponents;

use MediaWiki\MediaWikiServices;
use \MWException;
use RuntimeException;

/**
* Class AbstractComponent
Expand Down Expand Up @@ -107,7 +107,7 @@ abstract protected function placeMe( $input );
* @param ParserOutputHelper $parserOutputHelper
* @param NestingController $nestingController
*
* @throws MWException cascading {@see ComponentLibrary::getNameFor} or {@see Component::extractAttribute}
* @throws RuntimeException cascading {@see ComponentLibrary::getNameFor} or {@see Component::extractAttribute}
*/
public function __construct( $componentLibrary, $parserOutputHelper, $nestingController ) {
$this->componentLibrary = $componentLibrary;
Expand Down Expand Up @@ -144,14 +144,14 @@ public function getId() {
/**
* @param ParserRequest $parserRequest ;
*
* @throws MWException self or cascading from {@see Component::processArguments}
* @throws RuntimeException self or cascading from {@see Component::processArguments}
* or {@see NestingController::close}
*
* @return string|array
*/
public function parseComponent( $parserRequest ) {
if ( !is_a( $parserRequest, ParserRequest::class ) ) {
throw new MWException( 'Invalid ParserRequest supplied to component ' . $this->getComponentName() . '!' );
throw new RuntimeException( 'Invalid ParserRequest supplied to component ' . $this->getComponentName() . '!' );
}
$this->getNestingController()->open( $this );
MediaWikiServices::getInstance()
Expand Down
29 changes: 13 additions & 16 deletions src/ApplicationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
use MWException;
use RuntimeException;
use ReflectionClass;

/**
Expand Down Expand Up @@ -104,19 +104,16 @@ public function getNewAttributeManager( array $validAttributes, array $aliases )
}

/**
* @param string $id
* @param string $trigger must be safe raw html (best run through {@see Parser::recursiveTagParse})
* @param string $content must be safe raw html (best run through {@see Parser::recursiveTagParse})
* @param ParserOutputHelper $parserOutputHelper @deprecated unused since the inline-emission modal fix; will be removed in the next major release.
* @param string $id
* @param string $trigger must be safe raw html (best run through {@see Parser::recursiveTagParse})
* @param string $content must be safe raw html (best run through {@see Parser::recursiveTagParse})
*
* @see ModalBuilder::__construct
*
* @return ModalBuilder
*/
public function getNewModalBuilder(
string $id, string $trigger, string $content, ParserOutputHelper $parserOutputHelper
): ModalBuilder {
return new ModalBuilder( $id, $trigger, $content, $parserOutputHelper );
public function getNewModalBuilder( string $id, string $trigger, string $content ): ModalBuilder {
return new ModalBuilder( $id, $trigger, $content );
}

/**
Expand All @@ -126,7 +123,7 @@ public function getNewModalBuilder(
*
* @see ParserRequest::__construct
*
* @throws \MWException cascading {@see ParserRequest::__construct}
* @throws RuntimeException cascading {@see ParserRequest::__construct}
*
* @return ParserRequest
*/
Expand All @@ -141,7 +138,7 @@ public function getNewParserRequest(
*
* @see ParserOutputHelper
*
* @throws MWException cascading {@see ApplicationFactory::getApplication}
* @throws RuntimeException cascading {@see ApplicationFactory::getApplication}
*
* @return ParserOutputHelper
*/
Expand All @@ -158,7 +155,7 @@ public function getParserOutputHelper( $parser = null ) {
* @param string $name
* @param string $class
*
* @throws MWException when class to register does not exist
* @throws RuntimeException when class to register does not exist
*
* @return bool
*/
Expand All @@ -169,7 +166,7 @@ public function registerApplication( string $name, string $class ): bool {
$this->applicationClassRegister[$application] = $applicationClass;
return true;
} elseif ( $application != '' ) {
throw new MWException( 'ApplicationFactory was requested to register non existing class "' . $applicationClass . '"!' );
throw new RuntimeException( 'ApplicationFactory was requested to register non existing class "' . $applicationClass . '"!' );
}
$this->getLogger()->error( 'ApplicationFactory was requested to register invalid application for class ' . $applicationClass . '!' );
return false;
Expand Down Expand Up @@ -200,7 +197,7 @@ public function resetLookup( ?string $application = null ): bool {
*
* @param string $name
*
* @throws MWException when no class is registered for the requested application or the creation of the object fails.
* @throws RuntimeException when no class is registered for the requested application or the creation of the object fails.
*
* @return object
*/
Expand All @@ -209,15 +206,15 @@ protected function getApplication( $name ): object {
return $this->applicationStore[$name];
}
if ( !isset( $this->applicationClassRegister[$name] ) ) {
throw new MWException( 'ApplicationFactory was requested to return application "' . $name . '". No appropriate class registered!' );
throw new RuntimeException( 'ApplicationFactory was requested to return application "' . $name . '". No appropriate class registered!' );
}
$args = func_get_args();
array_shift( $args ); # because, we already used the first argument $name

try {
$objectReflection = new ReflectionClass( $this->applicationClassRegister[$name] );
} catch ( \ReflectionException $e ) {
throw new MWException(
throw new RuntimeException(
'Error while trying to build application "' . $name . '" with class ' . $this->applicationClassRegister[$name]
);
}
Expand Down
14 changes: 2 additions & 12 deletions src/BootstrapComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@

namespace MediaWiki\Extension\BootstrapComponents;

use ConfigException;
use Exception;
use MWException;
use RuntimeException;

/**
* Provides methods to register, when installed by composer
Expand All @@ -56,9 +55,6 @@
*/
class BootstrapComponents {

const EXTENSION_DATA_NO_IMAGE_MODAL = 'bsc_no_image_modal';


/**
* @var string $version
*/
Expand All @@ -84,13 +80,7 @@ public static function init( array $info ) {

if ( !defined( 'MEDIAWIKI' ) ) {
echo 'This file is part of the Mediawiki extension BootstrapComponents, it is not a valid entry point.' . PHP_EOL;
throw new MWException( 'This file is part of a Mediawiki Extension, it is not a valid entry point.' );
}

if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.39', 'lt' ) ) {
echo '<b>Error:</b> <a href="https://github.com/oetterer/BootstrapComponents/">Bootstrap Components</a> '
. 'is only compatible with MediaWiki 1.39 or above. You need to upgrade MediaWiki first.' . PHP_EOL;
throw new MWException( 'BootstrapComponents detected an incompatible MediaWiki version. Exiting.' );
throw new RuntimeException( 'This file is part of a Mediawiki Extension, it is not a valid entry point.' );
}

// Using the constant as indicator to avoid class_exists
Expand Down
4 changes: 2 additions & 2 deletions src/BootstrapComponentsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace MediaWiki\Extension\BootstrapComponents;

use Config;
use RequestContext;
use MediaWiki\Config\Config;
use MediaWiki\Context\RequestContext;

class BootstrapComponentsService
{
Expand Down
8 changes: 4 additions & 4 deletions src/CarouselGallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@

namespace MediaWiki\Extension\BootstrapComponents;

use MediaWiki\Extension\BootstrapComponents\Components\Carousel;
use ImageGalleryBase;
use MediaWiki\Extension\BootstrapComponents\Components\Carousel;
use MediaWiki\MediaWikiServices;
use Title;
use MediaWiki\Title\Title;

/**
* Class CarouselGallery
Expand All @@ -43,7 +43,7 @@ class CarouselGallery extends ImageGalleryBase {
*
* @param ParserOutputHelper $parserOutputHelper used for unit tests
*
* @throws \MWException cascading {@see CarouselGallery::constructCarouselParserRequest} and {@see AbstractComponent::parseComponent}
* @throws RuntimeException cascading {@see CarouselGallery::constructCarouselParserRequest} and {@see AbstractComponent::parseComponent}
* @return string
*/
public function toHTML( $parserOutputHelper = null ) {
Expand Down Expand Up @@ -160,7 +160,7 @@ private function convertImages( $imageList, $parser = null, $hideBadImages = tru
* From array of supplies images and some other object properties, this constructs a parser request object,
* to be used in the carousel component.
*
* @throws \MWException cascading {@see ApplicationFactory::getNewParserRequest}
* @throws RuntimeException cascading {@see ApplicationFactory::getNewParserRequest}
*
* @return false|ParserRequest returns false, if no valid images were detected
*/
Expand Down
Loading
Loading