/// <summary> /// Removes the non existing files data. /// </summary> protected virtual void RemoveNonExistingData() { SystemManager.RunWithElevatedPrivilegeDelegate elevDelegate = (p) => { var fileMonitorDataManager = FileMonitorDataManager.GetManager(); // finds all records containing file paths which no longer exists var nonExistingFilesData = fileMonitorDataManager.GetFilesData().Select(fd => fd.FilePath).ToArray() .Where(f => !HostingEnvironment.VirtualPathProvider.FileExists(f)); if (nonExistingFilesData != null && nonExistingFilesData.Any()) { // remove all records in the lists foreach (var filePath in nonExistingFilesData) { var resourceDirectoryTree = VirtualPathUtility.GetDirectory(filePath).Split('/'); if (resourceDirectoryTree.Length >= 2) { var packageFolderIdx = Array.IndexOf(resourceDirectoryTree, PackageManager.PackagesFolder); string packageName = packageFolderIdx > 0 && packageFolderIdx + 1 < resourceDirectoryTree.Length ? resourceDirectoryTree[packageFolderIdx + 1] : string.Empty; string resourceFolder = resourceDirectoryTree[resourceDirectoryTree.Length - 2]; IFileManager resourceFilesManager = this.GetResourceFileManager(resourceFolder, filePath); resourceFilesManager.FileDeleted(filePath, packageName); } } } }; SystemManager.RunWithElevatedPrivilege(elevDelegate); }
/// <summary> /// Called after the properties of this instance have been initialized. /// Load default values here. /// </summary> protected override void OnPropertiesInitialized() { base.OnPropertiesInitialized(); SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); }
/// <summary> /// Removes the non existing files data. /// </summary> protected virtual void RemoveNonExistingData() { SystemManager.RunWithElevatedPrivilegeDelegate elevDelegate = (p) => { var fileMonitorDataManager = FileMonitorDataManager.GetManager(); // finds all records containing file paths which no longer exists var nonExistingFilesData = fileMonitorDataManager.GetFilesData().Select(fd => fd.FilePath).ToArray() .Where(f => !File.Exists(f)); if (nonExistingFilesData != null && nonExistingFilesData.Any()) { // remove all records in the lists foreach (var filePath in nonExistingFilesData) { var resourceDirectoryTree = VirtualPathUtility.GetDirectory(filePath).Split('/'); if (resourceDirectoryTree.Length >= 2) { string resourceFolder = resourceDirectoryTree[resourceDirectoryTree.Length - 2]; IFileManager resourceFilesManager = this.GetResourceFileManager(resourceFolder); resourceFilesManager.FileDeleted(filePath); } } } }; SystemManager.RunWithElevatedPrivilege(elevDelegate); }
/// <summary> /// Removes the non existing files data. /// </summary> private void RemoveNonExistingData() { SystemManager.RunWithElevatedPrivilegeDelegate elevDelegate = (p) => { var fileMonitorDataManager = FileMonitorDataManager.GetManager(); //finds all records containing file paths which no longer exists var nonExistingFilesData = fileMonitorDataManager.GetFilesData().Select(fd => fd.FilePath).ToArray() .Where(f => !File.Exists(f)); if (nonExistingFilesData != null && nonExistingFilesData.Any()) { //remove all records in the lists foreach (var filePath in nonExistingFilesData) { //converting the file path to a virtual file path var virtualFilePath = this.ConvertToVirtualPath(filePath); //get the directory tree part from the virtal path var resourceDirectoryTree = VirtualPathUtility.GetDirectory(virtualFilePath).Split('/'); //the resource folder is actualy the file parent folder string resourceFolder = resourceDirectoryTree[resourceDirectoryTree.Length - 2]; //get the resource file manager depending on its type IFileManager resourceFilesManager = this.GetResourceFileManager(resourceFolder); resourceFilesManager.FileDeleted(filePath); } } }; SystemManager.RunWithElevatedPrivilege(elevDelegate); }
void MigrateDataBtnClick(object sender, EventArgs e) { this.migrateDataBtn.Enabled = false; StartTimer(); SystemManager.RunWithElevatedPrivilegeDelegate doWork = new SystemManager.RunWithElevatedPrivilegeDelegate(this.Migrate); SystemManager.BackgroundTasksService.EnqueueTask(() => SystemManager.RunWithElevatedPrivilege(doWork)); }
private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "Bootstrapped") { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args) { if (args.CommandName == "Bootstrapped") { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
private void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e) { if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(this.CreateSample); SystemManager.RunWithElevatedPrivilege(worker); } }
private void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(this.CreateSample); SystemManager.RunWithElevatedPrivilege(worker); } }
public ActionResult SaveBug(BugModel bug) { Guid projectId = new Guid(this.ControllerContext.RouteData.Values["id"].ToString()); SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(SaveBugWorker); SystemManager.RunWithElevatedPrivilege(worker, new object[] { bug, projectId }); return this.RedirectToAction("Index", "Bug", new { id = projectId }); }
void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule <LocationsModule.LocationsModule>("Locations", "A content-based module for maintaining a list of locations, such as office addresses, branch locations, etc."); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule <EventLoggerModule>("EventLogger", "This sample describes how to log Sitefinity events in your website.."); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule <ProductsModule>("ProductsCatalog", "This is a module that provides product listings built on top of a native content-based module in Sitefinity. Content-based modules themselves are based on Generic Content and reuse much of the functionality available there. This is the most comprehensive example of a content-based module that features all built-in functionality of a native Sitefinity module."); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule <TestimonialsModule>("Testimonials", "A simple user-control based module for maintaining a list of testimonials that can be sumitted by users."); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(this.CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule <TemplateImporterModule>("Template Importer", "This module imports templates from template builder."); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule <JobsModule>("Jobs", "This module presents showcases how to create a jobs module that allows users to submit jobs applications."); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { var worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule<ProductsModule>("ProductsCatalog", "This is a module that provides product listings built on top of a native content-based module in Sitefinity. Content-based modules themselves are based on Generic Content and reuse much of the functionality available there. This is the most comprehensive example of a content-based module that features all built-in functionality of a native Sitefinity module."); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule <SiteMapModule>("SiteMap", "This sample presents showcases how to create a sitemap module which generates a search engine friendly sitemap.xml for your site."); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
private void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "RegisterRoutes") { SampleUtilities.RegisterModule <AkismetModule.AkismetModule>("Akismet", "Showcases Forums Akismet integration"); } if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped")) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(this.CreateSample); SystemManager.RunWithElevatedPrivilege(worker); } }
/// <summary> /// Takes appropriate actions based on the resource file type /// </summary> /// <param name="filePath">The file path.</param> /// <param name="changeType">Type of the change.</param> /// <param name="fileData">The file data.</param> /// <param name="oldFilePath">The old file path.</param> protected virtual void FileChanged(string filePath, FileChangeType changeType, string oldFilePath = "", FileData fileData = null) { var virtualFilePath = this.ConvertToVirtualPath(filePath); var oldFileVirtualPath = this.ConvertToVirtualPath(oldFilePath); var watchedDirInfo = this.WatchedFoldersAndPackages.FirstOrDefault(dirInfo => virtualFilePath.StartsWith(dirInfo.Path, StringComparison.Ordinal)); if (watchedDirInfo == null) { return; } string packageName = string.Empty; var resourceDirecotryPath = VirtualPathUtility.GetDirectory(virtualFilePath); var resourceDirectoryTree = resourceDirecotryPath.Split('/'); if (resourceDirectoryTree.Length < 3) { return; } if (watchedDirInfo.IsPackage) { packageName = resourceDirectoryTree[2]; } string resourceFolder = resourceDirectoryTree[resourceDirectoryTree.Length - 2]; var fileName = virtualFilePath.Replace(resourceDirecotryPath, string.Empty); SystemManager.RunWithElevatedPrivilegeDelegate elevDelegate = this.GetFileChangedDelegate(new FileChangedDelegateArguments() { FilePath = virtualFilePath, ChangeType = changeType, OldFilePath = oldFileVirtualPath, PackageName = packageName, ResourceFolder = resourceFolder, FileName = fileName, FileData = fileData }); SystemManager.RunWithElevatedPrivilege(elevDelegate); }
void SystemManager_ApplicationStart(object sender, EventArgs e) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(this.CreateSearchPipes); SystemManager.RunWithElevatedPrivilege(worker); }
/// <summary> /// Handles the Initialized event of the Bootstrapper control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ExecutedEventArgs"/> instance containing the event data.</param> private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e) { if (e.CommandName == "Bootstrapped") { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); } }
/// <summary> /// Takes appropriate actions based on the resource file type /// </summary> /// <param name="path">The file path.</param> /// <param name="changeType">Type of the change.</param> /// <param name="oldFilePath">The old file path.</param> protected virtual void FileChanged(string filePath, Telerik.Sitefinity.Frontend.FilesMonitoring.FileChangeTypes changeType, string oldFilePath = "") { var virtualFilePath = this.ConvertToVirtualPath(filePath); string packageName = string.Empty; var fileName = VirtualPathUtility.GetFileName(virtualFilePath); //get the directory tree part from the virtal path var resourceDirectoryTree = VirtualPathUtility.GetDirectory(virtualFilePath).Split('/'); //the resource folder is actualy the file parent folder string resourceFolder = resourceDirectoryTree[resourceDirectoryTree.Length - 2]; string oldFileName = string.Empty; if (changeType == FileChangeTypes.Renamed) { var oldVirtualFilePath = filePath.Substring(HostingEnvironment.ApplicationPhysicalPath.Length - 1).Replace('\\', '/'); oldFileName = VirtualPathUtility.GetFileName(oldVirtualFilePath); } //get the watched directory info from the list var watchedDirInfos = this.WatchedFoldersAndPackages.Where(dirInfo => virtualFilePath.StartsWith(dirInfo.Key, StringComparison.InvariantCultureIgnoreCase)); //continue only if the directory is in the list if (watchedDirInfos.Count() > 0) { var watchedDirInfo = watchedDirInfos.First(); //if the watched directory information shows that this a package directory //extract the package name out of the virtual path if (watchedDirInfo.Value) { packageName = resourceDirectoryTree[2]; } SystemManager.RunWithElevatedPrivilegeDelegate elevDelegate = (p) => { //get the resource file manager depending on its type IFileManager resourceFilesManager = this.GetResourceFileManager(resourceFolder); if (resourceFilesManager != null) { switch (changeType) { case Telerik.Sitefinity.Frontend.FilesMonitoring.FileChangeTypes.Created: resourceFilesManager.FileAdded(fileName, filePath, packageName); break; case Telerik.Sitefinity.Frontend.FilesMonitoring.FileChangeTypes.Deleted: resourceFilesManager.FileDeleted(filePath); break; case Telerik.Sitefinity.Frontend.FilesMonitoring.FileChangeTypes.Renamed: resourceFilesManager.FileRenamed(fileName, oldFileName, filePath, oldFilePath, packageName); break; } } }; SystemManager.RunWithElevatedPrivilege(elevDelegate); } }
private static void SystemManager_ApplicationStart(object sender, EventArgs e) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); }
protected void SystemManager_ApplicationStart(object sender, EventArgs e) { SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker); SystemManager.RunWithElevatedPrivilege(worker); }