本文整理汇总了PHP中ApiBase::getMain方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiBase::getMain方法的具体用法?PHP ApiBase::getMain怎么用?PHP ApiBase::getMain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiBase
的用法示例。
在下文中一共展示了ApiBase::getMain方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(ApiBase $query, $moduleName, $paramPrefix = '')
{
parent::__construct($query->getMain(), $moduleName, $paramPrefix);
$this->mQueryModule = $query;
$this->mDb = null;
$this->resetQueryParams();
}
示例2: __construct
/**
* Constructor
* @param $dbSource ApiBase Module implementing getDB().
* Allows PageSet to reuse existing db connection from the shared state like ApiQuery.
* @param int $flags Zero or more flags like DISABLE_GENERATORS
* @param int $defaultNamespace the namespace to use if none is specified by a prefix.
* @since 1.21 accepts $flags instead of two boolean values
*/
public function __construct( ApiBase $dbSource, $flags = 0, $defaultNamespace = NS_MAIN ) {
parent::__construct( $dbSource->getMain(), $dbSource->getModuleName() );
$this->mDbSource = $dbSource;
$this->mAllowGenerator = ( $flags & ApiPageSet::DISABLE_GENERATORS ) == 0;
$this->mDefaultNamespace = $defaultNamespace;
$this->profileIn();
$this->mParams = $this->extractRequestParams();
$this->mResolveRedirects = $this->mParams['redirects'];
$this->mConvertTitles = $this->mParams['converttitles'];
$this->profileOut();
}
示例3:
/**
* @param $query ApiBase
* @param $moduleName
* @return GenericMetricBase
*
*/
function __construct(ApiBase $query, $moduleName)
{
parent::__construct($query->getMain(), $moduleName);
}
示例4: addNewAccountApiForm
/**
* Pass API parameter on to the login form when using
* API account creation.
*
* @param ApiBase $apiModule
* @param LoginForm $loginForm
* @return hook return value
*/
public static function addNewAccountApiForm($apiModule, $loginForm)
{
global $wgRequest;
$main = $apiModule->getMain();
if ($main->getVal('ignoreantispoof') !== null) {
$wgRequest->setVal('wpIgnoreAntiSpoof', '1');
// Suppress "unrecognized parameter" warning:
$main->getVal('wpIgnoreAntiSpoof');
}
return true;
}
示例5: onApiCheckCanExecute
/**
* Validate "centralauthtoken", and disable certain modules that make no
* sense with "centralauthtoken".
* @param ApiBase $module API module
* @param User $user User
* @param array &$message Error message key and params
* @return bool
*/
static function onApiCheckCanExecute($module, $user, &$message)
{
global $wgCentralAuthCookies;
if (!$wgCentralAuthCookies) {
return true;
}
if (self::hasApiToken()) {
$module->getMain()->getVal('centralauthtoken');
# Mark used
$apiCentralUser = self::getApiCentralUser(true);
$centralUser = CentralAuthUser::getInstance($user);
if (!$apiCentralUser || !$centralUser || $apiCentralUser->getId() !== $centralUser->getId()) {
// Bad design, API.
ApiBase::$messageMap['centralauth-api-badtoken'] = array('code' => 'badtoken', 'info' => 'The centralauthtoken is not valid');
$message = array('centralauth-api-badtoken');
return false;
}
if ($module instanceof ApiLogin || $module instanceof ApiLogout) {
// Bad design, API.
ApiBase::$messageMap['centralauth-api-blacklistedmodule'] = array('code' => 'badparams', 'info' => 'The module "$1" may not be used with centralauthtoken');
$message = array('centralauth-api-blacklistedmodule', $module->getModuleName());
return false;
}
}
return true;
}
示例6: __construct
public function __construct(ApiBase $query, $moduleName)
{
parent::__construct($query->getMain(), $moduleName);
$this->numberOfActiveEditors = 100;
}
示例7: __construct
public function __construct(ApiBase $query, $moduleName)
{
parent::__construct($query->getMain(), $moduleName);
$this->normaliseQueryParameters();
}