Skip to content

Commit

Permalink
Simplify if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
iMarbot committed Apr 20, 2024
1 parent 3554f28 commit ce51cfe
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/SpecialPage/SpecialResourceLoaderArticles.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ private function addPage() {
*/
public function addPageCB( $formData ) {
$output = $this->getOutput();
$store = true;
if (
(
!( substr( $formData[ 'Page' ], -4 ) === '.css' || substr( $formData[ 'Page' ], -5 ) === '.less' )
Expand All @@ -165,9 +164,7 @@ public function addPageCB( $formData ) {
. $this->msg( 'resourceloaderarticles-error-page-invalid' )->text()
. '</div>'
);
$store = false;
}
if ( $store ) {
} else {
$dbw = wfGetDB( DB_PRIMARY );
$dbw->insert(
'resourceloaderarticles',
Expand Down Expand Up @@ -242,7 +239,6 @@ private function editPage( $id ) {
*/
public function editPageCB( $formData ) {
$output = $this->getOutput();
$store = true;
if (
(
!( substr( $formData[ 'Page' ], -4 ) === '.css' || substr( $formData[ 'Page' ], -5 ) === '.less' )
Expand All @@ -255,9 +251,7 @@ public function editPageCB( $formData ) {
. $this->msg( 'resourceloaderarticles-error-page-invalid' )->text()
. '</div>'
);
$store = false;
}
if ( $store ) {
} else {
$dbw = wfGetDB( DB_PRIMARY );
$dbw->update(
'resourceloaderarticles',
Expand Down

0 comments on commit ce51cfe

Please sign in to comment.