< Summary - Jellyfin

Information
Class: Jellyfin.Server.Migrations.Routines.UpdateDefaultPluginRepository
Assembly: jellyfin
File(s): /srv/git/jellyfin/Jellyfin.Server/Migrations/Routines/UpdateDefaultPluginRepository.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 46
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Perform()100%66100%

File(s)

/srv/git/jellyfin/Jellyfin.Server/Migrations/Routines/UpdateDefaultPluginRepository.cs

#LineLine coverage
 1using System;
 2using MediaBrowser.Controller.Configuration;
 3
 4namespace Jellyfin.Server.Migrations.Routines;
 5
 6/// <summary>
 7/// Migration to update the default Jellyfin plugin repository.
 8/// </summary>
 9#pragma warning disable CS0618 // Type or member is obsolete
 10[JellyfinMigration("2025-04-20T17:00:00", nameof(UpdateDefaultPluginRepository), "852816E0-2712-49A9-9240-C6FC5FCAD1A8",
 11public class UpdateDefaultPluginRepository : IMigrationRoutine
 12#pragma warning restore CS0618 // Type or member is obsolete
 13{
 14    private const string NewRepositoryUrl = "https://repo.jellyfin.org/files/plugin/manifest.json";
 15    private const string OldRepositoryUrl = "https://repo.jellyfin.org/releases/plugin/manifest-stable.json";
 16
 17    private readonly IServerConfigurationManager _serverConfigurationManager;
 18
 19    /// <summary>
 20    /// Initializes a new instance of the <see cref="UpdateDefaultPluginRepository"/> class.
 21    /// </summary>
 22    /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</p
 23    public UpdateDefaultPluginRepository(IServerConfigurationManager serverConfigurationManager)
 24    {
 2125        _serverConfigurationManager = serverConfigurationManager;
 2126    }
 27
 28    /// <inheritdoc />
 29    public void Perform()
 30    {
 2131        var updated = false;
 8432        foreach (var repo in _serverConfigurationManager.Configuration.PluginRepositories)
 33        {
 2134            if (string.Equals(repo.Url, OldRepositoryUrl, StringComparison.OrdinalIgnoreCase))
 35            {
 2136                repo.Url = NewRepositoryUrl;
 2137                updated = true;
 38            }
 39        }
 40
 2141        if (updated)
 42        {
 2143            _serverConfigurationManager.SaveConfiguration();
 44        }
 2145    }
 46}