You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
namespace Isekai\AIToolbox;
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
use Config;
|
|
|
|
class Hooks {
|
|
/**
|
|
* Implements LoadExtensionSchemaUpdates hook.
|
|
*
|
|
* @param \DatabaseUpdater $updater
|
|
*/
|
|
public static function onLoadExtensionSchemaUpdates($updater) {
|
|
$dir = dirname(__DIR__) . '/sql/';
|
|
$type = $updater->getDB()->getType();
|
|
$updater->addExtensionTable('aitoolbox_usage', $dir . $type . '/aitoolbox_usage.sql');
|
|
}
|
|
|
|
public static function onLoad(\OutputPage $outputPage) {
|
|
$user = $outputPage->getUser();
|
|
$permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
|
|
if ($user->isRegistered() && $permissionManager->userHasRight($user, 'chatcomplete')) {
|
|
$outputPage->addModules(["ext.isekai.ai-toolbox.launcher"]);
|
|
}
|
|
}
|
|
|
|
public static function onResourceLoaderGetConfigVars(array &$vars, string $skin, Config $config){
|
|
$vars['wgIsekaiAIToolboxFrontendUrl'] = $config->get('IsekaiAIToolboxFrontendUrl');
|
|
}
|
|
} |