X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiOptions.php;h=c4de31f581e1ccddf83534604069cb73780096ca;hb=049ae64857c620ffa3f79d70dc13190418b05744;hp=3ea827c13abf4d0b92455647d155d1fc87aad134;hpb=69286527352e8f7b59a4b78adc327b8336de9312;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' ); }