Cdentinger has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/293895

Change subject: [DO NOT MERGE] mediawikiless-donationinterface
......................................................................

[DO NOT MERGE] mediawikiless-donationinterface

I can load index.php with only warnings. No output is displayed but I
think most of the basic machinery DI needs from MW is stubbed out. This
is only an experiment and should never merge, but looking at it from the
bottom up makes the idea of DI running alone less absurd than I thought.

Change-Id: I730e4b1afe4d2d44cd8963153c2bea772d90fd51
---
M composer.json
M gateway_common/WmfFramework.drupal.php
M gateway_forms/Mustache.php
A index.php
A mwedge/ContributionTrackingProcessor.php
A mwedge/RequestContext.php
A mwedge/UnlistedSpecialPage.php
7 files changed, 155 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/95/293895/1

diff --git a/composer.json b/composer.json
index 3846e2f..645a183 100644
--- a/composer.json
+++ b/composer.json
@@ -12,7 +12,8 @@
                        "gateway_common",
                        "globalcollect_gateway",
                        "paypal_gateway",
-                       "worldpay_gateway"
+                       "worldpay_gateway",
+                       "gateway_forms"
                ],
                "files": [
                        "gateway_common/WmfFramework.php"
diff --git a/gateway_common/WmfFramework.drupal.php 
b/gateway_common/WmfFramework.drupal.php
index 00f8857..b1b5513 100644
--- a/gateway_common/WmfFramework.drupal.php
+++ b/gateway_common/WmfFramework.drupal.php
@@ -8,7 +8,12 @@
  * getLanguageCode.  The only code path in active use is to make recurring
  * charges through GlobalCollect.
  */
+function watchdog ( $name, $id, $dunno, $severity ) { }
+const WATCHDOG_INFO = 'xxx';
+const WATCHDOG_WARNING = 'xxx';
+
 class WmfFramework_Drupal {
+
        static function debugLog( $identifier, $msg, $level = 'DEBUG' ) {
                $severity = constant( "WATCHDOG_$level" ); // Yep, they all 
match!
                // Janky XML sanitization so we can see the tags
@@ -90,6 +95,8 @@
        }
 
        static function sanitize( $text ) {
-               return filter_xss( $text );
+               # return filter_xss( $text );
+               # FIXME drupal specific
+               return $text;
        }
 }
diff --git a/gateway_forms/Mustache.php b/gateway_forms/Mustache.php
index 1657d90..e717369 100644
--- a/gateway_forms/Mustache.php
+++ b/gateway_forms/Mustache.php
@@ -83,6 +83,7 @@
                if ( !$code ) {
                        throw new RuntimeException( 'Couldn\'t compile 
template!' );
                }
+               // I am confused.
                if ( substr( $code, 0, 5 ) === '<?php' ) {
                        $code = substr( $code, 5 );
                }
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..df103cd
--- /dev/null
+++ b/index.php
@@ -0,0 +1,29 @@
+<?php
+
+require('vendor/autoload.php');
+
+require('mwedge/UnlistedSpecialPage.php');
+require('mwedge/RequestContext.php');
+require('mwedge/ContributionTrackingProcessor.php');
+
+require('special/GatewayFormChooser.php');
+
+function wfMessage () { return new message(); }
+
+class message {
+       public function text() {
+               return 'xxx';
+       }
+}
+
+function wfParseUrl() {}
+function wfAppendQuery() {}
+
+session_start();
+
+$wgAdyenGatewayTemplate = 
'/srv/DonationInterface/gateway_forms/mustache/index.html.mustache';
+
+$adapter = new AdyenAdapter();
+
+$obj = new Gateway_Form_Mustache( $adapter );
+$form = $obj->getForm();
diff --git a/mwedge/ContributionTrackingProcessor.php 
b/mwedge/ContributionTrackingProcessor.php
new file mode 100644
index 0000000..ffd7321
--- /dev/null
+++ b/mwedge/ContributionTrackingProcessor.php
@@ -0,0 +1,7 @@
+<?php
+
+class ContributionTrackingProcessor {
+       static function contributionTrackingConnection() {
+               return '';
+       }
+}
diff --git a/mwedge/RequestContext.php b/mwedge/RequestContext.php
new file mode 100644
index 0000000..7353009
--- /dev/null
+++ b/mwedge/RequestContext.php
@@ -0,0 +1,98 @@
+<?php
+
+class RequestContext {
+
+       private $request;
+
+       private static $instance;
+
+       public static function getMain() {
+               if ( self::$instance === null ) {
+                       self::$instance = new self;
+               }
+               return self::$instance;
+       }
+
+       public function getRequest() {
+               if ( $this->request === null ) {
+                       $this->request = new WebRequest;
+               }
+
+               return $this->request;
+       }
+
+       public function getConfig() {
+               return new config();
+       }
+
+       public function getOutput() {
+               return new output();
+       }
+
+       public function getTitle() {
+               return new title();
+       }
+
+       public function getLanguage() {
+               return new language();
+       }
+
+}
+
+class language {
+       public function getCode() {
+               return 'en';
+               #return $this->getRequest()->getVal('language');
+       }
+}
+
+class config {
+       public function get () {
+               return 'xxx';
+       }
+}
+
+class output {
+       function parse() {}
+}
+
+class title {
+       function getLocalURL() {
+               return 'xxx';
+       }
+}
+
+class WebRequest {
+
+       private $data;
+
+       public function __construct () {
+               // FIXME mashing these together seems bad
+               $this->data = array_merge( $_GET, $_POST, $_SESSION );
+       }
+
+       public function getSessionData() {
+               return $_SESSION;
+       }
+
+       public function getText( $name, $default = '' ) {
+               return (string)$this->getVal( $name, $default );
+       }
+
+       # TODO default arg is whack
+       public function getVal( $name, $default ) {
+               if ( isset( $this->data[$name] ) ) {
+                       return $this->data[$name];
+               }
+               return $default;
+       }
+
+       public function getFullRequestURL() {
+               return 'xxx';
+       }
+
+       public function getHeader( $name ) {
+               return $_SERVER[$name];
+       }
+
+}
diff --git a/mwedge/UnlistedSpecialPage.php b/mwedge/UnlistedSpecialPage.php
new file mode 100644
index 0000000..572f358
--- /dev/null
+++ b/mwedge/UnlistedSpecialPage.php
@@ -0,0 +1,10 @@
+<?php
+
+class UnlistedSpecialPage {
+
+       private $adapter;
+
+       public function __construct( $adapter ) {
+               $this->adapter = $adapter;
+       }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/293895
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I730e4b1afe4d2d44cd8963153c2bea772d90fd51
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Cdentinger <cdentin...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to