Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CreateWikiJson #47

Closed
wants to merge 2 commits into from
Closed
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
23 changes: 6 additions & 17 deletions DeletedWiki.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

use MediaWiki\MediaWikiServices;
use Miraheze\CreateWiki\CreateWikiJson;
use Miraheze\CreateWiki\CreateWikiPhp;

global $wgDBname, $wgLocalDatabases, $wgCreateWikiUsePhpCache;
global $wgDBname, $wgLocalDatabases;

if ( MW_ENTRY_POINT !== 'cli' ) {
require_once __DIR__ . '/getTranslations.php';
Expand All @@ -17,7 +16,6 @@
http_response_code( 410 );

$output = <<<EOF

<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -56,20 +54,11 @@
header( 'Content-length: ' . strlen( $output ) );
echo $output;

if ( $wgCreateWikiUsePhpCache ) {
if ( in_array( $wgDBname, $wgLocalDatabases ) ) {
MediaWikiServices::allowGlobalInstance();
$createWikiHookRunner = MediaWikiServices::getInstance()->get( 'CreateWikiHookRunner' );
$cWP = new CreateWikiPhp( $wgDBname, $createWikiHookRunner );
$cWP->update();
}
} else {
if ( in_array( $wgDBname, $wgLocalDatabases ) ) {
MediaWikiServices::allowGlobalInstance();
$createWikiHookRunner = MediaWikiServices::getInstance()->get( 'CreateWikiHookRunner' );
$cWJ = new CreateWikiJson( $wgDBname, $createWikiHookRunner );
$cWJ->update();
}
if ( in_array( $wgDBname, $wgLocalDatabases ) ) {
MediaWikiServices::allowGlobalInstance();
$createWikiHookRunner = MediaWikiServices::getInstance()->get( 'CreateWikiHookRunner' );
$cWP = new CreateWikiPhp( $wgDBname, $createWikiHookRunner );
$cWP->update();
}

die( 1 );
Expand Down
39 changes: 10 additions & 29 deletions MissingWiki.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

use MediaWiki\MediaWikiServices;
use Miraheze\CreateWiki\CreateWikiJson;
use Miraheze\CreateWiki\CreateWikiPhp;

global $wgDBname, $wgCreateWikiUsePhpCache;
global $wgDBname;

if ( MW_ENTRY_POINT !== 'cli' ) {
require_once __DIR__ . '/getTranslations.php';
Expand All @@ -17,7 +16,6 @@
http_response_code( 404 );

$output = <<<EOF

<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -56,33 +54,16 @@
header( 'Content-length: ' . strlen( $output ) );
echo $output;

if ( $wgCreateWikiUsePhpCache ) {
try {
MediaWikiServices::allowGlobalInstance();
$createWikiHookRunner = MediaWikiServices::getInstance()->get( 'CreateWikiHookRunner' );
$cWP = new CreateWikiPhp( $wgDBname, $createWikiHookRunner );
$cWP->update();
} catch ( Throwable $ex ) {
// Do nothing
}

if ( file_exists( '/srv/mediawiki/cache/databases.php' ) ) {
die( 1 );
}
} else {
try {
MediaWikiServices::allowGlobalInstance();
$createWikiHookRunner = MediaWikiServices::getInstance()->get( 'CreateWikiHookRunner' );
$cWJ = new CreateWikiJson( $wgDBname, $createWikiHookRunner );
$cWJ->update();
} catch ( Throwable $ex ) {
// Do nothing
}

if ( file_exists( '/srv/mediawiki/cache/databases.json' ) ) {
die( 1 );
}
try {
MediaWikiServices::allowGlobalInstance();
$createWikiHookRunner = MediaWikiServices::getInstance()->get( 'CreateWikiHookRunner' );
$cWP = new CreateWikiPhp( $wgDBname, $createWikiHookRunner );
$cWP->update();
} catch ( Throwable $ex ) {
// Do nothing
}

die( 1 );
} else {
// $wgDBname will always be set to a string, even if the --wiki parameter was not passed to a script.
echo "The wiki database '{$wgDBname}' was not found." . PHP_EOL;
Expand Down
Loading