php - Google App Engine 上的 Mediawiki 链接缺少标题参数

标签 php google-app-engine mediawiki

使用 dev_appserver.py 在本地主机上安装并测试 mediawiki 副本后,我将安装部署到 Google App Engine。我对 LocalSettings.php 文件进行了一些更改,以适应 localhost 和 Google 之间的差异 - 主要是 SQL 数据库和 $wgServer。我尝试运行标准 mw_config 设置过程,但它从未完成 - 在表创建期间停止在某个位置(我认为)。相反,我将本地主机数据库的副本恢复到 Google Cloud SQL 数据库上。

它几乎可以工作了;它可以读取数据库、登录用户、保存对页面的更改……但是页面之间的链接存在一个奇怪的问题。页面上的链接缺少“?title=xxxx”部分,例如

/index.php/Special:用户登录

而不是

/index.php?title=特殊:用户登录

这使得它非常无法使用。

有人有在 Google App Engine (GAE) 上运行 Mediawiki 的经验吗?我需要知道需要进行哪些配置更改或页面更改才能使这些链接正常工作。

本地设置.php

<?php
# This file was automatically generated by the MediaWiki 1.21.2
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# http://www.mediawiki.org/wiki/Manual:Configuration_settings

# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
    exit;
}

## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;

$wgSitename = "Shattered Screens";
$wgMetaNamespace = "Shattered_Screens";

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgScriptExtension = ".php";

## The protocol and server name to use in fully-qualified URLs
#$wgServer = "http://localhost:8080";
if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
  $wgServer = "http://wiki.shatteredscreens.com";
}else{
  $wgServer = "http://localhost:8080";
}

## The relative URL path to the skins directory
$wgStylePath = "$wgScriptPath/skins";

## The relative URL path to the logo.  Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
$wgLogo             = "$wgStylePath/common/images/wiki.png";

## UPO means: this is also a user preference option

$wgEnableEmail = true;
$wgEnableUserEmail = true; # UPO

$wgEmergencyContact = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="08617e69662660697f636d7b487b60697c7c6d7a6d6c7b6b7a6d6d667b266b6765" rel="noreferrer noopener nofollow">[email protected]</a>";
$wgPasswordSender = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96ffe0f7f8b8fef7e1fdf3e5d6e5fef7e2e2f3e4f3f2e5f5e4f3f3f8e5b8f5f9fb" rel="noreferrer noopener nofollow">[email protected]</a>";

$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = true; # UPO
$wgEmailAuthentication = true;

## Database settings
$wgDBtype = "mysql";
#$wgDBserver = "localhost";
$wgDBname = "mediawiki";
$wgDBuser = "someaccount";
$wgDBpassword = "somepassword";

# Database server settings for local / GAE
if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
  $wgDBserver = ":/cloudsql/shattered-screens-wiki:mediawiki";
}else{
  $wgDBserver = "localhost";
}

# MySQL specific settings
$wgDBprefix = "";

# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";

# Experimental charset support for MySQL 5.0.
$wgDBmysql5 = false;

## Shared memory settings
$wgMainCacheType = CACHE_NONE;
$wgMemCachedServers = array();

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = false;
#$wgUseImageMagick = true;
#$wgImageMagickConvertCommand = "/usr/bin/convert";

# InstantCommons allows wiki to use images from http://commons.wikimedia.org
$wgUseInstantCommons = false;

## If you use ImageMagick (or any other shell command) on a
## Linux server, this will need to be set to the name of an
## available UTF-8 locale
$wgShellLocale = "en_US.utf8";

## If you want to use image uploads under safe mode,
## create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment
## this, if it's not already uncommented:
#$wgHashedUploadDirectory = false;

## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publically accessible from the web.
#$wgCacheDirectory = "$IP/cache";

# Site language code, should be one of the list in ./languages/Names.php
$wgLanguageCode = "en-gb";

$wgSecretKey = "xxx";

# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "xxx";

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
$wgDefaultSkin = "vector";

## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";

# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";

# Query string length limit for ResourceLoader. You should only set this if
# your web server has a query string length limit (then set it to that limit),
# or if you have suhosin.get.max_value_length set in php.ini (then set it to
# that value)
$wgResourceLoaderMaxQueryLength = -1;

# The following permissions were set based on your choice in the installer
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['read'] = false;


# End of automatically generated settings.
# Add more configuration options below.

app.yaml

application: shattered-screens-wiki
version: initialtest
runtime: php
api_version: 1

handlers:
# Static pages
- url: /(.*\.(htm$|html$|css$|js$))
  static_files: mediawiki/\1
  upload: mediawiki/(.*\.(htm$|html$|css$|js$))
  application_readable: true
  secure: always

# Serve images as static resources.
- url: /(.+\.(gif|png|jpg|css))$
  static_files: mediawiki/\1
  upload: mediawiki/.+\.(gif|png|jpg|css)$
  application_readable: true
  secure: always

# Misc files.
- url: /(.+\.(xsd|txt|))$
  static_files: mediawiki/\1
  upload: mediawiki/.+\.(xsd|txt)$
  application_readable: true
  secure: always

# Serve php5 scripts.
- url: /(.+\.php5)$
  script: mediawiki/\1

# Serve php scripts.
- url: /(.+\.php)$
  script: mediawiki/\1

最佳答案

您应该使用$wgArticlePath设置内部链接的格式。尝试将其设置为 {$wgScript}?title=$1

/index.php/Special:UserLogin 实际上是 installations on non CGI servers 的默认地址结构,并且也适用于 most服务器

关于php - Google App Engine 上的 Mediawiki 链接缺少标题参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21834448/

相关文章:

mediawiki - 在 mediawiki 中嵌入 doxygen

php - 如何使用 whereIn 函数 Laravel 约束渴望加载

php - 在处理数千个事件时 ics 格式是个好主意吗?

google-app-engine - GKE 上用于导出到 GAE 应用程序的 IP 地址是 0.0.0.0,而不是带有 Cloud NAT 的 IPv4

java - 部署到 Google App Engine 时出现“类文件是 Java 8,但最大支持的是 Java 7”错误

wiki - MediaWiki之后要使用哪个Wiki?

linux - MediaWiki 无法让 LDAP 身份验证工作

PHP foreach 循环使用数组中的值填充下拉列表

php - 与 CURL Multi PHP 的不一致

java - Google App Engine 中的 persist() 和 put() 方法有什么区别