$form->BlockEmail = $params['noemail'];
$form->BlockHideName = $params['hidename'];
+ $userID = $expiry = null;
$retval = $form->doBlock($userID, $expiry);
if(!empty($retval))
// We don't care about multiple errors, just report one of them
*/
public static function delete(&$article, $token, &$reason = NULL)
{
+ global $wgUser;
+
$errors = self::getPermissionsError($article->getTitle(), $token);
if (count($errors)) return $errors;
if($reason === false)
return array(array('cannotdelete'));
}
+
+ if (!wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason)))
+ $this->dieUsageMsg(array('hookaborted'));
// Luckily, Article.php provides a reusable delete function that does the hard work for us
- if($article->doDeleteArticle($reason))
+ if($article->doDeleteArticle($reason)) {
+ wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason, $article->getId()));
return array();
+ }
return array(array('cannotdelete', $article->mTitle->getPrefixedText()));
}
if( $oldimage && !FileDeleteForm::isValidOldSpec($oldimage) )
return array(array('invalidoldimage'));
- $file = wfFindFile($title);
+ $file = wfFindFile($title, false, FileRepo::FIND_IGNORE_REDIRECT);
$oldfile = false;
if( $oldimage )
$articleObj = new Article($titleObj);
$ep = new EditPage($articleObj);
+
+ if ( !wfRunHooks( 'AlternateEdit', array( &$ep ) ) )
+ $this->dieUsageMsg(array('hookaborted'));
// EditPage wants to parse its stuff from a WebRequest
// That interface kind of sucks, but it's workable
public function execute() {
global $wgUser;
$wgUser->logout();
+
+ // Give extensions to do something after user logout
+ $injected_html = '';
+ wfRunHooks( 'UserLogoutComplete', array(&$wgUser, &$injected_html) );
}
public function getAllowedParams() {
// We don't care about multiple errors, just report one of them
$this->dieUsageMsg(current($errors));
+ $hookErr = null;
+ if( !wfRunHooks( 'AbortMove', array( $fromTitle, $toTitle, $wgUser, &$hookErr ) ) )
+ $this->dieUsageMsg(array('hookaborted', $hookErr));
+
$retval = $fromTitle->moveTo($toTitle, true, $params['reason'], !$params['noredirect']);
if($retval !== true)
$this->dieUsageMsg(array($retval));
$wgUser->removeWatch($toTitle);
}
$this->getResult()->addValue(null, $this->getModuleName(), $r);
+
+ // This one is a problem as we don't have a special page, but some
+ // extensions may want to do something when the hook has succeeded.
+ //wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ot , &$nt ) ) ;
}
public function mustBePosted() { return true; }
$titleObj = Title::newFromText($params['title']);
if(!$titleObj)
$this->dieUsageMsg(array('invalidtitle', $params['title']));
+
+ if ($titleObj->getNamespace() == NS_IMAGE)
+ $this->dieUsage('File undeletion is not supported', 'fileundeletionunsupported');
// Convert timestamps
if(!is_array($params['timestamps']))
if(!is_array($retval))
$this->dieUsageMsg(array('cannotundelete'));
+ //wfRunHooks( 'FileUndeleteComplete', array(
+ // $titleObj, $this->mFileVersions, $wgUser, $params['reason']) );
+
$info['title'] = $titleObj->getPrefixedText();
$info['revisions'] = $retval[0];
$info['fileversions'] = $retval[1];