本文整理匯總了PHP中MessageGroups::exists方法的典型用法代碼示例。如果您正苦於以下問題:PHP MessageGroups::exists方法的具體用法?PHP MessageGroups::exists怎麽用?PHP MessageGroups::exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MessageGroups
的用法示例。
在下文中一共展示了MessageGroups::exists方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* Special page entry point.
*/
public function execute( $parameters ) {
$this->setHeaders();
// Security and validity checks
if ( !$this->userCanExecute( $this->user ) ) {
$this->displayRestrictionError();
return;
}
if ( !$this->request->wasPosted() ) {
$this->outputForm();
return;
}
if ( !$this->user->matchEditToken( $this->request->getVal( 'token' ) ) ) {
$this->out->addWikiMsg( 'session_fail_preview' );
$this->outputForm();
return;
}
if ( $this->request->getCheck( 'process' ) ) {
$data = $this->getCachedData();
if ( !$data ) {
$this->out->addWikiMsg( 'session_fail_preview' );
$this->outputForm();
return;
}
} else {
/**
* Proceed to loading and parsing if possible
* @todo: use a Status object instead?
*/
$file = null;
$msg = $this->loadFile( $file );
if ( $this->checkError( $msg ) ) return;
$msg = $this->parseFile( $file );
if ( $this->checkError( $msg ) ) return;
$data = $msg[1];
$this->setCachedData( $data );
}
$messages = $data['MESSAGES'];
$group = $data['METADATA']['group'];
$code = $data['METADATA']['code'];
if ( !MessageGroups::exists( $group ) ) {
$errorWrap = "<div class='error'>\n$1\n</div>";
$this->out->wrapWikiMsg( $errorWrap, 'translate-import-err-stale-group' );
return;
}
$importer = new MessageWebImporter( $this->getTitle(), $group, $code );
$alldone = $importer->execute( $messages );
if ( $alldone ) {
$this->deleteCachedData();
}
}