Skip to content

Commit

Permalink
Add ability to create cloudFlare record
Browse files Browse the repository at this point in the history
  • Loading branch information
addshore committed May 29, 2015
1 parent 25ae985 commit 6263c1d
Show file tree
Hide file tree
Showing 4 changed files with 590 additions and 0 deletions.
1 change: 1 addition & 0 deletions CreateWiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'url' => '//github.com/Orain/CreateWiki'
);

$wgAutoloadClasses['SpecialCreateWiki'] = dirname( __FILE__ ) . '/lib/class_cloudflare.php';
$wgAutoloadClasses['SpecialCreateWiki'] = dirname( __FILE__ ) . '/SpecialCreateWiki.php';
$wgExtensionMessagesFiles['CreateWiki'] = dirname( __FILE__ ) . '/CreateWiki.i18n.php';
$wgMessagesDirs['CreateWiki'] = dirname( __FILE__ ) . '/i18n';
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@ CreateWiki
==========

A MediaWiki extension for creating wikis.

This extension contains Orain specific code.


### Configuration Settings

- $wgCreateWikiSQLfiles
- $wgCreateWikiUseCloudFlare
- $wgCloudFlareUser
- $wgCloudFlareKey
12 changes: 12 additions & 0 deletions SpecialCreateWiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ public static function processInput( array $formData, HtmlForm $form ) {
$dbw->insert( 'site_stats', array( 'ss_row_id' => 1 ) );
$dbw->close();

// Add DNS record to cloudflare
global $wgCreateWikiUseCloudFlare, $wgCloudFlareUser,$wgCloudFlareKey;
if( $wgCreateWikiUseCloudFlare ) {
$cloudFlare = new cloudflare_api( $wgCloudFlareUser, $wgCloudFlareKey );
$cloudFlare->rec_new(
'orain.org',
'CNAME',
substr( $DBname, 0, -4 ),
'lb.orain.org'
);
}

// Create local account for founder (hack)
$out = exec( "php5 $IP/extensions/CentralAuth/maintenance/createLocalAccount.php " . escapeshellarg( $founderName ) . ' --wiki ' . escapeshellarg( $DBname ) );
if ( !strpos( $out, 'created' ) ) {
Expand Down
Loading

0 comments on commit 6263c1d

Please sign in to comment.