Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

chore: IConfig -> IAppConfig/IUserConfig (deprecation)#73

Merged
rubenvdlinde merged 1 commit into
developmentfrom
chore/iconfig-to-iappconfig
May 26, 2026
Merged

chore: IConfig -> IAppConfig/IUserConfig (deprecation)#73
rubenvdlinde merged 1 commit into
developmentfrom
chore/iconfig-to-iappconfig

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Summary

This is the pilot PR that defines the fleet migration pattern for deprecated OCP\IConfig app/user-value calls.

App-value calls (0 migrated)

No getAppValue/setAppValue calls exist. ActionAuthService and SettingsService already use the modern IAppConfig::getValueString/setValueString API — no migration needed.

User-value calls (3 intentionally LEFT)

PreferencesController.php lines 80/123/129 use IConfig::getUserValue, setUserValue, deleteUserValue.

Reason left: appinfo/info.xml declares <nextcloud min-version="28"/>. OCP\IUserConfig requires Nextcloud ≥ 31. These three calls must stay on IConfig until min-version is bumped to 31. A TODO comment pointing to this is the recommended fleet pattern.

Migration target API (for when min-version reaches 31):

use OCP\IUserConfig;
// inject: private readonly IUserConfig $userConfig

// get
$value = $this->userConfig->getValueString($uid, Application::APP_ID, 'pref_'.$safeKey, '');
// set
$this->userConfig->setValueString($uid, Application::APP_ID, 'pref_'.$safeKey, $value);
// delete
$this->userConfig->deleteUserValue($uid, Application::APP_ID, 'pref_'.$safeKey);

Pre-existing PHPCS/PHPStan errors fixed

Touched files had pre-existing quality gate failures — fixed per project policy:

  • HealthController / MetricsController: missing named params on parent::__construct
  • ActionAuthService: missing named params on internal method calls; redundant always-false type guards in setMatrix removed (PHPStan level-5); blank-line-after-function
  • InitializeActions: concat operator spacing; inline ternary → if/else; blank-line-after-function

Quality results

Tool Result
php -l No syntax errors (all edited files)
PHPStan ✅ No errors
PHPCS (errors) ✅ No errors (warnings are @spec tag placeholders across scaffold classes — tracked separately)
Deprecated call re-grep ✅ 0 app-value calls; 3 user-value calls intentionally left (min-version<31)

Fleet pattern

When fanning this out to other apps:

  1. Grep for getAppValue/setAppValue → replace with IAppConfig::getValueString/Int/Bool/Array (inject OCP\IAppConfig $appConfig)
  2. Grep for getUserValue/setUserValue/deleteUserValue → check min-version first; if ≥ 31 replace with IUserConfig::getValueString/setValueString/deleteUserValue (inject OCP\IUserConfig $userConfig); if < 31 leave with a TODO comment
  3. Remove use OCP\IConfig only when no system-value calls remain

…IUserConfig

App-value calls: none found — ActionAuthService and SettingsService already use
IAppConfig::getValueString/setValueString (modern API, no changes needed).

User-value calls: 3 calls (getUserValue/setUserValue/deleteUserValue) in
PreferencesController intentionally LEFT as IConfig — info.xml min-version=28,
IUserConfig requires min-version>=31. Migrate when min-version is bumped to 31+.

Pre-existing PHPCS errors fixed while touching affected files:
- HealthController/MetricsController: missing named params in parent::__construct
- ActionAuthService: missing named params on internal calls, redundant always-false
  type guards removed from setMatrix (PHPStan level-5 fix), blank-line-after-fn
- InitializeActions: concat-spacing, inline-ternary (replaced with if/else),
  blank-line-after-fn

PHPStan: OK (no errors). PHPCS: errors resolved (warnings are @SPEC tag placeholders
across scaffold classes — tracked separately).
@rubenvdlinde rubenvdlinde merged commit a0a0cb1 into development May 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant