Skip to content

Commit 3768be1

Browse files
daxian-dbwadityapatwardhan
authored andcommitted
Remove the not-working 'run Update-Help from Get-Help when Get-Help runs for the first time' feature (PowerShell#10974)
1 parent 9851b07 commit 3768be1

File tree

5 files changed

+0
-98
lines changed

5 files changed

+0
-98
lines changed

src/System.Management.Automation/engine/PSConfiguration.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -178,27 +178,6 @@ private string GetExecutionPolicySettingKey(string shellId)
178178
: string.Concat(shellId, ":", "ExecutionPolicy");
179179
}
180180

181-
/// <summary>
182-
/// Existing Key = HKLM\SOFTWARE\Microsoft\PowerShell
183-
/// Proposed value = Existing default. Probably "0"
184-
///
185-
/// Schema:
186-
/// {
187-
/// "DisablePromptToUpdateHelp" : bool
188-
/// }
189-
/// </summary>
190-
/// <returns>Boolean indicating whether Update-Help should prompt. If the value cannot be read, it defaults to false.</returns>
191-
internal bool GetDisablePromptToUpdateHelp()
192-
{
193-
return ReadValueFromFile<bool>(ConfigScope.AllUsers, "DisablePromptToUpdateHelp");
194-
}
195-
196-
internal void SetDisablePromptToUpdateHelp(bool prompt)
197-
{
198-
WriteValueToFile<bool>(ConfigScope.AllUsers, "DisablePromptToUpdateHelp", prompt);
199-
}
200-
201-
/// <summary>
202181
/// Get the names of experimental features enabled in the config file.
203182
/// </summary>
204183
internal string[] GetExperimentalFeatures()

src/System.Management.Automation/help/HelpCommands.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -246,19 +246,6 @@ public SwitchParameter ShowWindow
246246
protected override void BeginProcessing()
247247
{
248248
_timer.Start();
249-
250-
if (!Online.IsPresent && UpdatableHelpSystem.ShouldPromptToUpdateHelp() && HostUtilities.IsProcessInteractive(MyInvocation) && HasInternetConnection())
251-
{
252-
if (ShouldContinue(HelpDisplayStrings.UpdateHelpPromptBody, HelpDisplayStrings.UpdateHelpPromptTitle))
253-
{
254-
System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace).AddCommand("Update-Help").Invoke();
255-
#if LEGACYTELEMETRY
256-
_updatedHelp = true;
257-
#endif
258-
}
259-
260-
UpdatableHelpSystem.SetDisablePromptToUpdateHelp();
261-
}
262249
}
263250

264251
/// <summary>
@@ -716,15 +703,6 @@ private void HelpSystem_OnComplete()
716703
WriteProgress(record);
717704
}
718705

719-
/// <summary>
720-
/// Checks if we can connect to the internet.
721-
/// </summary>
722-
/// <returns></returns>
723-
private bool HasInternetConnection()
724-
{
725-
return true; // TODO:CORECLR wininet.dll is not present on NanoServer
726-
}
727-
728706
#region Helper methods for verification of parameters against NoLanguage mode
729707

730708
internal static void VerifyParameterForbiddenInRemoteRunspace(Cmdlet cmdlet, string parameterName)

src/System.Management.Automation/help/UpdatableHelpSystem.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,52 +1500,6 @@ internal string GetDefaultSourcePath()
15001500
return string.IsNullOrEmpty(defaultSourcePath) ? null : defaultSourcePath;
15011501
}
15021502

1503-
/// <summary>
1504-
/// Sets the DisablePromptToUpdatableHelp regkey.
1505-
/// </summary>
1506-
internal static void SetDisablePromptToUpdateHelp()
1507-
{
1508-
try
1509-
{
1510-
PowerShellConfig.Instance.SetDisablePromptToUpdateHelp(true);
1511-
}
1512-
catch (UnauthorizedAccessException)
1513-
{
1514-
// Ignore AccessDenied related exceptions
1515-
}
1516-
catch (SecurityException)
1517-
{
1518-
// Ignore AccessDenied related exceptions
1519-
}
1520-
}
1521-
1522-
/// <summary>
1523-
/// Checks if it is necessary to prompt to update help.
1524-
/// </summary>
1525-
/// <returns></returns>
1526-
internal static bool ShouldPromptToUpdateHelp()
1527-
{
1528-
#if UNIX
1529-
// TODO: This workaround needs to be removed once updatable help
1530-
// works on Linux.
1531-
return false;
1532-
#else
1533-
try
1534-
{
1535-
if (!Utils.IsAdministrator())
1536-
{
1537-
return false;
1538-
}
1539-
1540-
return PowerShellConfig.Instance.GetDisablePromptToUpdateHelp();
1541-
}
1542-
catch (SecurityException)
1543-
{
1544-
return false;
1545-
}
1546-
#endif
1547-
}
1548-
15491503
#endregion
15501504

15511505
#region Events

src/System.Management.Automation/help/UpdateHelpCommand.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ public SwitchParameter Recurse
143143
/// </summary>
144144
protected override void BeginProcessing()
145145
{
146-
// Disable Get-Help prompt
147-
UpdatableHelpSystem.SetDisablePromptToUpdateHelp();
148-
149146
if (_path == null)
150147
{
151148
// Pull default source path from GP

src/System.Management.Automation/resources/HelpDisplayStrings.resx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,6 @@ To update help again, add the Force parameter to your command.</value>
449449
<data name="RootElementMustBeHelpItems" xml:space="preserve">
450450
<value>The root level element of the help content must be "helpItems".</value>
451451
</data>
452-
<data name="UpdateHelpPromptBody" xml:space="preserve">
453-
<value>The Update-Help cmdlet downloads the most current Help files for PowerShell modules, and installs them on your computer. For more information about the Update-Help cmdlet, see https://go.microsoft.com/fwlink/?LinkId=210614.</value>
454-
</data>
455-
<data name="UpdateHelpPromptTitle" xml:space="preserve">
456-
<value>Do you want to run Update-Help?</value>
457-
</data>
458452
<data name="SaveProgressActivityForModule" xml:space="preserve">
459453
<value>Saving Help for module {0}</value>
460454
</data>

0 commit comments

Comments
 (0)