dongpian6319 2019-01-04 01:43
浏览 68

mediawiki仅在特定页面中运行扩展(ClipUpload)

I have a mediawiki for my team up and running.

Extension:ClipUpload is a useful extension which allows users to upload images in clipboard by simple copy&paste. However, it sometimes causes unwanted uploading of clipboard (e.g. text copied from excel or other MS office softwares)

So what I want is making a specific page so that I use the ClipUpload extension in specific pages.

Here's what I have done but failed:

  1. created a page: http://my.domain/wiki/index.php/UploadFromClipboard

  2. when I enter the edit page: http://my.domain/wiki/index.php?title=UploadFromClipboard&action=edit

  3. I wanted to run the extension so added a line in LocalSettings.php

    if ( preg_match("/(Clipboard)/i", $wgArticlePath) ) require_once("$IP/extensions/ClipUpload/ClipUpload.php");

  4. This type of solution did not work. The problem is I can't parse page title in query.

Could you please suggest some solutions that I can try?

  • 写回答

1条回答 默认 最新

  • duanpen9294 2019-01-05 21:24
    关注

    LocalSettings.php is loaded before MediaWiki parses the URL and there are enough edge cases that you shouldn't want to do it yourself.

    One option is to use something that runs early but after basic variables have been set up (like BeforeInitialize) and disable the extension there based on the title (something like $wgHooks['EditPage::showEditForm:initial'] = array_diff( $wgHooks['EditPage::showEditForm:initial'], [ 'ClipSetup' ] );.

    Or you might try to fix the extension / file a bug (discarding clipboard content that's not an image seems pretty trivial).

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大