@@ -22,17 +22,14 @@ namespace DotNetNuke.Services.Installer
2222 using DotNetNuke . Services . Installer . Writers ;
2323 using DotNetNuke . Services . Log . EventLog ;
2424
25- /// -----------------------------------------------------------------------------
2625 /// <summary>
2726 /// The Installer class provides a single entrypoint for Package Installation.
2827 /// </summary>
29- /// -----------------------------------------------------------------------------
3028 public class Installer
3129 {
3230 private static readonly ILog Logger = LoggerSource . Instance . GetLogger ( typeof ( Installer ) ) ;
33- private Stream inputStream ;
31+ private readonly Stream inputStream ;
3432
35- /// -----------------------------------------------------------------------------
3633 /// <summary>
3734 /// Initializes a new instance of the <see cref="Installer"/> class.
3835 /// This Constructor creates a new Installer instance from a string representing
@@ -43,7 +40,6 @@ public class Installer
4340 /// <param name="manifest">The manifest filename.</param>
4441 /// <param name="physicalSitePath">The physical path to the root of the site.</param>
4542 /// <param name="loadManifest">Flag that determines whether the manifest will be loaded.</param>
46- /// -----------------------------------------------------------------------------
4743 public Installer ( string tempFolder , string manifest , string physicalSitePath , bool loadManifest )
4844 {
4945 this . Packages = new SortedList < int , PackageInstaller > ( ) ;
@@ -57,7 +53,6 @@ public Installer(string tempFolder, string manifest, string physicalSitePath, bo
5753 }
5854 }
5955
60- /// -----------------------------------------------------------------------------
6156 /// <summary>
6257 /// Initializes a new instance of the <see cref="Installer"/> class.
6358 /// This Constructor creates a new Installer instance from a Stream and a
@@ -66,13 +61,11 @@ public Installer(string tempFolder, string manifest, string physicalSitePath, bo
6661 /// <param name="inputStream">The Stream to use to create this InstallerInfo instance.</param>
6762 /// <param name="physicalSitePath">The physical path to the root of the site.</param>
6863 /// <param name="loadManifest">Flag that determines whether the manifest will be loaded.</param>
69- /// -----------------------------------------------------------------------------
7064 public Installer ( Stream inputStream , string physicalSitePath , bool loadManifest )
7165 : this ( inputStream , physicalSitePath , loadManifest , true )
7266 {
7367 }
7468
75- /// -----------------------------------------------------------------------------
7669 /// <summary>
7770 /// Initializes a new instance of the <see cref="Installer"/> class.
7871 /// This Constructor creates a new Installer instance from a Stream and a
@@ -82,7 +75,6 @@ public Installer(Stream inputStream, string physicalSitePath, bool loadManifest)
8275 /// <param name="physicalSitePath">The physical path to the root of the site.</param>
8376 /// <param name="loadManifest">Flag that determines whether the manifest will be loaded.</param>
8477 /// <param name="deleteTemp">Whether delete the temp folder.</param>
85- /// -----------------------------------------------------------------------------
8678 public Installer ( Stream inputStream , string physicalSitePath , bool loadManifest , bool deleteTemp )
8779 {
8880 this . Packages = new SortedList < int , PackageInstaller > ( ) ;
@@ -99,14 +91,12 @@ public Installer(Stream inputStream, string physicalSitePath, bool loadManifest,
9991 }
10092 }
10193
102- /// -----------------------------------------------------------------------------
10394 /// <summary>
10495 /// Initializes a new instance of the <see cref="Installer"/> class.
10596 /// This Constructor creates a new Installer instance from a PackageInfo object.
10697 /// </summary>
10798 /// <param name="package">The PackageInfo instance.</param>
10899 /// <param name="physicalSitePath">The physical path to the root of the site.</param>
109- /// -----------------------------------------------------------------------------
110100 public Installer ( PackageInfo package , string physicalSitePath )
111101 {
112102 this . Packages = new SortedList < int , PackageInstaller > ( ) ;
@@ -118,9 +108,9 @@ public Installer(PackageInfo package, string physicalSitePath)
118108 /// <summary>
119109 /// Initializes a new instance of the <see cref="Installer"/> class.
120110 /// </summary>
121- /// <param name="manifest"></param>
122- /// <param name="physicalSitePath"></param>
123- /// <param name="loadManifest"></param>
111+ /// <param name="manifest">The install package manifest. </param>
112+ /// <param name="physicalSitePath">The physical path to the site. </param>
113+ /// <param name="loadManifest">A value indicating whether to load the manifest. </param>
124114 public Installer ( string manifest , string physicalSitePath , bool loadManifest )
125115 {
126116 this . Packages = new SortedList < int , PackageInstaller > ( ) ;
@@ -131,12 +121,10 @@ public Installer(string manifest, string physicalSitePath, bool loadManifest)
131121 }
132122 }
133123
134- /// -----------------------------------------------------------------------------
135124 /// <summary>
136125 /// Gets a value indicating whether gets whether the associated InstallerInfo is valid.
137126 /// </summary>
138127 /// <value>True - if valid, False if not.</value>
139- /// -----------------------------------------------------------------------------
140128 public bool IsValid
141129 {
142130 get
@@ -145,12 +133,10 @@ public bool IsValid
145133 }
146134 }
147135
148- /// -----------------------------------------------------------------------------
149136 /// <summary>
150- /// Gets.
137+ /// Gets the installation temporary folder path .
151138 /// </summary>
152- /// <value>A Dictionary(Of String, PackageInstaller).</value>
153- /// -----------------------------------------------------------------------------
139+ /// <value>The installation temporory folder path.</value>
154140 public string TempInstallFolder
155141 {
156142 get
@@ -159,22 +145,24 @@ public string TempInstallFolder
159145 }
160146 }
161147
162- /// -----------------------------------------------------------------------------
163148 /// <summary>
164149 /// Gets the associated InstallerInfo object.
165150 /// </summary>
166151 /// <value>An InstallerInfo.</value>
167- /// -----------------------------------------------------------------------------
168152 public InstallerInfo InstallerInfo { get ; private set ; }
169153
170- /// -----------------------------------------------------------------------------
171154 /// <summary>
172155 /// Gets a SortedList of Packages that are included in the Package Zip.
173156 /// </summary>
174157 /// <value>A SortedList(Of Integer, PackageInstaller).</value>
175- /// -----------------------------------------------------------------------------
176158 public SortedList < int , PackageInstaller > Packages { get ; private set ; }
177159
160+ /// <summary>
161+ /// Converts legacy manifest navigation to support old manifest format.
162+ /// </summary>
163+ /// <param name="rootNav">The root xml navigation path.</param>
164+ /// <param name="info"><see cref="InstallerInfo"/>.</param>
165+ /// <returns>A new converted <see cref="XPathNavigator"/> that works with current manifest schema.</returns>
178166 public static XPathNavigator ConvertLegacyNavigator ( XPathNavigator rootNav , InstallerInfo info )
179167 {
180168 XPathNavigator nav = null ;
@@ -248,6 +236,9 @@ public static XPathNavigator ConvertLegacyNavigator(XPathNavigator rootNav, Inst
248236 return nav ;
249237 }
250238
239+ /// <summary>
240+ /// Deletes the package temporary folder.
241+ /// </summary>
251242 public void DeleteTempFolder ( )
252243 {
253244 try
@@ -264,16 +255,14 @@ public void DeleteTempFolder()
264255 }
265256 }
266257
267- /// -----------------------------------------------------------------------------
268258 /// <summary>
269259 /// The Install method installs the feature.
270260 /// </summary>
271- /// <returns></returns>
272- /// -----------------------------------------------------------------------------
261+ /// <returns>A value indicating whether the install succeeded.</returns>
273262 public bool Install ( )
274263 {
275264 this . InstallerInfo . Log . StartJob ( Util . INSTALL_Start ) ;
276- bool bStatus = true ;
265+ bool succeeded = true ;
277266 try
278267 {
279268 bool clearClientCache = false ;
@@ -287,7 +276,7 @@ public bool Install()
287276 catch ( Exception ex )
288277 {
289278 this . InstallerInfo . Log . AddFailure ( ex ) ;
290- bStatus = false ;
279+ succeeded = false ;
291280 }
292281 finally
293282 {
@@ -307,14 +296,14 @@ public bool Install()
307296 else
308297 {
309298 this . InstallerInfo . Log . EndJob ( Util . INSTALL_Failed ) ;
310- bStatus = false ;
299+ succeeded = false ;
311300 }
312301
313302 // log installation event
314303 this . LogInstallEvent ( "Package" , "Install" ) ;
315304
316305 // when the installer initialized by file stream, we need save the file stream into backup folder.
317- if ( this . inputStream != null && bStatus && this . Packages . Any ( ) )
306+ if ( this . inputStream != null && succeeded && this . Packages . Any ( ) )
318307 {
319308 Task . Run ( ( ) =>
320309 {
@@ -331,14 +320,13 @@ public bool Install()
331320 Config . Touch ( ) ;
332321 }
333322
334- return bStatus ;
323+ return succeeded ;
335324 }
336325
337- /// -----------------------------------------------------------------------------
338326 /// <summary>
339327 /// The ReadManifest method reads the manifest file and parses it into packages.
340328 /// </summary>
341- /// -----------------------------------------------------------------------------
329+ /// <param name="deleteTemp">A value indicating whether to delete the temporary folder.</param>
342330 public void ReadManifest ( bool deleteTemp )
343331 {
344332 this . InstallerInfo . Log . StartJob ( Util . DNN_Reading ) ;
@@ -353,19 +341,15 @@ public void ReadManifest(bool deleteTemp)
353341 }
354342 else if ( deleteTemp )
355343 {
356- // Delete Temp Folder
357344 this . DeleteTempFolder ( ) ;
358345 }
359346 }
360347
361- /// -----------------------------------------------------------------------------
362348 /// <summary>
363349 /// The UnInstall method uninstalls the feature.
364350 /// </summary>
365- /// <param name="deleteFiles">A flag that indicates whether the files should be
366- /// deleted.</param>
367- /// <returns></returns>
368- /// -----------------------------------------------------------------------------
351+ /// <param name="deleteFiles">A flag that indicates whether the files should be deleted.</param>
352+ /// <returns>A value indicating whether the uninstall succeeded.</returns>
369353 public bool UnInstall ( bool deleteFiles )
370354 {
371355 this . InstallerInfo . Log . StartJob ( Util . UNINSTALL_Start ) ;
@@ -393,19 +377,15 @@ public bool UnInstall(bool deleteFiles)
393377 return true ;
394378 }
395379
396- /// -----------------------------------------------------------------------------
397380 /// <summary>
398381 /// The InstallPackages method installs the packages.
399382 /// </summary>
400- /// -----------------------------------------------------------------------------
401383 private void InstallPackages ( ref bool clearClientCache )
402384 {
403- // Iterate through all the Packages
404385 for ( int index = 0 ; index <= this . Packages . Count - 1 ; index ++ )
405386 {
406387 PackageInstaller installer = this . Packages . Values [ index ] ;
407388
408- // Check if package is valid
409389 if ( installer . Package . IsValid )
410390 {
411391 if ( installer . Package . InstallerInfo . PackageID > Null . NullInteger || installer . Package . InstallerInfo . RepairInstall )
@@ -431,13 +411,11 @@ private void InstallPackages(ref bool clearClientCache)
431411 }
432412 }
433413
434- /// -----------------------------------------------------------------------------
435414 /// <summary>
436415 /// Logs the Install event to the Event Log.
437416 /// </summary>
438417 /// <param name="package">The name of the package.</param>
439418 /// <param name="eventType">Event Type.</param>
440- /// -----------------------------------------------------------------------------
441419 private void LogInstallEvent ( string package , string eventType )
442420 {
443421 try
@@ -462,11 +440,9 @@ private void LogInstallEvent(string package, string eventType)
462440 }
463441 }
464442
465- /// -----------------------------------------------------------------------------
466443 /// <summary>
467444 /// The ProcessPackages method processes the packages nodes in the manifest.
468445 /// </summary>
469- /// -----------------------------------------------------------------------------
470446 private void ProcessPackages ( XPathNavigator rootNav )
471447 {
472448 // Parse the package nodes
0 commit comments