Hi, I am looking for how to set up a developer environment for ManageWiki, but sadly, it depends on CreateWiki and I couldn't find the developer guide for neither.
Is there any guide for developer? I am using mwcli.
Hi, I am looking for how to set up a developer environment for ManageWiki, but sadly, it depends on CreateWiki and I couldn't find the developer guide for neither.
Is there any guide for developer? I am using mwcli.
My attempts until now:
The execution of install.php was successful, but I failed to run update.php:
[c9317277f222d48e00cec03c] [no req] Wikimedia\Rdbms\DBQueryError: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading or after adding a new extension? Please see https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Upgrading and https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:How_to_debug for more information. Error 1046: No database selected (mysql) Function: Wikimedia\Rdbms\Database::select Query: SELECT wiki_dbcluster,wiki_dbname,wiki_deleted,wiki_url,wiki_sitename FROM `cw_wikis` Backtrace: from /var/www/html/w/includes/libs/rdbms/database/Database.php(1809) … #6 /var/www/html/w/extensions/CreateWiki/includes/CreateWikiJson.php(73): Wikimedia\Rdbms\DBConnRef->select(string, array) #7 /var/www/html/w/extensions/CreateWiki/includes/CreateWikiJson.php(61): CreateWikiJson->generateDatabaseList() #8 /var/www/html/w/extensions/CreateWiki/includes/CreateWikiHooks.php(114): CreateWikiJson->update() #9 /var/www/html/w/includes/HookContainer/HookContainer.php(338): CreateWikiHooks::onSetupAfterCache() …
Then, I tried to use globals.php which is for the workflow of CI by append require_once "$IP/extensions/CreateWiki/.github/workflows/globals.php";
to LocalSettings.php, but it still failed:
… Error 1146: Table 'default.cw_wikis' doesn't exist (mysql) Function: Wikimedia\Rdbms\Database::select Query: SELECT wiki_dbcluster,wiki_dbname,wiki_deleted,wiki_url,wiki_sitename FROM `cw_wikis` … Backtrace: from /var/www/html/w/includes/libs/rdbms/database/Database.php(1809) #6 /var/www/html/w/extensions/CreateWiki/includes/CreateWikiJson.php(73): Wikimedia\Rdbms\DBConnRef->select(string, array) #7 /var/www/html/w/extensions/CreateWiki/includes/CreateWikiJson.php(61): CreateWikiJson->generateDatabaseList() #8 /var/www/html/w/extensions/CreateWiki/includes/CreateWikiHooks.php(114): CreateWikiJson->update() #9 /var/www/html/w/includes/HookContainer/HookContainer.php(338): CreateWikiHooks::onSetupAfterCache() …
I tried combining removing SetupAfterCacheHook with changing MW_DB
for mwcli to wikidb
. But the run of the update script was failed: (Reference: Cli/ref/mw_docker_mediawiki_exec#Examples)
$ mwdev dev mw exec -- MW_DB=wikidb php maintenance/update.php --quick
Is your database running and wiki database created / installed?
$ mwdev dev mw exec -- MW_DB=wikidb php maintenance/update.php --dbname=wikidb --quick
Is your database running and wiki database created / installed?
It seems to be an issue of mwcli, though.
OK, here is the description of my successful, hacky way to set up CreateWiki as just a dependency of ManageWiki:
${MEDIAWIKI_VOLUMES_CODE}/extensions/CreateWiki
mwdev dev mysql create && mwdev dev mw create && mwdev dev mw install --dbtype mysql
wfLoadExtension( 'CreateWiki' );
and $wgGroupPermissions['sysop']['createwiki'] = true;
to your LocalSettings.php which is auto-generated in the previous step.require_once "$IP/extensions/CreateWiki/.github/workflows/globals.php";
too.globals.php
(see below)extensions/CreateWiki/extension.json
mwdev dev mw exec -- php maintenance/update.php --quick
mwdev dev mw exec -- php maintenance/update.php --quick
Modified version of globals.php |
---|
<?php
define( 'MW_DB', 'default' );
require_once "$IP/extensions/CreateWiki/includes/WikiInitialise.php";
$wi = new WikiInitialise();
$wi->setVariables(
$wgCacheDirectory,
[
''
],
[
'default.mediawiki.mwdd.localhost' => ''
]
);
$wi->config->settings += [
'cwClosed' => [
'default' => false,
],
'cwInactive' => [
'default' => false,
],
'cwPrivate' => [
'default' => false,
],
'cwExperimental' => [
'default' => false,
],
];
$wgCreateWikiGlobalWiki = MW_DB;
$wgCreateWikiDatabase = MW_DB;
$wgCreateWikiCacheDirectory = $wgCacheDirectory;
$wgHooks['MediaWikiServices'][] = 'wfOnMediaWikiServices';
function wfOnMediaWikiServices( MediaWiki\MediaWikiServices $services ) {
global $wgServer;
try {
$dbw = wfGetDB( DB_PRIMARY );
$dbw->insert(
'cw_wikis',
[
'wiki_dbname' => 'default',
'wiki_dbcluster' => 'c1',
'wiki_sitename' => 'TestWiki',
'wiki_language' => 'en',
'wiki_private' => (int)0,
'wiki_creation' => $dbw->timestamp(),
'wiki_category' => 'uncategorised',
'wiki_closed' => (int)0,
'wiki_deleted' => (int)0,
'wiki_locked' => (int)0,
'wiki_inactive' => (int)0,
'wiki_inactive_exempt' => (int)0,
'wiki_url' => 'http://default.mediawiki.mwdd.localhost:80',
]
);
} catch ( Wikimedia\Rdbms\DBQueryError $e ) {
return;
}
}
$wi->readCache();
$wi->config->extractAllGlobals( $wi->dbname );
$wgConf = $wi->config;
|
have you managed to make this work? are there some required settings?
right after installation i got
Error 1046: No database selected
Function: Wikimedia\Rdbms\Database::select
Query: SELECT wiki_dbcluster,wiki_dbname,wiki_deleted,wiki_url,wiki_sitename FROM `cw_wikis`
after adding $wgCreateWikiDatabase = $wgDBname; to configuration file, I get a different error
MWException: Wiki 'db_wiki' can not be found.
this is literally a database with cw_ tables
am I missing something?