Extension:HideCategorizedOrphans
Appearance
この拡張機能は、保守されたコード リポジトリではなく、編集可能なウィキ ページにソース コードを保存しています。 その結果、このコードが悪意をもって改ざんされているおそれがあります。 この拡張機能にはセキュリティ上の脆弱性が含まれているおそれがあり、translatewiki.net からの地域化 (ローカライズ) の更新は提供されません。 拡張機能を適切に保守し、レビューし、安全を確保するために、コードはウィキ ページではなくコード リポジトリでホストすることが、開発者には強く推奨されます。 |
現在、この拡張機能は積極的な保守が行われていません! それでも機能する可能性はありますが、バグ報告や機能の要望は無視される可能性が高くなります。 |
リリースの状態: 保守されていない |
|
|---|---|
| 実装 | 自分のウィキ |
| 説明 | Makes MediaWiki consider pages that belong to a category not be orphans |
| 作者 | Steven Orvis (Sorvisトーク) |
| 最新バージョン | 0.2.0 (2014-06-09) |
| MediaWiki | 1.23+ |
| PHP | 5.3+ |
| データベースの変更 | いいえ |
| ライセンス | GNU 一般公衆利用許諾書 2.0 以降 |
| ダウンロード | コードの節を参照してください |
The HideCategorizedOrphans extension makes MediaWiki consider pages that belong to a category not be orphans. This is useful if you want to link to a category off of a page, but the links to that individual page show up nowhere else.
インストール
- Copy the code into filesして、ファイルを
extensions/フォルダー内のHideCategorizedOrphansという名前のディレクトリ内に配置します。 - 以下のコードを LocalSettings.php ファイルの末尾に追加します:
require_once "$IP/extensions/HideCategorizedOrphans/HideCategorizedOrphans.php";
完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
コード
- HideCategorizedOrphans.php
<?php
/**
* HideCategoizedOrphans extension
*
* For more info see https://mediawiki.org/wiki/Extension:HideCategorizedOrphans
*
* @file
* @ingroup Extensions
* @author Steven Orvis, 2014
* @license GNU General Public Licence 2.0 or later
*/
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => 'HideCategorizedOrphans',
'author' => array(
'Steven Orvis',
),
'version' => '0.2.0',
'url' => 'https://www.mediawiki.org/wiki/Extension:HideCategorizedOrphans',
'descriptionmsg' => 'Hides orphaned pages that belong to a category',
);
/* Setup */
// Register files
$wgAutoloadClasses['HideCategorizedOrphansHooks'] = __DIR__ . '/HideCategorizedOrphans.hooks.php';
// Register hooks
$wgHooks['LonelyPagesQuery'][] = 'HideCategorizedOrphansHooks::onLonelyPagesQuery';
- HideCategorizedOrphans.hooks.php
<?php
/**
* Hooks for HideCategorizedOrphans extension
*
* @file
* @ingroup Extensions
*/
class HideCategorizedOrphansHooks {
/**
* Add condition to LonelyPagesQuery to hide pages in categories
*/
public static function onLonelyPagesQuery( &$tables, &$conds, &$joinConds) {
$joinConds['categorylinks'] = array(
'LEFT JOIN', array(
'cl_from = page_id'
)
);
$tables[] = 'categorylinks';
$conds[] = 'cl_from is null';
return true;
}
}
