Permalink
Browse files

Add ability to create cloudFlare record

  • Loading branch information...
addshore committed May 29, 2015
1 parent 25ae985 commit 6263c1d16f2a32fd05502f53d2bbf542fab71879
Showing with 590 additions and 0 deletions.
  1. +1 −0 CreateWiki.php
  2. +10 −0 README.md
  3. +12 −0 SpecialCreateWiki.php
  4. +567 −0 lib/class_cloudflare.php
View
@@ -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';
View
@@ -2,3 +2,13 @@ CreateWiki
==========
A MediaWiki extension for creating wikis.
+
+This extension contains Orain specific code.
+
+
+### Configuration Settings
+
+ - $wgCreateWikiSQLfiles
+ - $wgCreateWikiUseCloudFlare
+ - $wgCloudFlareUser
+ - $wgCloudFlareKey
View
@@ -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' ) ) {
Oops, something went wrong.

0 comments on commit 6263c1d

Please sign in to comment.