private void PerformAction(object locobj, SPFeatureCollection spFeatureCollection, Feature feature) { try { if (_action == Action.Activating) { if (!(spFeatureCollection[feature.Id] is SPFeature)) { ++ActivationAttempts; spFeatureCollection.Add(feature.Id); if ((spFeatureCollection[feature.Id] is SPFeature)) { _featureDb.RecordFeatureActivation(locobj, feature.Id); ++Activations; } } } else { if ((spFeatureCollection[feature.Id] is SPFeature)) { ++ActivationAttempts; spFeatureCollection.Remove(feature.Id); if (!(spFeatureCollection[feature.Id] is SPFeature)) { _featureDb.RecordFeatureDeactivation(locobj, feature.Id); ++Activations; } } } } catch (Exception exc) { LogException(exc, string.Format( "{0} feature {1} on {2}: {3}", _action, feature.Id, feature.Scope, LocationManager.SafeDescribeObject(locobj) )); } }
private void EnumerateWebAppSites(SPWebApplication webApp) { foreach (SPSite site in webApp.Sites) { using (site) { // check site try { CheckSite(site); if (stopAtFirstHit && activationsFound > 0) { return; } } catch (Exception exc) { Log.Error( "Exception checking site: " + LocationManager.SafeGetSiteAbsoluteUrl(site), exc ); } // check subwebs try { EnumerateSiteWebs(site); if (stopAtFirstHit && activationsFound > 0) { return; } } catch (Exception exc) { Log.Error( "Exception enumerating webs of site: " + LocationManager.SafeGetSiteAbsoluteUrl(site), exc ); } } } }
private void EnumerateSiteWebs(SPSite site) { foreach (SPWeb web in site.AllWebs) { using (web) { try { // check web CheckWeb(web); if (stopAtFirstHit && activationsFound > 0) { return; } } catch (Exception exc) { OnException(exc, "Exception checking web: " + LocationManager.SafeGetWebUrl(web) ); } } } }
/// <summary> /// Record that a feature has been deactivated /// </summary> public void RecordFeatureDeactivation(object locobj, Guid featureId) { FeatureParent location = LocationManager.GetLocation(locobj); RecordFeatureDeactivationAtLocation(location, featureId); }
private void ReportWebAppFeature(Guid featureId, bool faulty, SPWebApplication webApp) { ++activationsFound; ReportFeature(webApp, faulty, SPFeatureScope.WebApplication, featureId, LocationManager.GetWebAppUrl(webApp), webApp.Name); }
/// <summary> /// Record that a feature has been activated (at location specified by object) /// </summary> public void RecordFeatureActivation(object locobj, Guid featureId) { Location location = LocationManager.GetLocation(locobj); }