Skip to content

Commit

Permalink
Merge branch 'master' into replace
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Oct 7, 2024
2 parents 5193adf + 1340cd3 commit df6114f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
6 changes: 3 additions & 3 deletions includes/FormFactory/ManageWikiFormFactoryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,10 +836,10 @@ public static function submissionHandler(
throw new InvalidArgumentException( "{$module} not recognised" );
}

if ( $mwReturn->changes ) {
if ( $mwReturn->hasChanges() ) {
$mwReturn->commit();

if ( $module != 'permissions' ) {
if ( $module !== 'permissions' ) {
$mwReturn->logParams['4::wiki'] = $dbName;
}

Expand All @@ -854,7 +854,7 @@ public static function submissionHandler(
return [ [ 'managewiki-changes-none' => null ] ];
}

if ( $mwReturn->errors ?? [] && $module == 'permissions' ) {
if ( $mwReturn->errors ?? [] && $module === 'permissions' ) {
return $mwReturn->errors;
}

Expand Down
4 changes: 4 additions & 0 deletions includes/Helpers/ManageWikiExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ public function overwriteAll( array $extensions ) {
}
}

public function hasChanges(): bool {
return (bool)$this->changes;
}

/**
* Commits all changes made to extension lists to the database
*/
Expand Down
4 changes: 4 additions & 0 deletions includes/Helpers/ManageWikiNamespaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ public function remove( int $id, int $newNamespace, bool $maintainPrefix = false
$this->deleteNamespaces[] = $id;
}

public function hasChanges(): bool {
return (bool)$this->changes;
}

/**
* Commits all changes to database. Also files a job to move pages into or out of namespace
* @param bool $runNamespaceMigrationJob|true
Expand Down
4 changes: 4 additions & 0 deletions includes/Helpers/ManageWikiPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ public function remove( string $group ) {
$this->deleteGroups[] = $group;
}

public function hasChanges(): bool {
return (bool)$this->changes;
}

/**
* Commits all changes to database
*/
Expand Down
4 changes: 4 additions & 0 deletions includes/Helpers/ManageWikiSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public function overwriteAll( array $settings, bool $remove = true ) {
}
}

public function hasChanges(): bool {
return (bool)$this->changes;
}

/**
* Commits all changes to the database
*/
Expand Down
4 changes: 2 additions & 2 deletions includes/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ public static function onCreateWikiDataFactoryBuilder( string $wiki, IReadableDa

// Don't need to manipulate this much
if ( ManageWiki::checkSetup( 'settings' ) ) {
$cacheArray['settings'] = json_decode( $setObject->s_settings, true );
$cacheArray['settings'] = json_decode( $setObject->s_settings ?? '[]', true );
}

// Let's create an array of variables so we can easily loop these to enable
if ( ManageWiki::checkSetup( 'extensions' ) ) {
$manageWikiExtensions = self::getConfig( 'ManageWikiExtensions' );
foreach ( json_decode( $setObject->s_extensions, true ) as $ext ) {
foreach ( json_decode( $setObject->s_extensions ?? '[]', true ) as $ext ) {
$cacheArray['extensions'][] = $manageWikiExtensions[$ext]['var'] ??
$manageWikiExtensions[$ext]['name'];
}
Expand Down

0 comments on commit df6114f

Please sign in to comment.