Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/398636 )
Change subject: Move ConfirmAccountsPager to own file ...................................................................... Move ConfirmAccountsPager to own file Makes MediaWiki.Files.OneClassPerFile.MultipleFound pass Change-Id: I8a787d8b92603f10c457826ae5e6e3a165269d48 --- M .phpcs.xml M ConfirmAccount.setup.php M frontend/specialpages/actions/ConfirmAccount_body.php A frontend/specialpages/actions/ConfirmAccountsPager.php 4 files changed, 107 insertions(+), 108 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmAccount refs/changes/36/398636/1 diff --git a/.phpcs.xml b/.phpcs.xml index 91b9934..0583c3a 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -8,11 +8,9 @@ <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" /> <exclude name="MediaWiki.Commenting.FunctionComment.ParamNameNoMatch" /> <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" /> - <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" /> <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" /> </rule> <file>.</file> <arg name="extensions" value="php,php5,inc"/> - <arg name="encoding" value="utf8"/> - <exclude-pattern>vendor</exclude-pattern> + <arg name="encoding" value="UTF-8"/> </ruleset> diff --git a/ConfirmAccount.setup.php b/ConfirmAccount.setup.php index ce65332..31497e0 100644 --- a/ConfirmAccount.setup.php +++ b/ConfirmAccount.setup.php @@ -39,7 +39,7 @@ $messagesDirs['RequestAccountPage'] = __DIR__ . '/i18n/requestaccount'; # UI to confirm accounts $classes['ConfirmAccountsPage'] = "$spActionDir/ConfirmAccount_body.php"; - $classes['ConfirmAccountsPager'] = "$spActionDir/ConfirmAccount_body.php"; + $classes['ConfirmAccountsPager'] = "$spActionDir/ConfirmAccountsPager.php"; $messagesDirs['ConfirmAccountPage'] = __DIR__ . '/i18n/confirmaccount'; # UI to see account credentials $classes['UserCredentialsPage'] = "$spActionDir/UserCredentials_body.php"; diff --git a/frontend/specialpages/actions/ConfirmAccount_body.php b/frontend/specialpages/actions/ConfirmAccount_body.php index 31ffec3..f8ecd0c 100644 --- a/frontend/specialpages/actions/ConfirmAccount_body.php +++ b/frontend/specialpages/actions/ConfirmAccount_body.php @@ -827,107 +827,3 @@ return 'users'; } } - -/** - * Query to list out pending accounts - */ -class ConfirmAccountsPager extends ReverseChronologicalPager { - public $mForm, $mConds; - - function __construct( - $form, $conds, $type, $rejects = false, $showHeld = false, $showStale = false - ) { - $this->mForm = $form; - $this->mConds = $conds; - - $this->mConds['acr_type'] = $type; - - $this->rejects = $rejects; - $this->stale = $showStale; - if ( $rejects || $showStale ) { - $this->mConds['acr_deleted'] = 1; - } else { - $this->mConds['acr_deleted'] = 0; - if ( $showHeld ) { - $this->mConds[] = 'acr_held IS NOT NULL'; - } else { - $this->mConds[] = 'acr_held IS NULL'; - } - - } - parent::__construct(); - # Treat 20 as the default limit, since each entry takes up 5 rows. - $urlLimit = $this->mRequest->getInt( 'limit' ); - $this->mLimit = $urlLimit ? $urlLimit : 20; - } - - /** - * @return Title - */ - function getTitle() { - return $this->mForm->getFullTitle(); - } - - /** - * @param $row - * @return string - */ - function formatRow( $row ) { - return $this->mForm->formatRow( $row ); - } - - /** - * @return string - */ - function getStartBody() { - if ( $this->getNumRows() ) { - return '<ul>'; - } else { - return ''; - } - } - - /** - * @return string - */ - function getEndBody() { - if ( $this->getNumRows() ) { - return '</ul>'; - } else { - return ''; - } - } - - /** - * @return array - */ - function getQueryInfo() { - $conds = $this->mConds; - $tables = [ 'account_requests' ]; - $fields = [ 'acr_id', 'acr_name', 'acr_real_name', 'acr_registration', 'acr_held', - 'acr_user', 'acr_email', 'acr_email_authenticated', 'acr_bio', 'acr_notes', - 'acr_urls', 'acr_filename', 'acr_type', 'acr_rejected' ]; - # Stale requests have a user ID of zero - if ( $this->stale ) { - $conds[] = 'acr_user = 0'; - } elseif ( $this->rejects ) { - $conds[] = 'acr_user != 0'; - $tables[] = 'user'; - $conds[] = 'acr_user = user_id'; - $fields[] = 'user_name'; - $fields[] = 'acr_rejected'; - } - return [ - 'tables' => $tables, - 'fields' => $fields, - 'conds' => $conds - ]; - } - - /** - * @return string - */ - function getIndexField() { - return 'acr_registration'; - } -} diff --git a/frontend/specialpages/actions/ConfirmAccountsPager.php b/frontend/specialpages/actions/ConfirmAccountsPager.php new file mode 100644 index 0000000..2c09345 --- /dev/null +++ b/frontend/specialpages/actions/ConfirmAccountsPager.php @@ -0,0 +1,105 @@ +<?php + +/** + * Query to list out pending accounts + */ +class ConfirmAccountsPager extends ReverseChronologicalPager { + public $mForm, $mConds; + + function __construct( + $form, $conds, $type, $rejects = false, $showHeld = false, $showStale = false + ) { + $this->mForm = $form; + $this->mConds = $conds; + + $this->mConds['acr_type'] = $type; + + $this->rejects = $rejects; + $this->stale = $showStale; + if ( $rejects || $showStale ) { + $this->mConds['acr_deleted'] = 1; + } else { + $this->mConds['acr_deleted'] = 0; + if ( $showHeld ) { + $this->mConds[] = 'acr_held IS NOT NULL'; + } else { + $this->mConds[] = 'acr_held IS NULL'; + } + + } + parent::__construct(); + # Treat 20 as the default limit, since each entry takes up 5 rows. + $urlLimit = $this->mRequest->getInt( 'limit' ); + $this->mLimit = $urlLimit ? $urlLimit : 20; + } + + /** + * @return Title + */ + function getTitle() { + return $this->mForm->getFullTitle(); + } + + /** + * @param $row + * @return string + */ + function formatRow( $row ) { + return $this->mForm->formatRow( $row ); + } + + /** + * @return string + */ + function getStartBody() { + if ( $this->getNumRows() ) { + return '<ul>'; + } else { + return ''; + } + } + + /** + * @return string + */ + function getEndBody() { + if ( $this->getNumRows() ) { + return '</ul>'; + } else { + return ''; + } + } + + /** + * @return array + */ + function getQueryInfo() { + $conds = $this->mConds; + $tables = [ 'account_requests' ]; + $fields = [ 'acr_id', 'acr_name', 'acr_real_name', 'acr_registration', 'acr_held', + 'acr_user', 'acr_email', 'acr_email_authenticated', 'acr_bio', 'acr_notes', + 'acr_urls', 'acr_filename', 'acr_type', 'acr_rejected' ]; + # Stale requests have a user ID of zero + if ( $this->stale ) { + $conds[] = 'acr_user = 0'; + } elseif ( $this->rejects ) { + $conds[] = 'acr_user != 0'; + $tables[] = 'user'; + $conds[] = 'acr_user = user_id'; + $fields[] = 'user_name'; + $fields[] = 'acr_rejected'; + } + return [ + 'tables' => $tables, + 'fields' => $fields, + 'conds' => $conds + ]; + } + + /** + * @return string + */ + function getIndexField() { + return 'acr_registration'; + } +} -- To view, visit https://gerrit.wikimedia.org/r/398636 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8a787d8b92603f10c457826ae5e6e3a165269d48 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ConfirmAccount Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits