Extension:SecurePoll

This page is a translated version of the page Extension:SecurePoll and the translation is 74% complete.
MediaWiki扩展手册
SecurePoll
发行状态: 稳定版
实现 特殊页面
描述 允许进行选举、投票和调查
作者 Tim Starling留言
最新版本 3.0.0 (持续更新)
兼容性政策 快照跟随MediaWiki发布。 master分支不向后兼容。
MediaWiki 1.25+
数据库更改
securepoll_entity
securepoll_msgs
securepoll_properties
securepoll_elections
securepoll_questions
securepoll_options
securepoll_voters
securepoll_votes
securepoll_strike
securepoll_lists
securepoll_cookie_match
许可协议 GNU通用公眾授權條款2.0或更新版本
下載
  • $wgSecurePollTempDir
  • $wgSecurePollUseLogging
  • $wgSecurePollKeepPrivateInfoDays
  • $wgSecurePollUseNamespace
  • $wgSecurePollSingleTransferableVoteEnabled
  • $wgSecurePollGPGCommand
  • $wgSecurePollCreateWikiGroups
  • $wgSecurePollGpgSignKey
  • $wgSecurePollTranslationImportSourceUrl
  • $wgSecurePollCreateRemoteScriptPath
  • $wgSecurePollExcludedWikis
  • $wgSecurePollCreateWikiGroupDir
  • $wgSecurePollShowErrorDetail
  • securepoll-create-poll
  • securepoll-view-voter-pii
季度下載量 28 (Ranked 114th)
正在使用的公开wiki数 889 (Ranked 269th)
前往translatewiki.net翻譯SecurePoll扩展
問題 开启的任务 · 报告错误

SecurePoll扩展是一个特殊页面扩展,用于选举、投票和调查。 它被用于维基媒体基金会董事会的选举和仲裁委员会的选举,并被用于维基媒体许可证的过渡投票等。

截图

安裝

  • 下载文件,并将其放置在您extensions/文件夹中的SecurePoll目录内。
    开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/SecurePoll
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'SecurePoll' );
    
  • 运行更新脚本,它将自动创建此扩展必须依赖的数据库表。
  •   完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。

你还需要把新的“securepoll-create-poll”用户权限分配给某个用户组。 要把这个权限分配给管理员,请在你的LocalSettings.php中添加以下内容。

$wgGroupPermissions['sysop']['securepoll-create-poll'] = true;

这允许所有管理员创建投票,但不允许所有管理员管理某个特定的投票(包括编辑投票,查看用户数据等)。 在创建或编辑投票时,可以为某一特定投票定义单独管理员。 只有“electionadmin”组的成员可以管理投票。 要创建这个组,请在你的LocalSettings.php中添加以下内容。

$wgGroupPermissions['electionadmin'] = [];

然后通过Special:UserRights将一个特定的用户分配到electionadmin组。 请注意,选举管理员可以看到选民数据,所以只有受信任的用户应该被分配到这个组。 如果他们被从小组中删除,他们将不再能够管理任何选举。

用法

创建新投票

有两种方法来创建一个新的投票:手动创建一个XML文件并导入,或者使用Special:SecurePoll的投票创建界面。

手动

要手动创建一个投票,需要:

  1. 编写一个XML文件
  2. 使用import.php命令行界面命令导入它

在test文件夹中,你可以找到四个示例文件。

  • 3way-test.xml
  • approval-test.xml
  • radio-range.xml
  • schulze-test.xml info

要导入一个投票,从cli文件夹中运行以下内容。

extensions/SecurePoll/cli$ php import.php ../test/3way-test.xml

要使用docker导入一个投票,从cli文件夹中运行以下内容:

docker-compose exec mediawiki php extensions/SecurePoll/cli/import.php extensions/SecurePoll/test/radio-range.xml

通过Web界面

拥有securepoll-create-poll权限的用户可以点Special:SecurePoll下面的链接来创建新的投票。

要创建一个新的投票,请填写创建表格中的必填项。 请特别关注一下字段:

  • 只有electionadmin组的成员允许增加投票管理员。如果$wgSecurePollUseLogging设置为true,那么不管增加还是移除投票管理员都会留下日志。日志可以在Special:SecurePollLog查看。
  • 要创建一个加密的投票,请选择加密方法。 如果你选择GnuPG,会生成一个公钥和一个私钥。 在创建表格中输入加密密钥,并将私人密钥保存在线下的某个地方(一旦选举结束,你将需要它来进行统计)。 一个详细示例可以在这里找到

现在访问Special:SecurePoll,你会看到你的投票。

编辑现有投票

要编辑一个投票,你必须是该特定投票的管理员。 在Special:SecurePoll,点击编辑你想要的投票。

在选举开始之前,关于选举的任何内容都可以被编辑。 选举开始后,有些字段就不能再编辑了。

编辑可以参与投票的人

要编辑谁可以投票,你必须是该投票的管理员。 在Special:SecurePoll,点击该投票的投票者资格链接。

翻译一个投票

要翻译一个投票,你必须是该特定投票的管理员。 在Special:SecurePoll,在你想翻译的投票处点击翻译链接来翻译。

查看投票者名单

任何人都可以看到投票者的名单,除非在创建投票时禁用了透明功能。

某一投票的管理员可以看到投票者的名单,以及可能有助于识别重复投票者的私人信息(例如IP地址、用户代理信息、共享cookies)。 如果$wgSecurePollUseLogging设置为true,任何管理员查看隐私数据都会留下日志。 这些日志可以在Special:SecurePollLog查看。

管理员可以删除任何他们认为是重复的投票。

计票

要统计一个投票,你必须是该特定投票的管理员。 Special:SecurePoll,点击计票链接为你想要计票的投票计票。

如果投票之前已经统计过,结果将显示在页面上。 如果没有,或者你想重新统计,有一个表格可以开始新的统计。

  • 如果投票是未加密的,点击计票按钮。
  • 如果投票是加密的,你需要输入更多信息。比如,如果你使用GnuPG,输入私钥并点击计票按钮。如果加密投票有很多人投票,可能会花很长时间计票。你可能需要过段时间再回来查看结果。

访问Special:SecurePoll,你就能看到你的投票。

单一可转移票制计票

要启用单一可转移票制(STV)计票,请在LocalSettings.php加入下面的配置值。

$wgSecurePollSingleTransferableVoteEnabled = true;

更多关于单一可转移票制的信息,可以在維基百科找到。

贪心算法实现(source)

Quota is + .000001. Quota is the minimum value of votes to secure a seat.

1. Compute the quota.
2. Assign votes to candidates by first preferences.
3. Declare as winners all candidates who received at least the quota.
4. Transfer the excess votes from winners to hopefuls.
5. Repeat steps 3 and 4 until no new candidates are elected. (Under some systems, votes could initially be transferred in this step to prior winners or losers. This might affect the outcome.)
If all seats have winners, the process is complete. Otherwise:
6. Eliminate one or more candidates, typically either the lowest candidate or all candidates whose combined votes are less than the vote of the lowest remaining candidate.
7. Transfer the votes of the losers to remaining hopeful candidates.
8. Repeat 3–7 until all seats are full.

The quota we will use (step 1) is the Droop quota (source):

floor( no. votes / (no. seats + 1) ) + 1

The method for transferring votes from elected or eliminated candidates will be the Meek method:

Tallying (JobRunner)

  • Tallies can be processed via a scheduled job Manual:Job queue. Make sure to create a scheduled job for this task or execute the task manually.
  • Tallies can also be processed by executing the tallying script manually:

To execute a tally, run the following from the cli folder located at extensions/SecurePoll/cli:

extensions/SecurePoll/cli/tally.php

To execute a tally using MediaWiki-Docker, run the following from the cli folder located at extensions/SecurePoll/cli:

docker-compose exec mediawiki php extensions/SecurePoll/cli/tally.php

Generating (STV)Test Elections

  • Test (STV)elections can be generated from the cli folder located at extensions/SecurePoll/cli:
  • To generate a test election, run the following from the cli folder located at extensions/SecurePoll/cli:
extensions/SecurePoll/cli/generateTestElection.php
  • Test (STV) elections provide scaffolding from which to tally on

帮助文档

安全投票

安全投票的所有相关文档可在wikitech:SecurePoll查看。

安全投票的改进

A summary of improvements to SecurePoll can be found at Anti-Harassment Tools/SecurePoll Improvements.

Understanding the STV result