カテゴリ(CategoryGallery)のすべての画像を表示するMediaWiki拡張機能をアップデートしています。Mediawiki php:ファイルをアップロードしたユーザーの名前を取得するには?
画像をアップロードしたユーザーの名前を表示し、ユーザーによってフィルタリングする可能性があります。
コードの一部は、このようなものです:
// Capitalize the first letter in the category argument, convert spaces to _
$params['cat'] = str_replace (' ', '_', ucfirst($params['cat']));
// Retrieve category members from database
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select('categorylinks', 'cl_from',
array ('cl_to' => $params['cat'],
'cl_type' => 'file'));
$ids = array();
foreach ($res as $row) {
$ids[] = $row->cl_from;
}
// Create the gallery
$titles = Title::newFromIDs ($ids);
$text = '';
foreach ($titles as $title) {
$titlePrefixedDBKey = $title->getPrefixedDBKey();
$text .= $titlePrefixedDBKey;
$text .= "|**Username**:\n";
}
$output = $parser->renderImageGallery($text, $params)
は、どのように私はそれが(私はユーザー名を入れている)画像ギャラリーに表示する写真をアップロードしたユーザーの名前を取得することができますか?
'$ title-> getFirstRevision() - > getUserText()' – Tgr
ご協力ありがとうございます@Tgr! – user1084363