Incorporating Editor into a Mediawiki special page

Incorporating Editor into a Mediawiki special page

Loren MaxwellLoren Maxwell Posts: 406Questions: 99Answers: 10
edited April 2017 in Free community support

I am writing an extension for Mediawiki and would like to use Editor.

My extension extends the Mediawiki SpecialPage class:

<?php
/** Editor Test SpecialPage
 */

include( "../Editor/php/DataTables.php" );
use DataTables\Editor;

class EditorTest extends SpecialPage {
    
    /** Construct page
     */
    public function __construct() {
        parent::__construct( 'EditorTest', 'noshow' );
    }

    /** Show page to user
     */
    public function execute() {

        $this->getOutput()->addHTML( 'Hello world!' );

        return;
    }
}

However the page doesn't show anything at all, not even the Mediawiki menus and stuff.

I've done a var_dump( $sql_details ); in the Bootstrap.php file, and all my database config stuff shows up correctly. but I believe something is happening on the $db = new Database( $sql_details ); line because anything after that is not executed, including not even another var_dump or an echo.

I've also tried the include where it is at in the file and I've moved it to inside the execute function, but I get the same result either way.

Any thoughts?

=======================

Here's a little more information -- It appears to happen in Line 65 in Database.php:

call_user_func($this->query_driver.'::connect', $opts );

Note: isset($opts['pdo']) is false

Here's var_dump($this->query_driver ); just before:
string(36) "DataTables\Database\DriverMysqlQuery"

And var_dump($this->query_driver ); just after returns absolutely nothing, not even a NULL.

I've double checked all my database config parameters and they are correct, so I'm not sure what's happening.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin

    However the page doesn't show anything at all, not even the Mediawiki menus and stuff.

    Sounds like a 500 internal server error. It would be worth checking the server's error logs.

    And var_dump($this->query_driver ); just after returns absolutely nothing, not even a NULL.

    Two options spring to mind:

    • The file isn't where it is being loaded from
    • The server doesn't have the PDO MySQL driver installed.

    The server error log should hopefully yield more information.

    I am writing an extension for Mediawiki and would like to use Editor.

    Its worth noting that if you are planning on distributing it to other developers for them to install, they would need their own licenses. The Editor license doesn't allow for redistribution of the code to other developers to modify I'm afraid.

    Allan

  • Loren MaxwellLoren Maxwell Posts: 406Questions: 99Answers: 10

    Thanks for the quick response, Allan.

    I was actually just reading up on the PDO MySQL driver. Hopefully it's that simple.

    Also, good note on the license issue -- This is an extension intended for use on my own website and not for redistribution.

  • Loren MaxwellLoren Maxwell Posts: 406Questions: 99Answers: 10

    Allan, just to follow up --

    I had the host install the PDO MySQL driver and everything appears to be working great (at least with the Editor samples).

    I did have to reenter my password in MySQL to update it to the 41-byte hash value, but that was fairly straightforward.

    Anyway, now I'm moving back to developing the Mediawiki extension.

    Looking forward to using Editor on the site!

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin
    Answer ✓

    Excellent - good to hear you got it going. Look forward to hearing how the integration goes!

    Allan

This discussion has been closed.