本文整理汇总了PHP中Status::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::error方法的具体用法?PHP Status::error怎么用?PHP Status::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::error方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPageContentSave
/**
* @param $wikiPage
* @param \User $user
* @param $content
* @param $summary
* @param $isMinor
* @param $isWatch
* @param $section
* @param $flags
* @param \Status $status
*
* @return bool
*/
public function onPageContentSave($wikiPage, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $status)
{
if ($user && !$user->isEmailConfirmed()) {
if (!$this->testResponse()) {
$status->setResult(false);
$status->error("recaptcha-failed");
return false;
}
}
return true;
}
示例2: connectToFacebook
/**
* Map an existing Wikia user to a Facebook id
* If an exact or partial match of the map already exists, OR
* if creation of mapping does not succeed, returns not-OK Status
*
* @param int $wikiaUserId
* @param int $fbUserId
* @return \Status (status value will be null or \FacebookMapModel if successfully created)
*/
public function connectToFacebook($wikiaUserId, $fbUserId)
{
$status = new Status();
try {
$map = \FacebookMapModel::getUserMapping($wikiaUserId, $fbUserId);
if ($map) {
// Error! There is already a mapping
$status->setResult(false);
$status->error('fbconnect-error-already-connected');
} else {
$bizToken = \FacebookClient::getInstance()->getBizToken();
$map = \FacebookMapModel::createUserMapping($wikiaUserId, $fbUserId, $bizToken);
if ($map instanceof \FacebookMapModel) {
$status->setResult(true, $map);
} else {
$status->setResult(false);
$status->error('fbconnect-error');
}
}
} catch (\Exception $e) {
$messageParams = [];
switch ($e->getCode()) {
case \FacebookMapModel::ERROR_WIKIA_USER_ID_MISMATCH:
$messageParams[] = 'fbconnect-error-fb-account-in-use';
$messageParams[] = \User::whoIs($wikiaUserId);
break;
case \FacebookMapModel::ERROR_FACEBOOK_USER_ID_MISMATCH:
$messageParams[] = 'fbconnect-error-already-connected';
break;
default:
$messageParams[] = 'fbconnect-error';
}
$status->setResult(false);
call_user_func_array([$status, 'error'], $messageParams);
}
return $status;
}
示例3: testGetErrorsByType
/**
* @covers Status::getErrorsByType
*/
public function testGetErrorsByType()
{
$status = new Status();
$warning = new Message('warning111');
$error = new Message('error111');
$status->warning($warning);
$status->error($error);
$warnings = $status->getErrorsByType('warning');
$errors = $status->getErrorsByType('error');
$this->assertCount(1, $warnings);
$this->assertCount(1, $errors);
$this->assertEquals($warning, $warnings[0]['message']);
$this->assertEquals($error, $errors[0]['message']);
}
示例4: adminUnattach
/**
* Unattach a list of local accounts from the global account
* @param array $list List of wiki names
* @return Status
*/
public function adminUnattach($list)
{
if (!count($list)) {
return Status::newFatal('centralauth-admin-none-selected');
}
$status = new Status();
$valid = $this->validateList($list);
$invalid = array_diff($list, $valid);
foreach ($invalid as $wikiName) {
$status->error('centralauth-invalid-wiki', $wikiName);
$status->failCount++;
}
$dbcw = self::getCentralDB();
$password = $this->getPassword();
foreach ($valid as $wikiName) {
# Delete the user from the central localuser table
$dbcw->delete('localuser', array('lu_name' => $this->mName, 'lu_wiki' => $wikiName), __METHOD__);
if (!$dbcw->affectedRows()) {
$wiki = WikiMap::getWiki($wikiName);
$status->error('centralauth-admin-already-unmerged', $wiki->getDisplayName());
$status->failCount++;
continue;
}
# Touch the local user row, update the password
$lb = wfGetLB($wikiName);
$dblw = $lb->getConnection(DB_MASTER, array(), $wikiName);
$dblw->update('user', array('user_touched' => wfTimestampNow(), 'user_password' => $password), array('user_name' => $this->mName), __METHOD__);
$id = $dblw->selectField('user', 'user_id', array('user_name' => $this->mName), __METHOD__);
$this->clearLocalUserCache($wikiName, $id);
$lb->reuseConnection($dblw);
$status->successCount++;
}
if (in_array(wfWikiID(), $valid)) {
$this->resetState();
}
$this->invalidateCache();
return $status;
}
示例5: performUpload
/**
* Wrapper around the parent function in order to defer uploading to the
* job queue for asynchronous uploads
*/
public function performUpload($comment, $pageText, $watch, $user)
{
if ($this->mAsync) {
$sessionKey = $this->insertJob($comment, $pageText, $watch, $user);
$status = new Status();
$status->error('async', $sessionKey);
return $status;
}
return parent::performUpload($comment, $pageText, $watch, $user);
}