Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5969619
Outreach.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Outreach.php
View Options
<?php
namespace
MobileFrontend\Amc
;
use
MediaWiki\Config\Config
;
use
MediaWiki\Config\ConfigException
;
use
MediaWiki\User\User
;
final
class
Outreach
{
/**
* Config name used to enable/disable the AMC Outreach feature
*/
private
const
CONFIG_NAME
=
'MFAmcOutreach'
;
/**
* Config name used to set the minimum number of edits a user must make before
* they will be eligible for AMC Outreach
*/
private
const
MIN_EDIT_COUNT_CONFIG_NAME
=
'MFAmcOutreachMinEditCount'
;
/**
* @var UserMode
*/
private
$userMode
;
/**
* @var User
*/
private
$user
;
/**
* @var Manager
*/
private
$amc
;
/**
* System config
* @var Config
*/
private
$config
;
/**
* @param UserMode $userMode
* @param Manager $amcManager
* @param User $user
* @param Config $config
*/
public
function
__construct
(
UserMode
$userMode
,
Manager
$amcManager
,
User
$user
,
Config
$config
)
{
$this
->
userMode
=
$userMode
;
$this
->
amc
=
$amcManager
;
$this
->
user
=
$user
;
$this
->
config
=
$config
;
}
/**
* Whether or not the outreach campaign is turned on and amc is available
*
* @return bool
*/
public
function
isCampaignActive
()
{
return
$this
->
config
->
get
(
self
::
CONFIG_NAME
)
&&
$this
->
amc
->
isAvailable
();
}
/**
* Whether or not the current user is eligible to see the outreach campaign
*
* @return bool
* @throws ConfigException
*/
public
function
isUserEligible
()
{
return
$this
->
isCampaignActive
()
&&
!
$this
->
userMode
->
isEnabled
()
&&
$this
->
user
->
getEditCount
()
>=
$this
->
config
->
get
(
self
::
MIN_EDIT_COUNT_CONFIG_NAME
)
&&
// T231057: Don't show drawer during browser tests
!
$this
->
user
->
isBot
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 13:53 (1 d, 43 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
42/2c/caf545968428e65f38e9977029b4
Default Alt Text
Outreach.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment