本文整理汇总了PHP中Status::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::getValue方法的具体用法?PHP Status::getValue怎么用?PHP Status::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::getValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param integer|Status $status
*/
public function __construct($status)
{
if ($status instanceof self) {
$this->status = $status->getValue();
} else {
$this->status = (int) $status;
}
}
示例2: equals
/**
* @param Status $status
* @return bool
*/
public function equals(Status $status)
{
if ($this == $status) {
return true;
}
if ($this->status == $status->getValue()) {
return true;
}
return false;
}
示例3: undelete
/**
* Restore the given (or all) text and file revisions for the page.
* Once restored, the items will be removed from the archive tables.
* The deletion log will be updated with an undeletion notice.
*
* This also sets Status objects, $this->fileStatus and $this->revisionStatus
* (depending what operations are attempted).
*
* @param array $timestamps Pass an empty array to restore all revisions,
* otherwise list the ones to undelete.
* @param string $comment
* @param array $fileVersions
* @param bool $unsuppress
* @param User $user User performing the action, or null to use $wgUser
* @param string|string[] $tags Change tags to add to log entry
* ($user should be able to add the specified tags before this is called)
* @return array(number of file revisions restored, number of image revisions
* restored, log message) on success, false on failure.
*/
function undelete($timestamps, $comment = '', $fileVersions = [], $unsuppress = false, User $user = null, $tags = null)
{
// If both the set of text revisions and file revisions are empty,
// restore everything. Otherwise, just restore the requested items.
$restoreAll = empty($timestamps) && empty($fileVersions);
$restoreText = $restoreAll || !empty($timestamps);
$restoreFiles = $restoreAll || !empty($fileVersions);
if ($restoreFiles && $this->title->getNamespace() == NS_FILE) {
$img = wfLocalFile($this->title);
$img->load(File::READ_LATEST);
$this->fileStatus = $img->restore($fileVersions, $unsuppress);
if (!$this->fileStatus->isOK()) {
return false;
}
$filesRestored = $this->fileStatus->successCount;
} else {
$filesRestored = 0;
}
if ($restoreText) {
$this->revisionStatus = $this->undeleteRevisions($timestamps, $unsuppress, $comment);
if (!$this->revisionStatus->isOK()) {
return false;
}
$textRestored = $this->revisionStatus->getValue();
} else {
$textRestored = 0;
}
// Touch the log!
if ($textRestored && $filesRestored) {
$reason = wfMessage('undeletedrevisions-files')->numParams($textRestored, $filesRestored)->inContentLanguage()->text();
} elseif ($textRestored) {
$reason = wfMessage('undeletedrevisions')->numParams($textRestored)->inContentLanguage()->text();
} elseif ($filesRestored) {
$reason = wfMessage('undeletedfiles')->numParams($filesRestored)->inContentLanguage()->text();
} else {
wfDebug("Undelete: nothing undeleted...\n");
return false;
}
if (trim($comment) != '') {
$reason .= wfMessage('colon-separator')->inContentLanguage()->text() . $comment;
}
if ($user === null) {
global $wgUser;
$user = $wgUser;
}
$logEntry = new ManualLogEntry('delete', 'restore');
$logEntry->setPerformer($user);
$logEntry->setTarget($this->title);
$logEntry->setComment($reason);
$logEntry->setTags($tags);
Hooks::run('ArticleUndeleteLogEntry', [$this, &$logEntry, $user]);
$logid = $logEntry->insert();
$logEntry->publish($logid);
return [$textRestored, $filesRestored, $reason];
}
示例4: onSubmit
/**
* Process the form. At this point we know that the user passes all the criteria in
* userCanExecute(), and if the data array contains 'Username', etc, then Username
* resets are allowed.
* @param array $data
* @throws MWException
* @throws ThrottledError|PermissionsError
* @return Status
*/
public function onSubmit(array $data)
{
if (isset($data['Capture']) && !$this->getUser()->isAllowed('passwordreset')) {
// The user knows they don't have the passwordreset permission,
// but they tried to spoof the form. That's naughty
throw new PermissionsError('passwordreset');
}
$username = isset($data['Username']) ? $data['Username'] : null;
$email = isset($data['Email']) ? $data['Email'] : null;
$capture = !empty($data['Capture']);
$this->method = $username ? 'username' : 'email';
$this->result = Status::wrap($this->passwordReset->execute($this->getUser(), $username, $email, $capture));
if ($capture && $this->result->isOK()) {
$this->passwords = $this->result->getValue();
}
if ($this->result->hasMessage('actionthrottledtext')) {
throw new ThrottledError();
}
return $this->result;
}
示例5: testMergeWithOverwriteValue
/**
* @covers Status::merge
*/
public function testMergeWithOverwriteValue()
{
$status1 = new Status();
$status2 = new Status();
$message1 = $this->getMockMessage('warn1');
$message2 = $this->getMockMessage('error2');
$status1->warning($message1);
$status2->error($message2);
$status2->value = 'FooValue';
$status1->merge($status2, true);
$this->assertEquals(2, count($status1->getWarningsArray()) + count($status1->getErrorsArray()));
$this->assertEquals('FooValue', $status1->getValue());
}
示例6: updateNewsletter
/**
* Update newsletter-draft with selected recipients in newsletter object. Only possible with draft.
*
* @param $newsletter object
* @return \Newsletter2Go\Status
*/
public function updateNewsletter($newsletter)
{
$params = array();
if ($newsletter instanceof Newsletter && $newsletter->getId() > 0) {
$params['id'] = $newsletter->getId();
}
$params['name'] = $newsletter->getName();
$params['subject'] = $newsletter->getSubject();
if ($newsletter->getHtml()) {
$params['html'] = $newsletter->getHtml();
}
if ($newsletter->getText()) {
$params['text'] = $newsletter->getText();
}
$params['from'] = $newsletter->getFrom();
$params['reply'] = $newsletter->getReply();
if ($newsletter->getRef()) {
$params['reference'] = $newsletter->getRef();
}
$result = new Status($this->handleSendRequest('/de/api/set/newsletter/', $params));
$nId = $result->getValue();
foreach ($newsletter->getRecipients() as $rcp) {
$this->addRecipient2Newsletter($nId, $rcp);
}
return $result;
}
示例7: getRevision
protected static function getRevision(Status $s)
{
$value = $s->getValue();
return $value['revision'];
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:5,代码来源:MessageGroupStatesUpdaterJobTest.php