Skip to content

Commit

Permalink
(chocolatey#1014) Add advanced option to ignore cached items
Browse files Browse the repository at this point in the history
This adds a new option to the advanced installation dialog
to be able to ignore any cached http resources that Chocolatey
CLI has cached. This can be useful for sources that allows an existing
version on the source can be replace, and then allow Chocolatey GUI
to download the absolute latest version of the package.
  • Loading branch information
AdmiringWorm committed Jun 14, 2023
1 parent 44bd341 commit 751e4e5
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ public async Task<PackageOperationResult> InstallPackage(
config.DownloadChecksum64 = advancedInstallOptions.DownloadChecksum64bit;
config.DownloadChecksumType = advancedInstallOptions.DownloadChecksumType;
config.DownloadChecksumType64 = advancedInstallOptions.DownloadChecksumType64bit;

if (advancedInstallOptions.IgnoreCached)
{
config.CacheExpirationInMinutes = 0;
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class AdvancedInstallViewModel : ObservableBase, IClosableChildWindow<Adv
private bool _applyInstallArgumentsToDependencies;
private bool _applyPackageParametersToDependencies;
private bool _allowDowngrade;
private bool _ignoreCached;
private bool _ignoreDependencies;
private bool _forceDependencies;
private bool _skipPowerShell;
Expand Down Expand Up @@ -225,6 +226,12 @@ public bool AllowDowngrade
set { SetPropertyValue(ref _allowDowngrade, value); }
}

public bool IgnoreCached
{
get { return _ignoreCached; }
set { SetPropertyValue(ref _ignoreCached, value); }
}

public bool IgnoreDependencies
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@
<Button Grid.Column="1" Content="{lang:Localize AdvancedChocolateyDialog_Browse}" Command="{Binding BrowseLogFileCommand}" />
</Grid>
</mah:MetroHeader>
<mah:MetroHeader Header="{lang:Localize AdvancedChocolateyDialog_IgnoreCached_Header}" Tag="{lang:Localize AdvancedChocolateyDialog_IgnoreCached_ToolTip}">
<mah:ToggleSwitch VerticalAlignment="Center" IsOn="{Binding IgnoreCached}" />
</mah:MetroHeader>
<mah:MetroHeader Header="{lang:Localize AdvancedChocolateyDialog_OverrideArguments_Header}" Tag="{lang:Localize AdvancedChocolateyDialog_OverrideArguments_ToolTip}">
<mah:ToggleSwitch VerticalAlignment="Center" IsOn="{Binding OverrideArguments}">
<mah:ToggleSwitch.IsEnabled>
Expand Down
2 changes: 2 additions & 0 deletions Source/ChocolateyGui.Common/Models/AdvancedInstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class AdvancedInstall

public bool SkipPowerShell { get; set; }

public bool IgnoreCached { get; set; }

public bool IgnoreChecksums { get; set; }

public bool AllowEmptyChecksums { get; set; }
Expand Down
20 changes: 19 additions & 1 deletion Source/ChocolateyGui.Common/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Source/ChocolateyGui.Common/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1377,4 +1377,10 @@ Please contact your System Administrator to enable this operation.</value>
<value>Browse</value>
<comment>This text is used for both when a user clicks a button supposed to select a file, and when selecting a folder.</comment>
</data>
</root>
<data name="AdvancedChocolateyDialog_IgnoreCached_Header" xml:space="preserve">
<value>Ignore Cached</value>
</data>
<data name="AdvancedChocolateyDialog_IgnoreCached_ToolTip" xml:space="preserve">
<value>Ignore any previously cached http resources</value>
</data>
</root>

0 comments on commit 751e4e5

Please sign in to comment.