X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiOptions.php;h=c4de31f581e1ccddf83534604069cb73780096ca;hb=3caa34017f2dafa15b605502d3be74851ae8e8d4;hp=3ea827c13abf4d0b92455647d155d1fc87aad134;hpb=3ea7bba4d46ba5869fd989867638d970bd5dee2f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php index 3ea827c13a..c4de31f581 100644 --- a/includes/api/ApiOptions.php +++ b/includes/api/ApiOptions.php @@ -52,9 +52,9 @@ class ApiOptions extends ApiBase { $this->dieWithError( [ 'apierror-missingparam', 'optionname' ] ); } - if ( $params['reset'] ) { - $this->resetPreferences( $params['resetkinds'] ); - $changed = true; + $resetKinds = $params['resetkinds']; + if ( !$params['reset'] ) { + $resetKinds = []; } $changes = []; @@ -68,6 +68,14 @@ class ApiOptions extends ApiBase { $newValue = $params['optionvalue'] ?? null; $changes[$params['optionname']] = $newValue; } + + Hooks::run( 'ApiOptions', [ $this, $user, $changes, $resetKinds ] ); + + if ( $resetKinds ) { + $this->resetPreferences( $resetKinds ); + $changed = true; + } + if ( !$changed && !count( $changes ) ) { $this->dieWithError( 'apierror-nochanges' ); }