mediawiki中的VisualEditor问题

时间:2016-06-13 06:46:45

标签: node.js mediawiki parsoid

您好我已经安装了mediawiki 1.26.2以及可视化编辑器,nodejs和parsoid,问题是,当我开始使用parsoid时,似乎每个进程都正常工作,但是parsoid和visualeditor的配置,我可以'看到我的wiki中的任何编辑器。

我在下面描述了我的所有配置,如何启动parsoid,涉及的parsoid过程以及media wiki配置文件的localsettings中的配置行。

/etc/init.d/parsoid2 start-end script:

#!/bin/bash
#
# chkconfig: 35 90 12
# description: Foo server
#
# Get function from functions library
#. /etc/init.d/functions
# Start the service PARSOID
SCRIPT_PATH="/usr/lib/parsoid/src/bin/server.js"
DAEMON="/usr/bin/node $SCRIPT_PATH"
DAEMON_ARGS=""

start() {
    #initlog -c "echo -n Starting PARSOID server: "
      ulimit -n 64000
    /usr/bin/node  /usr/lib/parsoid/src/bin/server.js      >> /var/log/parsoid/parsoid.log 2>&1 &
    ### Create the lock file ###
    #touch /var/lock/subsys/parsoid
    success $"PARSOID server startup"
    echo
}
# Restart the service PARSOID
stop() {
    #initlog -c "echo -n Stopping PARSOID server: "
    pkill -f server.js
    ### Now, delete the lock file ###
    rm -f /var/lock/subsys/parsoid
    echo
}
### main logic ###
case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
status)
    status parsoid_nodejs.sh
    ;;
restart|reload|condrestart)
    stop
    start
    ;;
*)
    echo $"Usage: $0 {start|stop|restart|reload|status}"
    exit 1
esac
exit 0

运行/etc/init.d/parsoid2 start

后涉及的parsoid进程
root@vscj016mlinuxserver:~# ps -ef | grep parsoid
root      2244     1  0 08:21 pts/0        00:00:00 /usr/bin/node /usr/lib/parsoid/src/bin/server.js
root      2251  2244  0 08:21 pts/0    00:00:00 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js
root      2252  2244  0 08:21 pts/0    00:00:00 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js
root      2258  2244  0 08:21 pts/0    00:00:00 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js
root      2264  2244  0 08:21 pts/0    00:00:00 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js
root      2437  2023  0 08:36 pts/0    00:00:00 grep --color=auto parsoid
root@vscj016mlinuxserver:~#

Localsetting.js parsoid配置文件:

exports.setup = function(parsoidConfig) {
    // Set your own user-agent string
    // Otherwise, defaults to "Parsoid/<current-version-defined-in-    package.json>"
    //parsoidConfig.userAgent = "My-User-Agent-String";

    // Configure Parsoid to point to your MediaWiki instance.
    parsoidConfig.setMwApi({
            // The "prefix" is the name given to this wiki configuration in     the
            // (deprecated) Parsoid v1 API.
            prefix: 'localhost', // optional
            // The "domain" is used for communication with Visual Editor
            // and RESTBase.  It defaults to the hostname portion of
            // the `uri` property below, but you can manually set it
            // to an arbitrary string.
            domain: 'localhost', // optional
            // This is the only required parameter:
            // the URL of you MediaWiki API endpoint.
            uri: 'http://localhost/mediawiki/api.php',
            // To specify a proxy (or proxy headers) specific to this prefix
            // (which overrides defaultAPIProxyURI). Alternatively, set     `proxy`
            // to `null` to override and force no proxying when a default     proxy
            // has been set.
            /*
            proxy: {
                    uri: 'http://my.proxy:1234/',
                    headers: { 'X-Forwarded-Proto': 'https' } // headers     are optional
            }
            */
        });

/var/www/HTML/mediawiki/Localsettings.php上VisualEditor的配置:

require_once "$IP/extensions/VisualEditor/VisualEditor.php";
wfLoadExtension ( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgDefaultUserOptions['minordefault'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVisualEditorParsoidURL = 'http://localhost:8000';
$wgVirtualRestConfig['modules']['parsoid'] = array('url' => 'http://localhost:8000', 'domain' => 'localhost', 'prefix' => 'localhost');
$wgSessionsInObjectCache = true;
$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;

2 个答案:

答案 0 :(得分:0)

请确保您的parsoid版本与Visual Editor版本匹配,您可能应该使用旧方式配置Visual Editor:

$wgVisualEditorParsoidURL = 'http://127.0.0.1:8000';
$wgVisualEditorParsoidPrefix = 'localhost';

答案 1 :(得分:0)