Removes Package repository config setting and related unnecessary code
This commit is contained in:
@@ -5,4 +5,6 @@
|
||||
</content>
|
||||
|
||||
<webservices xdt:Transform="Remove" />
|
||||
|
||||
<repositories xdt:Transform="Remove" />
|
||||
</settings>
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
|
||||
public interface IRepositoriesSection : IUmbracoConfigurationSection
|
||||
{
|
||||
IEnumerable<IRepository> Repositories { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public interface IRepository
|
||||
{
|
||||
string Name { get; }
|
||||
Guid Id { get; }
|
||||
string RepositoryUrl { get; }
|
||||
string WebServiceUrl { get; }
|
||||
bool HasCustomWebServiceUrl { get; }
|
||||
string RestApiUrl { get; }
|
||||
}
|
||||
}
|
||||
@@ -24,9 +24,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
IScheduledTasksSection ScheduledTasks { get; }
|
||||
|
||||
IDistributedCallSection DistributedCall { get; }
|
||||
|
||||
IRepositoriesSection PackageRepositories { get; }
|
||||
|
||||
|
||||
IProvidersSection Providers { get; }
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
@@ -37,4 +35,4 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
IScriptingSection Scripting { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class RepositoriesCollection : ConfigurationElementCollection, IEnumerable<IRepository>
|
||||
{
|
||||
internal void Add(RepositoryElement item)
|
||||
{
|
||||
BaseAdd(item);
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new RepositoryElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((RepositoryElement)element).Id;
|
||||
}
|
||||
|
||||
IEnumerator<IRepository> IEnumerable<IRepository>.GetEnumerator()
|
||||
{
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
yield return BaseGet(i) as IRepository;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class RepositoriesElement : ConfigurationElement, IRepositoriesSection
|
||||
{
|
||||
|
||||
[ConfigurationCollection(typeof(RepositoriesCollection), AddItemName = "repository")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
internal RepositoriesCollection Repositories
|
||||
{
|
||||
get { return (RepositoriesCollection) base[""]; }
|
||||
set { base[""] = value; }
|
||||
}
|
||||
|
||||
IEnumerable<IRepository> IRepositoriesSection.Repositories
|
||||
{
|
||||
get { return Repositories; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public static class RepositoryConfigExtensions
|
||||
{
|
||||
//Our package repo
|
||||
private static readonly Guid RepoGuid = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66");
|
||||
|
||||
public static IRepository GetDefault(this IRepositoriesSection repos)
|
||||
{
|
||||
var found = repos.Repositories.FirstOrDefault(x => x.Id == RepoGuid);
|
||||
if (found == null)
|
||||
throw new InvalidOperationException("No default package repository found with id " + RepoGuid);
|
||||
return found;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class RepositoryElement : ConfigurationElement, IRepository
|
||||
{
|
||||
[ConfigurationProperty("name", IsRequired = true)]
|
||||
public string Name
|
||||
{
|
||||
get { return (string)base["name"]; }
|
||||
set { base["name"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("guid", IsRequired = true)]
|
||||
public Guid Id
|
||||
{
|
||||
get { return (Guid)base["guid"]; }
|
||||
set { base["guid"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("repositoryurl", DefaultValue = "http://packages.umbraco.org")]
|
||||
public string RepositoryUrl
|
||||
{
|
||||
get { return (string)base["repositoryurl"]; }
|
||||
set { base["repositoryurl"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("webserviceurl", DefaultValue = "/umbraco/webservices/api/repository.asmx")]
|
||||
public string WebServiceUrl
|
||||
{
|
||||
get { return (string)base["webserviceurl"]; }
|
||||
set { base["webserviceurl"] = value; }
|
||||
}
|
||||
|
||||
public bool HasCustomWebServiceUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
var prop = Properties["webserviceurl"];
|
||||
return (string) prop.DefaultValue != (string) this[prop];
|
||||
}
|
||||
}
|
||||
|
||||
[ConfigurationProperty("restapiurl", DefaultValue = "https://our.umbraco.org/webapi/packages/v1")]
|
||||
public string RestApiUrl
|
||||
{
|
||||
get { return (string)base["restapiurl"]; }
|
||||
set { base["restapiurl"] = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -67,50 +67,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
get { return (DistributedCallElement)this["distributedCall"]; }
|
||||
}
|
||||
|
||||
private RepositoriesElement _defaultRepositories;
|
||||
|
||||
[ConfigurationProperty("repositories")]
|
||||
internal RepositoriesElement PackageRepositories
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
if (_defaultRepositories != null)
|
||||
{
|
||||
return _defaultRepositories;
|
||||
}
|
||||
|
||||
//here we need to check if this element is defined, if it is not then we'll setup the defaults
|
||||
var prop = Properties["repositories"];
|
||||
var repos = this[prop] as ConfigurationElement;
|
||||
if (repos != null && repos.ElementInformation.IsPresent == false)
|
||||
{
|
||||
var collection = new RepositoriesCollection
|
||||
{
|
||||
new RepositoryElement() {Name = "Umbraco package Repository", Id = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66")}
|
||||
};
|
||||
|
||||
|
||||
_defaultRepositories = new RepositoriesElement()
|
||||
{
|
||||
Repositories = collection
|
||||
};
|
||||
|
||||
return _defaultRepositories;
|
||||
}
|
||||
|
||||
//now we need to ensure there is *always* our umbraco repo! its hard coded in the codebase!
|
||||
var reposElement = (RepositoriesElement)base["repositories"];
|
||||
if (reposElement.Repositories.All(x => x.Id != new Guid("65194810-1f85-11dd-bd0b-0800200c9a66")))
|
||||
{
|
||||
reposElement.Repositories.Add(new RepositoryElement() { Name = "Umbraco package Repository", Id = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66") });
|
||||
}
|
||||
|
||||
return reposElement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[ConfigurationProperty("providers")]
|
||||
internal ProvidersElement Providers
|
||||
{
|
||||
@@ -185,11 +142,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
get { return DistributedCall; }
|
||||
}
|
||||
|
||||
IRepositoriesSection IUmbracoSettingsSection.PackageRepositories
|
||||
{
|
||||
get { return PackageRepositories; }
|
||||
}
|
||||
|
||||
IProvidersSection IUmbracoSettingsSection.Providers
|
||||
{
|
||||
get { return Providers; }
|
||||
|
||||
15
src/Umbraco.Core/Constants-PackageRepository.cs
Normal file
15
src/Umbraco.Core/Constants-PackageRepository.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
public static partial class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the constants used for the Umbraco package repository
|
||||
/// </summary>
|
||||
public static class PackageRepository
|
||||
{
|
||||
public const string RestApiBaseUrl = "https://our.umbraco.org/webapi/packages/v1";
|
||||
public const string DefaultRepositoryName = "Umbraco package Repository";
|
||||
public const string DefaultRepositoryId = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,13 +89,11 @@ namespace Umbraco.Core.Services
|
||||
/// <returns></returns>
|
||||
public string FetchPackageFile(Guid packageId, Version umbracoVersion, int userId)
|
||||
{
|
||||
var packageRepo = UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault();
|
||||
|
||||
using (var httpClient = new HttpClient())
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
{
|
||||
//includeHidden = true because we don't care if it's hidden we want to get the file regardless
|
||||
var url = string.Format("{0}/{1}?version={2}&includeHidden=true&asFile=true", packageRepo.RestApiUrl, packageId, umbracoVersion.ToString(3));
|
||||
var url = string.Format("{0}/{1}?version={2}&includeHidden=true&asFile=true", Constants.PackageRepository.RestApiBaseUrl, packageId, umbracoVersion.ToString(3));
|
||||
byte[] bytes;
|
||||
try
|
||||
{
|
||||
@@ -124,7 +122,7 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.PackagerInstall, string.Format("Package {0} fetched from {1}", packageId, packageRepo.Id), userId, -1);
|
||||
Audit(uow, AuditType.PackagerInstall, string.Format("Package {0} fetched from {1}", packageId, Constants.PackageRepository.DefaultRepositoryId), userId, -1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,8 +281,6 @@
|
||||
<Compile Include="Configuration\UmbracoSettings\INotDynamicXmlDocument.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IProvidersSection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IRazorStaticMapping.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IRepositoriesSection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IRepository.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IRequestHandlerSection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IScheduledTask.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\IScheduledTasksSection.cs" />
|
||||
@@ -308,10 +306,6 @@
|
||||
<Compile Include="Configuration\UmbracoSettings\RazorElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RazorStaticMappingCollection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RazorStaticMappingElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoriesCollection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoriesElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoryConfigExtensions.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoryElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RequestHandlerElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\ScheduledTaskElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\ScheduledTasksCollection.cs" />
|
||||
@@ -1606,6 +1600,9 @@
|
||||
<Compile Include="Constants-Packaging.cs">
|
||||
<DependentUpon>Constants.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Constants-PackageRepository.cs">
|
||||
<DependentUpon>Constants.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Constants-ObjectTypes.cs">
|
||||
<DependentUpon>Constants.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class PackageRepositoriesElementDefaultTests : PackageRepositoriesElementTests
|
||||
{
|
||||
protected override bool TestingDefaults
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public override void Repositories()
|
||||
{
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.Count() == 1);
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66"));
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Name == "Umbraco package Repository");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class PackageRepositoriesElementTests : UmbracoSettingsTests
|
||||
{
|
||||
[Test]
|
||||
public virtual void Repositories()
|
||||
{
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.Count() == 2);
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66"));
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Name == "Umbraco package Repository");
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).HasCustomWebServiceUrl == false);
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).WebServiceUrl == "/umbraco/webservices/api/repository.asmx");
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).RepositoryUrl == "http://packages.umbraco.org");
|
||||
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).Id == Guid.Parse("163245E0-CD22-44B6-841A-1B9B9D2E955F"));
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).Name == "Test Repo");
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).HasCustomWebServiceUrl == false);
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).WebServiceUrl == "/umbraco/webservices/api/repository.asmx");
|
||||
Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).RepositoryUrl == "http://packages.umbraco.org");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,6 @@ namespace Umbraco.Tests.TestHelpers
|
||||
var logging = new Mock<ILoggingSection>();
|
||||
var tasks = new Mock<IScheduledTasksSection>();
|
||||
var distCall = new Mock<IDistributedCallSection>();
|
||||
var repos = new Mock<IRepositoriesSection>();
|
||||
var providers = new Mock<IProvidersSection>();
|
||||
|
||||
var routing = new Mock<IWebRoutingSection>();
|
||||
@@ -53,7 +52,6 @@ namespace Umbraco.Tests.TestHelpers
|
||||
settings.Setup(x => x.Logging).Returns(logging.Object);
|
||||
settings.Setup(x => x.ScheduledTasks).Returns(tasks.Object);
|
||||
settings.Setup(x => x.DistributedCall).Returns(distCall.Object);
|
||||
settings.Setup(x => x.PackageRepositories).Returns(repos.Object);
|
||||
settings.Setup(x => x.Providers).Returns(providers.Object);
|
||||
|
||||
settings.Setup(x => x.WebRouting).Returns(routing.Object);
|
||||
|
||||
@@ -361,8 +361,6 @@
|
||||
<Compile Include="Configurations\UmbracoSettings\DistributedCallElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\LoggingElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\LoggingElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\PackageRepositoriesElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\PackageRepositoriesElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\ProvidersElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\ProvidersElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\RequestHandlerElementDefaultTests.cs" />
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<RestorePackages>true</RestorePackages>
|
||||
<MvcProjectUpgradeChecked>true</MvcProjectUpgradeChecked>
|
||||
<UseGlobalApplicationHostFile />
|
||||
<Use64BitIISExpress />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
@@ -492,7 +493,6 @@
|
||||
<Content Include="Umbraco\Config\Lang\tr.xml" />
|
||||
<Content Include="Umbraco\Config\Lang\zh_tw.xml" />
|
||||
<Content Include="Umbraco\create.aspx" />
|
||||
<Content Include="Umbraco\Developer\Packages\installer.aspx" />
|
||||
<Content Include="Umbraco\Logout.aspx" />
|
||||
<Content Include="Umbraco\umbraco.aspx" />
|
||||
<Content Include="Umbraco_Client\Application\JQuery\jquery.unobtrusive-ajax.min.js" />
|
||||
@@ -1037,7 +1037,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\"
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>7110</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:7110</IISUrl>
|
||||
<IISUrl>http://localhost:3110</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
|
||||
@@ -279,12 +279,6 @@
|
||||
</servers>
|
||||
</distributedCall>
|
||||
|
||||
<!-- Configuration for repositories -->
|
||||
<!-- Add or remove repositories here. You will need the repository's unique key to be able to connect to it.-->
|
||||
<repositories>
|
||||
<repository name="Umbraco package Repository" guid="65194810-1f85-11dd-bd0b-0800200c9a66" />
|
||||
</repositories>
|
||||
|
||||
<providers>
|
||||
<users>
|
||||
<!-- if you wish to use your own membershipprovider for authenticating to the umbraco back office -->
|
||||
@@ -326,4 +320,4 @@
|
||||
umbracoApplicationUrl="">
|
||||
</web.routing>
|
||||
|
||||
</settings>
|
||||
</settings>
|
||||
|
||||
@@ -1,346 +0,0 @@
|
||||
<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master"
|
||||
AutoEventWireup="True" Inherits="umbraco.presentation.developer.packages.Installer"
|
||||
Trace="false" ValidateRequest="false" %>
|
||||
<%@ Import Namespace="umbraco" %>
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="head" runat="server">
|
||||
|
||||
<script type="text/javascript">
|
||||
function enableButton() {
|
||||
|
||||
var f = jQuery("#<%= file1.ClientID %>");
|
||||
var b = jQuery("#<%= ButtonLoadPackage.ClientID %>");
|
||||
var cb = jQuery("#cb");
|
||||
|
||||
|
||||
if (f.val() != "" && cb.attr("checked"))
|
||||
b.attr("disabled", false);
|
||||
else
|
||||
b.attr("disabled", true);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.toggle-report').click(function () {
|
||||
$(this).next().toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
<cc1:UmbracoPanel ID="Panel1" Text="Install package" runat="server" Width="496px"
|
||||
Height="584px">
|
||||
|
||||
|
||||
<cc1:Feedback ID="fb" Style="margin-top: 7px;" runat="server" />
|
||||
<cc1:Pane ID="pane_upload" runat="server" Text="Install from local package file">
|
||||
|
||||
<cc1:PropertyPanel runat="server" Text="">
|
||||
<div class="alert alert-warning">
|
||||
<h4>
|
||||
Only install packages from sources you know and trust!</h4>
|
||||
<p>
|
||||
When installing an Umbraco package you should use the same caution as when you install
|
||||
an application on your computer.</p>
|
||||
<p>
|
||||
A malicious package could damage your Umbraco installation just like a malicious
|
||||
application can damage your computer.
|
||||
</p>
|
||||
<p>
|
||||
It is <strong>recommended</strong> to install from the official Umbraco package
|
||||
repository or a custom repository whenever it's possible.
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" id="cb" onchange="enableButton();" />
|
||||
<label for="cb" style="font-weight: bold">
|
||||
I understand the security risks associated with installing a local package</label>
|
||||
</p>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel9" Text="Choose a file" runat="server">
|
||||
<p>
|
||||
<input id="file1" type="file" class="btn" name="file1" onchange="enableButton();"
|
||||
runat="server" />
|
||||
<br />
|
||||
|
||||
<small>
|
||||
<%= umbraco.ui.Text("packager", "chooseLocalPackageText") %>
|
||||
</small>
|
||||
</p>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel runat="server" Text=" ">
|
||||
<asp:Button ID="ButtonLoadPackage" runat="server" Enabled="false" Text="Load Package"
|
||||
OnClick="uploadFile"></asp:Button>
|
||||
<div id="loadingbar" style="display: none;">
|
||||
<div class="umb-loader-wrapper">
|
||||
<cc1:ProgressBar ID="progbar1" runat="server" Title="Please wait..." />
|
||||
</div>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
<cc1:Pane ID="pane_authenticate" runat="server" Visible="false" Text="Repository authentication">
|
||||
<cc1:PropertyPanel runat="server">
|
||||
<div class="alert alert-warning">
|
||||
<p>
|
||||
This repository requires authentication before you can download any packages from
|
||||
it.<br />
|
||||
Please enter email and password to login.
|
||||
</p>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel runat="server" Text="Email">
|
||||
<asp:TextBox ID="tb_email" runat="server" /></cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="PropertyPanel1" runat="server" Text="Password">
|
||||
<asp:TextBox ID="tb_password" TextMode="Password" runat="server" /></cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="PropertyPanel2" runat="server">
|
||||
<asp:Button ID="Button1" OnClick="fetchProtectedPackage" Text="Login" runat="server" /></cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
|
||||
<asp:Panel ID="pane_acceptLicense" runat="server" Visible="false">
|
||||
|
||||
<cc1:Pane ID="pane_acceptLicenseInner" runat="server">
|
||||
|
||||
<div class="alert alert-warning">
|
||||
<p>
|
||||
<strong>Please note:</strong> Installing a package containing several items and
|
||||
files can take some time. Do not refresh the page or navigate away before, the installer
|
||||
notifies you once the install is completed.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<cc1:PropertyPanel ID="PropertyPanel3" runat="server" Text="Name">
|
||||
<asp:Label ID="LabelName" runat="server" /></cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="PropertyPanel5" runat="server" Text="Author">
|
||||
<asp:Label ID="LabelAuthor" runat="server" /></cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="PropertyPanel4" runat="server" Text="More info">
|
||||
<asp:Label ID="LabelMore" runat="server" /></cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="PropertyPanel6" runat="server" Text="License">
|
||||
<asp:Label ID="LabelLicense" runat="server" /></cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="PropertyPanel7" runat="server" Text="Accept license">
|
||||
<asp:CheckBox Text="Accept license" runat="server" ID="acceptCheckbox" /></cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="PropertyPanel8" runat="server" Text="Read me">
|
||||
<asp:Literal ID="readme" runat="server"></asp:Literal>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="pp_unsecureFiles" runat="server" Visible="false" Text=" ">
|
||||
|
||||
<div class="alert alert-error" style="width: 370px;">
|
||||
<h4>Binary files in the package!</h4>
|
||||
|
||||
<a class="toggle-report" href="#">Read more...</a>
|
||||
<div style="display:none;">
|
||||
<p>
|
||||
This package contains .NET code. This is <strong>not unusual</strong> as .NET code
|
||||
is used for any advanced functionality on an Umbraco powered website.</p>
|
||||
<p>
|
||||
However, if you <strong>don't know the author</strong> of the package or are unsure why this package
|
||||
contains these files, it is adviced <strong>not to continue the installation</strong>.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Files in question:</strong><br />
|
||||
<ul>
|
||||
<asp:Literal ID="lt_files" runat="server" />
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="LegacyPropertyEditorPanel" runat="server" Visible="false" Text=" ">
|
||||
<div class="alert alert-error" style="width: 370px;">
|
||||
<h4>
|
||||
Legacy Property editors detected</h4>
|
||||
<a class="toggle-report" href="#">Read more...</a>
|
||||
<div style="display:none;">
|
||||
<p>
|
||||
This package contains legacy property editors which are not compatible with Umbraco 7</p>
|
||||
<p>
|
||||
This package may not function correctly if the package developer has not indicated that
|
||||
it is compatible with version 7. Any DataTypes this package creates that do not have
|
||||
a Version 7 compatible property editor will be converted to use a Label/NoEdit property editor.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="BinaryFileErrorsPanel" runat="server" Visible="false" Text=" ">
|
||||
<div class="alert alert-error" style="width: 370px;">
|
||||
<h4>
|
||||
Binary file errors detected</h4>
|
||||
<a class="toggle-report" href="#">Read more...</a>
|
||||
<div style="display:none;">
|
||||
<p>
|
||||
This package contains .NET binary files that might not be compatible with this version of Umbraco.
|
||||
If you aren't sure what these errors mean or why they are listed please contact the package creator.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Error report</strong><br />
|
||||
<ul>
|
||||
<asp:Literal ID="BinaryFileErrorReport" runat="server" />
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
<cc1:PropertyPanel ID="pp_macroConflicts" runat="server" Visible="false" Text=" ">
|
||||
<div class="alert alert-error" style="width: 370px;">
|
||||
<h4>
|
||||
Macro Conflicts in the package!</h4>
|
||||
<a class="toggle-report" href="#">Read more...</a>
|
||||
<div style="display:none">
|
||||
<p>
|
||||
This package contains one or more macros which have the same alias as an existing one on your site, based on the Macro Alias.
|
||||
</p>
|
||||
<p>
|
||||
If you choose to continue your existing macros will be replaced with the ones from this package. If you do not want to overwrite your existing macros you will need to change their alias.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Macros in question:</strong><br />
|
||||
<ul>
|
||||
<asp:Literal ID="ltrMacroAlias" runat="server" />
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="pp_templateConflicts" runat="server" Visible="false" Text=" ">
|
||||
<div class="alert alert-error" style="width: 370px;">
|
||||
<h4>
|
||||
Template Conflicts in the package!</h4>
|
||||
<a class="toggle-report" href="#">Read more...</a>
|
||||
<div style="display:none">
|
||||
<p>
|
||||
This package contains one or more templates which have the same alias as an existing one on your site, based on the Template Alias.
|
||||
</p>
|
||||
<p>
|
||||
If you choose to continue your existing template will be replaced with the ones from this package. If you do not want to overwrite your existing templates you will need to change their alias.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Templates in question:</strong><br />
|
||||
<ul>
|
||||
<asp:Literal ID="ltrTemplateAlias" runat="server" />
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel ID="pp_stylesheetConflicts" runat="server" Visible="false" Text=" ">
|
||||
<div class="alert alert-error" style="width: 370px;">
|
||||
<h4>
|
||||
Stylesheet Conflicts in the package!</h4>
|
||||
<a class="toggle-report" href="#">Read more...</a>
|
||||
<div style="display:none">
|
||||
<p>
|
||||
This package contains one or more stylesheets which have the same alias as an existing one on your site, based on the Stylesheet Name.
|
||||
</p>
|
||||
<p>
|
||||
If you choose to continue your existing stylesheets will be replaced with the ones from this package. If you do not want to overwrite your existing stylesheets you will need to change their name.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Stylesheets in question:</strong><br />
|
||||
<ul>
|
||||
<asp:Literal ID="ltrStylesheetNames" runat="server" />
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<cc1:PropertyPanel runat="server" Text=" ">
|
||||
<br />
|
||||
<div id="installingMessage" style="display: none;">
|
||||
<div class="umb-loader-wrapper">
|
||||
<cc1:ProgressBar runat="server" ID="_progbar1" />
|
||||
</div>
|
||||
<br />
|
||||
<em>Installing package, please wait...</em><br /><br />
|
||||
</div>
|
||||
<asp:Button ID="ButtonInstall" runat="server" Text="Install Package" CssClass="btn btn-primary" Enabled="False"
|
||||
OnClick="startInstall"></asp:Button>
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
|
||||
</asp:Panel>
|
||||
<cc1:Pane ID="pane_installing" runat="server" Visible="false" Text="Installing package">
|
||||
<cc1:PropertyPanel runat="server">
|
||||
<cc1:ProgressBar runat="server" ID="progBar2" />
|
||||
<asp:Literal ID="lit_installStatus" runat="server" />
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
|
||||
<cc1:Pane ID="pane_optional" runat="server" Visible="false" />
|
||||
|
||||
<cc1:Pane ID="pane_success" runat="server" Text="Package is installed" Visible="false">
|
||||
<cc1:PropertyPanel runat="server">
|
||||
|
||||
<p>
|
||||
All items in the package have been installed</p>
|
||||
<p>
|
||||
Overview of what was installed can be found under "installed package" in the developer
|
||||
section.</p>
|
||||
<p>
|
||||
Uninstall is available at the same location.</p>
|
||||
<p>
|
||||
<asp:Button Text="View installed package" ID="bt_viewInstalledPackage" runat="server" />
|
||||
<asp:Literal ID="lit_authorUrl" runat="server" />
|
||||
</p>
|
||||
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
|
||||
<cc1:Pane ID="pane_uninstalled" runat="server" Text="Package has been uninstalled" Visible="false">
|
||||
<cc1:PropertyPanel runat="server">
|
||||
|
||||
<p><%= umbraco.ui.Text("packager", "packageUninstalledText") %></p>
|
||||
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
|
||||
<cc1:Pane ID="pane_refresh" runat="server" Text="Browser is reloading" Visible="false">
|
||||
<cc1:PropertyPanel runat="server">
|
||||
|
||||
<div class="alert alert-block">
|
||||
Please wait while the browser is reloaded...
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
//This is all a bit zany with double encoding because we have a URL in a hash (#) url part
|
||||
// but it works and maintains query strings
|
||||
|
||||
var refreshQuery = decodeURIComponent("<%=RefreshQueryString%>");
|
||||
var umbPath = "<%=GlobalSettings.Path%>";
|
||||
setTimeout(function () {
|
||||
|
||||
|
||||
|
||||
var mainWindow = UmbClientMgr.mainWindow();
|
||||
|
||||
//kill the tree and template cache
|
||||
if (mainWindow.UmbClientMgr) {
|
||||
mainWindow.UmbClientMgr._packageInstalled();
|
||||
}
|
||||
|
||||
var baseUrl = mainWindow.location.href.substr(0, mainWindow.location.href.indexOf("#/developer/framed/"));
|
||||
var framedUrl = baseUrl + "#/developer/framed/";
|
||||
var refreshUrl = framedUrl + encodeURIComponent(encodeURIComponent(umbPath + "/developer/packages/installer.aspx?" + refreshQuery));
|
||||
|
||||
var redirectUrl = umbPath + "/ClientRedirect.aspx?redirectUrl=" + refreshUrl;
|
||||
|
||||
mainWindow.location.href = redirectUrl;
|
||||
|
||||
}, 2000);
|
||||
</script>
|
||||
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
<input id="tempFile" type="hidden" name="tempFile" runat="server" /><input id="processState"
|
||||
type="hidden" name="processState" runat="server" />
|
||||
</cc1:UmbracoPanel>
|
||||
</asp:Content>
|
||||
@@ -20,6 +20,7 @@ using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Web.WebServices;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
@@ -113,7 +114,7 @@ namespace Umbraco.Web.Editors
|
||||
{"serverVarsJs", _urlHelper.Action("Application", "BackOffice")},
|
||||
//API URLs
|
||||
{
|
||||
"packagesRestApiBaseUrl", UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault().RestApiUrl
|
||||
"packagesRestApiBaseUrl", Constants.PackageRepository.RestApiBaseUrl
|
||||
},
|
||||
{
|
||||
"redirectUrlManagementApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<RedirectUrlManagementController>(
|
||||
|
||||
@@ -10,9 +10,7 @@ using System.Web.Http;
|
||||
using System.Xml;
|
||||
using umbraco;
|
||||
using umbraco.cms.businesslogic.packager;
|
||||
using umbraco.cms.businesslogic.packager.repositories;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using umbraco.presentation.developer.packages;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Events;
|
||||
|
||||
@@ -532,9 +532,6 @@
|
||||
<Compile Include="Trees\XsltTreeController.cs" />
|
||||
<Compile Include="umbraco.presentation\SafeXmlReaderWriter.cs" />
|
||||
<Compile Include="Trees\ScriptTreeController.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\developer\Packages\installer.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UmbracoDefaultOwinStartup.cs" />
|
||||
<Compile Include="IUmbracoContextAccessor.cs" />
|
||||
<Compile Include="Models\ContentEditing\Relation.cs" />
|
||||
@@ -1717,7 +1714,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMembers.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMemberTypes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadNodeTypes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadPackages.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadPython.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadScripts.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadStylesheetProperty.cs" />
|
||||
|
||||
@@ -1,27 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using System.Configuration;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic;
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.cms.businesslogic.cache;
|
||||
using umbraco.cms.businesslogic.contentitem;
|
||||
using umbraco.cms.businesslogic.datatype;
|
||||
using umbraco.cms.businesslogic.language;
|
||||
using umbraco.cms.businesslogic.media;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.cms.businesslogic.property;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.interfaces;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.BusinessLogic.Utils;
|
||||
using Umbraco.Core;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
|
||||
@@ -34,11 +14,9 @@ namespace umbraco
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
|
||||
public class loadPackager : BaseTree
|
||||
{
|
||||
#region TreeI Members
|
||||
public loadPackager(string application) : base(application) { }
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private int _id;
|
||||
@@ -65,7 +43,7 @@ namespace umbraco
|
||||
protected override void CreateAllowedActions(ref List<IAction> actions)
|
||||
{
|
||||
actions.Clear();
|
||||
actions.Add(umbraco.BusinessLogic.Actions.ActionRefresh.Instance);
|
||||
actions.Add(BusinessLogic.Actions.ActionRefresh.Instance);
|
||||
}
|
||||
|
||||
protected override void CreateRootNodeActions(ref List<IAction> actions)
|
||||
@@ -93,89 +71,61 @@ namespace umbraco
|
||||
/// </summary>
|
||||
/// <param name="tree">The tree.</param>
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
{
|
||||
string[,] items = { { "BrowseRepository.aspx", "Install from repository" }, { "CreatePackage.aspx", "Created Packages" }, { "installedPackages.aspx", "Installed packages" }, { "StarterKits.aspx", "Starter kit" }, { "installer.aspx", "Install local package" } };
|
||||
|
||||
|
||||
for (int i = 0; i <= items.GetUpperBound(0); i++)
|
||||
for (var i = 0; i <= items.GetUpperBound(0); i++)
|
||||
{
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
var xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = (i + 1).ToInvariantString();
|
||||
xNode.Text = items[i, 1];
|
||||
xNode.Icon = "icon-folder";
|
||||
xNode.OpenIcon = "icon-folder";
|
||||
|
||||
|
||||
|
||||
//Make sure the different sections load the correct childnodes.
|
||||
switch (items[i, 0])
|
||||
{
|
||||
case "installedPackages.aspx":
|
||||
|
||||
if (cms.businesslogic.packager.InstalledPackage.GetAllInstalledPackages().Count > 0)
|
||||
{
|
||||
xNode.Source = "tree.aspx?app=" + this._app + "&id=" + this._id + "&treeType=packagerPackages&packageType=installed" + "&rnd=" + Guid.NewGuid();
|
||||
xNode.NodeType = "installedPackages";
|
||||
xNode.Text = ui.Text("treeHeaders", "installedPackages");
|
||||
xNode.Source = $"tree.aspx?app={_app}&id={_id}&treeType=packagerPackages&packageType=installed&rnd={Guid.NewGuid()}";
|
||||
xNode.NodeType = "installedPackages";
|
||||
xNode.Text = ui.Text("treeHeaders", "installedPackages");
|
||||
xNode.HasChildren = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
xNode.Text = "";
|
||||
}
|
||||
|
||||
xNode.Action = "javascript:void(0);";
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "BrowseRepository.aspx":
|
||||
|
||||
/*
|
||||
//Gets all the repositories registered in umbracoSettings.config
|
||||
var repos = cms.businesslogic.packager.repositories.Repository.getAll();
|
||||
|
||||
|
||||
//if more then one repo, then list them as child nodes under the "Install from repository" node.
|
||||
// the repositories will then be fetched from the loadPackages class.
|
||||
if (repos.Count > 1)
|
||||
{
|
||||
xNode.Source = "tree.aspx?app=" + this._app + "&id=" + this._id + "&treeType=packagerPackages&packageType=repositories" + "&rnd=" + Guid.NewGuid();
|
||||
xNode.NodeType = "packagesRepositories";
|
||||
xNode.Text = ui.Text("treeHeaders", "repositories");
|
||||
xNode.HasChildren = true;
|
||||
}
|
||||
*/
|
||||
//if only one repo, then just list it directly and name it as the repository.
|
||||
//the packages will be loaded from the loadPackages class with a repoAlias querystring
|
||||
var repos = cms.businesslogic.packager.repositories.Repository.getAll();
|
||||
|
||||
xNode.Text = repos[0].Name;
|
||||
xNode.Source = "tree.aspx?app=" + this._app + "&id=" + this._id + "&treeType=packagerPackages&packageType=repository&repoGuid=" + repos[0].Guid + "&rnd=" + Guid.NewGuid();
|
||||
xNode.Text = Constants.PackageRepository.DefaultRepositoryName;
|
||||
xNode.Source = $"tree.aspx?app={_app}&id={_id}&treeType=packagerPackages&packageType=repository&repoGuid={Constants.PackageRepository.DefaultRepositoryId}&rnd={Guid.NewGuid()}";
|
||||
xNode.NodeType = "packagesRepository";
|
||||
xNode.Action = "javascript:openPackageCategory('BrowseRepository.aspx?repoGuid=" + repos[0].Guid + "');";
|
||||
xNode.Action = $"javascript:openPackageCategory(\'BrowseRepository.aspx?repoGuid={Constants.PackageRepository.DefaultRepositoryId}\');";
|
||||
xNode.Icon = "icon-server-alt";
|
||||
xNode.HasChildren = true;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "CreatePackage.aspx":
|
||||
xNode.Source = "tree.aspx?app=" + this._app + "&id=" + this._id + "&treeType=packagerPackages&packageType=created" + "&rnd=" + Guid.NewGuid();
|
||||
xNode.Source = $"tree.aspx?app={_app}&id={_id}&treeType=packagerPackages&packageType=created&rnd={Guid.NewGuid()}";
|
||||
xNode.NodeType = "createdPackages";
|
||||
xNode.Menu.Clear();
|
||||
xNode.Menu.Add(umbraco.BusinessLogic.Actions.ActionNew.Instance);
|
||||
xNode.Menu.Add(umbraco.BusinessLogic.Actions.ActionRefresh.Instance);
|
||||
xNode.Menu.Clear();
|
||||
xNode.Menu.Add(BusinessLogic.Actions.ActionNew.Instance);
|
||||
xNode.Menu.Add(BusinessLogic.Actions.ActionRefresh.Instance);
|
||||
xNode.Text = ui.Text("treeHeaders", "createdPackages");
|
||||
xNode.HasChildren = true;
|
||||
xNode.Action = "javascript:void(0);";
|
||||
|
||||
break;
|
||||
|
||||
case "installer.aspx":
|
||||
xNode.Source = "";
|
||||
xNode.NodeType = "uploadPackage";
|
||||
xNode.Icon = "icon-page-up";
|
||||
xNode.Action = "javascript:openPackageCategory('" + items[i, 0] + "');";
|
||||
xNode.Action = $"javascript:openPackageCategory(\'{items[i, 0]}\');";
|
||||
xNode.Text = ui.Text("treeHeaders", "localPackage");
|
||||
xNode.Menu.Clear();
|
||||
break;
|
||||
@@ -183,7 +133,7 @@ namespace umbraco
|
||||
case "StarterKits.aspx":
|
||||
xNode.Source = "";
|
||||
xNode.NodeType = "starterKits";
|
||||
xNode.Action = "javascript:openPackageCategory('" + items[i, 0] + "');";
|
||||
xNode.Action = $"javascript:openPackageCategory(\'{items[i, 0]}\');";
|
||||
xNode.Icon = "icon-flash";
|
||||
xNode.Text = ui.Text("treeHeaders", "installStarterKit");
|
||||
xNode.Menu.Clear();
|
||||
@@ -199,7 +149,4 @@ namespace umbraco
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using umbraco.businesslogic;
|
||||
using umbraco.cms.businesslogic.packager;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
//[Tree(Constants.Applications.Developer, "packagerPackages", "Packager Packages", initialize: false, sortOrder: 1)]
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
|
||||
public class loadPackages : BaseTree
|
||||
{
|
||||
|
||||
public const string PACKAGE_TREE_PREFIX = "package_";
|
||||
|
||||
public loadPackages(string application) : base(application) { }
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private int _id;
|
||||
private string _app;
|
||||
private string _packageType = "";
|
||||
private string _repoGuid = "";
|
||||
|
||||
public override void RenderJS(ref StringBuilder Javascript)
|
||||
{
|
||||
Javascript.Append(@"
|
||||
function openCreatedPackage(id) {
|
||||
UmbClientMgr.contentFrame('developer/packages/editPackage.aspx?id=' + id);
|
||||
}
|
||||
function openInstalledPackage(id) {
|
||||
UmbClientMgr.contentFrame('developer/packages/installedPackage.aspx?id=' + id);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
protected override void CreateAllowedActions(ref List<IAction> actions)
|
||||
{
|
||||
actions.Clear();
|
||||
}
|
||||
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
|
||||
_packageType = HttpContext.Current.Request.QueryString["packageType"];
|
||||
|
||||
switch (_packageType)
|
||||
{
|
||||
case "installed":
|
||||
Version v;
|
||||
// Display the unique packages, ordered by the latest version number. [LK 2013-06-10]
|
||||
var uniquePackages = InstalledPackage.GetAllInstalledPackages()
|
||||
.OrderByDescending(x => Version.TryParse(x.Data.Version, out v) ? v : new Version())
|
||||
.GroupBy(x => x.Data.Name)
|
||||
.Select(x => x.First())
|
||||
.OrderBy(x => x.Data.Name);
|
||||
foreach (var p in uniquePackages)
|
||||
{
|
||||
var xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = string.Concat(PACKAGE_TREE_PREFIX, p.Data.Id);
|
||||
xNode.Text = p.Data.Name;
|
||||
xNode.Action = string.Format("javascript:openInstalledPackage('{0}');", p.Data.Id);
|
||||
xNode.Icon = "icon-box";
|
||||
xNode.OpenIcon = "icon-box";
|
||||
xNode.NodeType = "createdPackageInstance";
|
||||
tree.Add(xNode);
|
||||
}
|
||||
break;
|
||||
|
||||
case "created":
|
||||
foreach (CreatedPackage p in CreatedPackage.GetAllCreatedPackages())
|
||||
{
|
||||
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = PACKAGE_TREE_PREFIX + p.Data.Id.ToString();
|
||||
xNode.Text = p.Data.Name;
|
||||
xNode.Action = "javascript:openCreatedPackage('" + p.Data.Id.ToString() + "');";
|
||||
xNode.Icon = "icon-box";
|
||||
xNode.OpenIcon = "icon-box";
|
||||
xNode.NodeType = "createdPackageInstance";
|
||||
xNode.Menu.Add(umbraco.BusinessLogic.Actions.ActionDelete.Instance);
|
||||
tree.Add(xNode);
|
||||
}
|
||||
break;
|
||||
|
||||
case "repositories":
|
||||
List<cms.businesslogic.packager.repositories.Repository> repos = cms.businesslogic.packager.repositories.Repository.getAll();
|
||||
|
||||
foreach (cms.businesslogic.packager.repositories.Repository repo in repos)
|
||||
{
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.Text = repo.Name;
|
||||
xNode.Action = "javascript:openPackageCategory('BrowseRepository.aspx?repoGuid=" + repo.Guid + "');";
|
||||
xNode.Icon = "icon-server-alt";
|
||||
xNode.OpenIcon = "icon-server-alt";
|
||||
xNode.NodeType = "packagesRepo" + repo.Guid;
|
||||
xNode.Menu.Add( umbraco.BusinessLogic.Actions.ActionRefresh.Instance );
|
||||
xNode.Source = "tree.aspx?app=" + this._app + "&id=" + this._id + "&treeType=packagerPackages&packageType=repository&repoGuid=" + repo.Guid + "&rnd=" + Guid.NewGuid();
|
||||
tree.Add(xNode);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case "repository":
|
||||
|
||||
_repoGuid = HttpContext.Current.Request.QueryString["repoGuid"];
|
||||
Umbraco.Web.org.umbraco.our.Repository r = new Umbraco.Web.org.umbraco.our.Repository();
|
||||
|
||||
foreach (var cat in r.Categories(_repoGuid))
|
||||
{
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = cat.Id.ToInvariantString();
|
||||
xNode.Text = cat.Text;
|
||||
xNode.Action = "javascript:openPackageCategory('BrowseRepository.aspx?category=" + cat.Id + "&repoGuid=" + _repoGuid + "');";
|
||||
xNode.Icon = "icon-folder";
|
||||
xNode.OpenIcon = "icon-folder";
|
||||
xNode.NodeType = "packagesCategory" + cat.Id;
|
||||
tree.Add(xNode);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace umbraco
|
||||
// we need to grab the id from the alias as the new tree needs to prefix the NodeID with "package_"
|
||||
if (ParentID == 0)
|
||||
{
|
||||
ParentID = int.Parse(Alias.Substring(loadPackages.PACKAGE_TREE_PREFIX.Length));
|
||||
ParentID = int.Parse(Alias.Substring("package_".Length));
|
||||
}
|
||||
cms.businesslogic.packager.CreatedPackage.GetById(ParentID).Delete();
|
||||
return true;
|
||||
|
||||
@@ -1,835 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Web;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
using BizLogicAction = umbraco.BusinessLogic.Actions.Action;
|
||||
|
||||
namespace umbraco.presentation.developer.packages
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for packager.
|
||||
/// </summary>
|
||||
[Obsolete("This should not be used and will be removed in v8, this is kept here only for backwards compat reasons, this page should never be rendered/used")]
|
||||
public class Installer : UmbracoEnsuredPage
|
||||
{
|
||||
public Installer()
|
||||
{
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
_installer = new cms.businesslogic.packager.Installer(UmbracoUser.Id);
|
||||
}
|
||||
|
||||
private Control _configControl;
|
||||
private cms.businesslogic.packager.repositories.Repository _repo;
|
||||
private readonly cms.businesslogic.packager.Installer _installer = null;
|
||||
private string _tempFileName = "";
|
||||
|
||||
protected string RefreshQueryString { get; set; }
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
var ex = new Exception();
|
||||
if (!cms.businesslogic.packager.Settings.HasFileAccess(ref ex))
|
||||
{
|
||||
fb.Style.Add("margin-top", "7px");
|
||||
fb.type = uicontrols.Feedback.feedbacktype.error;
|
||||
fb.Text = "<strong>" + ui.Text("errors", "filePermissionsError") + ":</strong><br/>" + ex.Message;
|
||||
}
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
ButtonInstall.Attributes.Add("onClick", "jQuery(this).hide(); jQuery('#installingMessage').show();; return true;");
|
||||
ButtonLoadPackage.Attributes.Add("onClick", "jQuery(this).hide(); jQuery('#loadingbar').show();; return true;");
|
||||
}
|
||||
|
||||
//if we are actually in the middle of installing something... meaning we keep redirecting back to this page with
|
||||
// custom query strings
|
||||
// TODO: SD: This process needs to be fixed/changed/etc... to use the InstallPackageController
|
||||
// http://issues.umbraco.org/issue/U4-1047
|
||||
if (!string.IsNullOrEmpty(Request.GetItemAsString("installing")))
|
||||
{
|
||||
HideAllPanes();
|
||||
pane_installing.Visible = true;
|
||||
ProcessInstall(Request.GetItemAsString("installing")); //process the current step
|
||||
|
||||
}
|
||||
else if (tempFile.Value.IsNullOrWhiteSpace() //if we haven't downloaded the .umb temp file yet
|
||||
&& (!Request.GetItemAsString("guid").IsNullOrWhiteSpace() && !Request.GetItemAsString("repoGuid").IsNullOrWhiteSpace()))
|
||||
{
|
||||
//we'll fetch the local information we have about our repo, to find out what webservice to query.
|
||||
_repo = cms.businesslogic.packager.repositories.Repository.getByGuid(Request.GetItemAsString("repoGuid"));
|
||||
|
||||
if (_repo != null && _repo.HasConnection())
|
||||
{
|
||||
//from the webservice we'll fetch some info about the package.
|
||||
cms.businesslogic.packager.repositories.Package pack = _repo.Webservice.PackageByGuid(Request.GetItemAsString("guid"));
|
||||
|
||||
//if the package is protected we will ask for the users credentials. (this happens every time they try to fetch anything)
|
||||
if (!pack.Protected)
|
||||
{
|
||||
//if it isn't then go straigt to the accept licens screen
|
||||
tempFile.Value = _installer.Import(_repo.fetch(Request.GetItemAsString("guid"), UmbracoUser.Id));
|
||||
UpdateSettings();
|
||||
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
|
||||
//Authenticate against the repo
|
||||
HideAllPanes();
|
||||
pane_authenticate.Visible = true;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fb.Style.Add("margin-top", "7px");
|
||||
fb.type = uicontrols.Feedback.feedbacktype.error;
|
||||
fb.Text = "<strong>No connection to repository.</strong> Runway could not be installed as there was no connection to: '" + _repo.RepositoryUrl + "'";
|
||||
pane_upload.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
acceptCheckbox.Attributes.Add("onmouseup", "document.getElementById('" + ButtonInstall.ClientID + "').disabled = false;");
|
||||
}
|
||||
|
||||
protected void uploadFile(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_tempFileName = Guid.NewGuid().ToString() + ".umb";
|
||||
string fileName = SystemDirectories.Data + System.IO.Path.DirectorySeparatorChar + _tempFileName;
|
||||
file1.PostedFile.SaveAs(IOHelper.MapPath(fileName));
|
||||
tempFile.Value = _installer.Import(_tempFileName);
|
||||
UpdateSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
|
||||
fb.Text = "<strong>Could not upload file</strong><br/>" + ex.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
//this fetches the protected package from the repo.
|
||||
protected void fetchProtectedPackage(object sender, EventArgs e)
|
||||
{
|
||||
//we auth against the webservice. This key will be used to fetch the protected package.
|
||||
string memberGuid = _repo.Webservice.authenticate(tb_email.Text, library.CreateHash(tb_password.Text));
|
||||
|
||||
//if we auth correctly and get a valid key back, we will fetch the file from the repo webservice.
|
||||
if (string.IsNullOrEmpty(memberGuid) == false)
|
||||
{
|
||||
tempFile.Value = _installer.Import(_repo.fetch(helper.Request("guid"), memberGuid));
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
|
||||
//this loads the accept license screen
|
||||
private void UpdateSettings()
|
||||
{
|
||||
HideAllPanes();
|
||||
|
||||
pane_acceptLicense.Visible = true;
|
||||
pane_acceptLicenseInner.Text = "Installing the package: " + _installer.Name;
|
||||
Panel1.Text = "Installing the package: " + _installer.Name;
|
||||
|
||||
|
||||
if (_installer.ContainsUnsecureFiles)
|
||||
{
|
||||
pp_unsecureFiles.Visible = true;
|
||||
foreach (string str in _installer.UnsecureFiles)
|
||||
{
|
||||
lt_files.Text += "<li>" + str + "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
if (_installer.ContainsLegacyPropertyEditors)
|
||||
{
|
||||
LegacyPropertyEditorPanel.Visible = true;
|
||||
}
|
||||
|
||||
if (_installer.ContainsBinaryFileErrors)
|
||||
{
|
||||
BinaryFileErrorsPanel.Visible = true;
|
||||
foreach (var str in _installer.BinaryFileErrors)
|
||||
{
|
||||
BinaryFileErrorReport.Text += "<li>" + str + "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
if (_installer.ContainsMacroConflict)
|
||||
{
|
||||
pp_macroConflicts.Visible = true;
|
||||
foreach (var item in _installer.ConflictingMacroAliases)
|
||||
{
|
||||
ltrMacroAlias.Text += "<li>" + item.Key + " (Alias: " + item.Value + ")</li>";
|
||||
}
|
||||
}
|
||||
|
||||
if (_installer.ContainsTemplateConflicts)
|
||||
{
|
||||
pp_templateConflicts.Visible = true;
|
||||
foreach (var item in _installer.ConflictingTemplateAliases)
|
||||
{
|
||||
ltrTemplateAlias.Text += "<li>" + item.Key + " (Alias: " + item.Value + ")</li>";
|
||||
}
|
||||
}
|
||||
|
||||
if (_installer.ContainsStyleSheeConflicts)
|
||||
{
|
||||
pp_stylesheetConflicts.Visible = true;
|
||||
foreach (var item in _installer.ConflictingStyleSheetNames)
|
||||
{
|
||||
ltrStylesheetNames.Text += "<li>" + item.Key + " (Alias: " + item.Value + ")</li>";
|
||||
}
|
||||
}
|
||||
|
||||
LabelName.Text = _installer.Name + " Version: " + _installer.Version;
|
||||
LabelMore.Text = "<a href=\"" + _installer.Url + "\" target=\"_blank\">" + _installer.Url + "</a>";
|
||||
LabelAuthor.Text = "<a href=\"" + _installer.AuthorUrl + "\" target=\"_blank\">" + _installer.Author + "</a>";
|
||||
LabelLicense.Text = "<a href=\"" + _installer.LicenseUrl + "\" target=\"_blank\">" + _installer.License + "</a>";
|
||||
|
||||
if (_installer.ReadMe != "")
|
||||
readme.Text = "<div style=\"border: 1px solid #999; padding: 5px; overflow: auto; width: 370px; height: 160px;\">" + library.ReplaceLineBreaks(library.StripHtml(_installer.ReadMe)) + "</div>";
|
||||
else
|
||||
readme.Text = "<span style=\"color: #999\">No information</span><br/>";
|
||||
}
|
||||
|
||||
|
||||
private void ProcessInstall(string currentStep)
|
||||
{
|
||||
var dir = Request.GetItemAsString("dir");
|
||||
var packageId = 0;
|
||||
int.TryParse(Request.GetItemAsString("pId"), out packageId);
|
||||
|
||||
switch (currentStep.ToLowerInvariant())
|
||||
{
|
||||
case "businesslogic":
|
||||
//first load in the config from the temporary directory
|
||||
//this will ensure that the installer have access to all the new files and the package manifest
|
||||
_installer.LoadConfig(dir);
|
||||
_installer.InstallBusinessLogic(packageId, dir);
|
||||
|
||||
|
||||
//making sure that publishing actions performed from the cms layer gets pushed to the presentation
|
||||
library.RefreshContent();
|
||||
|
||||
if (string.IsNullOrEmpty(_installer.Control) == false)
|
||||
{
|
||||
Response.Redirect("installer.aspx?installing=refresh&dir=" + dir + "&pId=" + packageId.ToString() + "&customControl=" + Server.UrlEncode(_installer.Control) + "&customUrl=" + Server.UrlEncode(_installer.Url));
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("installer.aspx?installing=refresh&dir=" + dir + "&pId=" + packageId.ToString() + "&customUrl=" + Server.UrlEncode(_installer.Url));
|
||||
}
|
||||
break;
|
||||
case "custominstaller":
|
||||
var customControl = Request.GetItemAsString("customControl");
|
||||
|
||||
if (customControl.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
HideAllPanes();
|
||||
|
||||
_configControl = LoadControl(SystemDirectories.Root + customControl);
|
||||
_configControl.ID = "packagerConfigControl";
|
||||
|
||||
pane_optional.Controls.Add(_configControl);
|
||||
pane_optional.Visible = true;
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
//We still need to clean everything up which is normally done in the Finished Action
|
||||
PerformPostInstallCleanup(packageId, dir);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//if the custom installer control is empty here (though it should never be because we've already checked for it previously)
|
||||
//then we should run the normal FinishedAction
|
||||
PerformFinishedAction(packageId, dir, Request.GetItemAsString("customUrl"));
|
||||
}
|
||||
break;
|
||||
case "refresh":
|
||||
PerformRefreshAction(packageId, dir, Request.GetItemAsString("customUrl"), Request.GetItemAsString("customControl"));
|
||||
break;
|
||||
case "finished":
|
||||
PerformFinishedAction(packageId, dir, Request.GetItemAsString("customUrl"));
|
||||
break;
|
||||
case "uninstalled":
|
||||
PerformUninstalledAction();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the 'Finished' action of the installer
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="dir"></param>
|
||||
/// <param name="url"></param>
|
||||
private void PerformFinishedAction(int packageId, string dir, string url)
|
||||
{
|
||||
HideAllPanes();
|
||||
//string url = _installer.Url;
|
||||
string packageViewUrl = "installedPackage.aspx?id=" + packageId.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
bt_viewInstalledPackage.OnClientClick = "document.location = '" + packageViewUrl + "'; return false;";
|
||||
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
lit_authorUrl.Text = " <em>" + ui.Text("or") + "</em> <a href='" + url + "' target=\"_blank\">" + ui.Text("viewPackageWebsite") + "</a>";
|
||||
|
||||
|
||||
pane_success.Visible = true;
|
||||
|
||||
PerformPostInstallCleanup(packageId, dir);
|
||||
}
|
||||
|
||||
private void PerformUninstalledAction()
|
||||
{
|
||||
HideAllPanes();
|
||||
Panel1.Text = "Package has been uninstalled";
|
||||
pane_uninstalled.Visible = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform the 'Refresh' action of the installer
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="dir"></param>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="customControl"></param>
|
||||
private void PerformRefreshAction(int packageId, string dir, string url, string customControl)
|
||||
{
|
||||
HideAllPanes();
|
||||
|
||||
//create the URL to refresh to
|
||||
// /umbraco/developer/packages/installer.aspx?installing=finished
|
||||
// &dir=X:\Projects\Umbraco\Umbraco_7.0\src\Umbraco.Web.UI\App_Data\aef8c41f-63a0-494b-a1e2-10d761647033
|
||||
// &pId=3
|
||||
// &customUrl=http:%2f%2four.umbraco.org%2fprojects%2fwebsite-utilities%2fmerchello
|
||||
|
||||
if (customControl.IsNullOrWhiteSpace())
|
||||
{
|
||||
RefreshQueryString = Server.UrlEncode(string.Format(
|
||||
"installing=finished&dir={0}&pId={1}&customUrl={2}",
|
||||
dir, packageId, url));
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshQueryString = Server.UrlEncode(string.Format(
|
||||
"installing=customInstaller&dir={0}&pId={1}&customUrl={2}&customControl={3}",
|
||||
dir, packageId, url, customControl));
|
||||
}
|
||||
|
||||
pane_refresh.Visible = true;
|
||||
|
||||
PerformPostInstallCleanup(packageId, dir);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs Post refresh actions such reloading the correct tree nodes, etc...
|
||||
/// </summary>
|
||||
private void PerformPostRefreshAction()
|
||||
{
|
||||
BasePage.Current.ClientTools.ReloadActionNode(true, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs Post install actions such as clearning any necessary cache, reloading the correct tree nodes, etc...
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="dir"></param>
|
||||
private void PerformPostInstallCleanup(int packageId, string dir)
|
||||
{
|
||||
_installer.InstallCleanUp(packageId, dir);
|
||||
|
||||
// Update ClientDependency version
|
||||
var clientDependencyConfig = new Umbraco.Core.Configuration.ClientDependencyConfiguration(LoggerResolver.Current.Logger);
|
||||
var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber();
|
||||
|
||||
//clear the tree cache - we'll do this here even though the browser will reload, but just in case it doesn't can't hurt.
|
||||
ClientTools.ClearClientTreeCache().RefreshTree("packager");
|
||||
TreeDefinitionCollection.Instance.ReRegisterTrees();
|
||||
BizLogicAction.ReRegisterActionsAndHandlers();
|
||||
}
|
||||
|
||||
//this accepts the package, creates the manifest and then installs the files.
|
||||
protected void startInstall(object sender, System.EventArgs e)
|
||||
{
|
||||
//we will now create the installer manifest, which means that umbraco can register everything that gets added to the system
|
||||
//this returns an id of the manifest.
|
||||
|
||||
_installer.LoadConfig(tempFile.Value);
|
||||
|
||||
int pId = _installer.CreateManifest(tempFile.Value, helper.Request("guid"), helper.Request("repoGuid"));
|
||||
|
||||
//and then copy over the files. This will take some time if it contains .dlls that will reboot the system..
|
||||
_installer.InstallFiles(pId, tempFile.Value);
|
||||
|
||||
//TODO: This is a total hack, we need to refactor the installer to be just like the package installer during the
|
||||
// install process and use AJAX to ensure that app pool restarts and restarts PROPERLY before installing the business
|
||||
// logic. Until then, we are going to put a thread sleep here for 2 seconds in hopes that we always fluke out and the app
|
||||
// pool will be restarted after redirect.
|
||||
Thread.Sleep(2000);
|
||||
|
||||
Response.Redirect("installer.aspx?installing=businesslogic&dir=" + tempFile.Value + "&pId=" + pId.ToString());
|
||||
}
|
||||
|
||||
private void HideAllPanes()
|
||||
{
|
||||
pane_authenticate.Visible = false;
|
||||
pane_acceptLicense.Visible = false;
|
||||
pane_installing.Visible = false;
|
||||
pane_optional.Visible = false;
|
||||
pane_success.Visible = false;
|
||||
pane_refresh.Visible = false;
|
||||
pane_upload.Visible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.UmbracoPanel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// fb control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Feedback fb;
|
||||
|
||||
/// <summary>
|
||||
/// pane_upload control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Pane pane_upload;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel9 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel9;
|
||||
|
||||
/// <summary>
|
||||
/// file1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlInputFile file1;
|
||||
|
||||
/// <summary>
|
||||
/// ButtonLoadPackage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button ButtonLoadPackage;
|
||||
|
||||
/// <summary>
|
||||
/// progbar1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.ProgressBar progbar1;
|
||||
|
||||
/// <summary>
|
||||
/// pane_authenticate control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Pane pane_authenticate;
|
||||
|
||||
/// <summary>
|
||||
/// tb_email control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox tb_email;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1;
|
||||
|
||||
/// <summary>
|
||||
/// tb_password control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox tb_password;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel2 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2;
|
||||
|
||||
/// <summary>
|
||||
/// Button1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button Button1;
|
||||
|
||||
/// <summary>
|
||||
/// pane_acceptLicense control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel pane_acceptLicense;
|
||||
|
||||
/// <summary>
|
||||
/// pane_acceptLicenseInner control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Pane pane_acceptLicenseInner;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel3 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel3;
|
||||
|
||||
/// <summary>
|
||||
/// LabelName control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LabelName;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel5 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel5;
|
||||
|
||||
/// <summary>
|
||||
/// LabelAuthor control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LabelAuthor;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel4 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel4;
|
||||
|
||||
/// <summary>
|
||||
/// LabelMore control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LabelMore;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel6 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel6;
|
||||
|
||||
/// <summary>
|
||||
/// LabelLicense control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LabelLicense;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel7 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel7;
|
||||
|
||||
/// <summary>
|
||||
/// acceptCheckbox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox acceptCheckbox;
|
||||
|
||||
/// <summary>
|
||||
/// PropertyPanel8 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel8;
|
||||
|
||||
/// <summary>
|
||||
/// readme control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal readme;
|
||||
|
||||
/// <summary>
|
||||
/// pp_unsecureFiles control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel pp_unsecureFiles;
|
||||
|
||||
/// <summary>
|
||||
/// lt_files control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal lt_files;
|
||||
|
||||
/// <summary>
|
||||
/// pp_macroConflicts control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel pp_macroConflicts;
|
||||
|
||||
/// <summary>
|
||||
/// ltrMacroAlias control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal ltrMacroAlias;
|
||||
|
||||
/// <summary>
|
||||
/// pp_templateConflicts control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel pp_templateConflicts;
|
||||
|
||||
protected global::umbraco.uicontrols.PropertyPanel BinaryFileErrorsPanel;
|
||||
protected global::umbraco.uicontrols.PropertyPanel LegacyPropertyEditorPanel;
|
||||
protected global::System.Web.UI.WebControls.Literal BinaryFileErrorReport;
|
||||
|
||||
/// <summary>
|
||||
/// ltrTemplateAlias control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal ltrTemplateAlias;
|
||||
|
||||
/// <summary>
|
||||
/// pp_stylesheetConflicts control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.PropertyPanel pp_stylesheetConflicts;
|
||||
|
||||
/// <summary>
|
||||
/// ltrStylesheetNames control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal ltrStylesheetNames;
|
||||
|
||||
/// <summary>
|
||||
/// _progbar1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.ProgressBar _progbar1;
|
||||
|
||||
/// <summary>
|
||||
/// ButtonInstall control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button ButtonInstall;
|
||||
|
||||
/// <summary>
|
||||
/// pane_installing control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Pane pane_installing;
|
||||
|
||||
protected global::umbraco.uicontrols.Pane pane_uninstalled;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// progBar2 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.ProgressBar progBar2;
|
||||
|
||||
/// <summary>
|
||||
/// lit_installStatus control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal lit_installStatus;
|
||||
|
||||
/// <summary>
|
||||
/// pane_optional control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Pane pane_optional;
|
||||
|
||||
/// <summary>
|
||||
/// pane_success control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Pane pane_success;
|
||||
|
||||
protected global::umbraco.uicontrols.Pane pane_refresh;
|
||||
|
||||
/// <summary>
|
||||
/// bt_viewInstalledPackage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button bt_viewInstalledPackage;
|
||||
|
||||
/// <summary>
|
||||
/// lit_authorUrl control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal lit_authorUrl;
|
||||
|
||||
/// <summary>
|
||||
/// tempFile control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlInputHidden tempFile;
|
||||
|
||||
/// <summary>
|
||||
/// processState control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlInputHidden processState;
|
||||
}
|
||||
}
|
||||
@@ -1,299 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Auditing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.repositories
|
||||
{
|
||||
[Obsolete("This should not be used and will be removed in future Umbraco versions")]
|
||||
public class Repository : DisposableObjectSlim
|
||||
{
|
||||
public string Guid { get; private set; }
|
||||
|
||||
public string Name { get; private set; }
|
||||
|
||||
public string RepositoryUrl { get; private set; }
|
||||
|
||||
public string WebserviceUrl { get; private set; }
|
||||
|
||||
|
||||
public RepositoryWebservice Webservice
|
||||
{
|
||||
get
|
||||
{
|
||||
var repo = new RepositoryWebservice(WebserviceUrl);
|
||||
return repo;
|
||||
}
|
||||
}
|
||||
|
||||
public SubmitStatus SubmitPackage(string authorGuid, PackageInstance package, byte[] doc)
|
||||
{
|
||||
|
||||
string packageName = package.Name;
|
||||
string packageGuid = package.PackageGuid;
|
||||
string description = package.Readme;
|
||||
string packageFile = package.PackagePath;
|
||||
|
||||
|
||||
System.IO.FileStream fs1 = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
byte[] pack = new byte[0];
|
||||
fs1 = System.IO.File.Open(IOHelper.MapPath(packageFile), FileMode.Open, FileAccess.Read);
|
||||
pack = new byte[fs1.Length];
|
||||
fs1.Read(pack, 0, (int) fs1.Length);
|
||||
fs1.Close();
|
||||
fs1 = null;
|
||||
|
||||
byte[] thumb = new byte[0]; //todo upload thumbnail...
|
||||
|
||||
return Webservice.SubmitPackage(Guid, authorGuid, packageGuid, pack, doc, thumb, packageName, "", "", description);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<Repository>("An error occurred in SubmitPackage", ex);
|
||||
|
||||
return SubmitStatus.Error;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Repository> getAll()
|
||||
{
|
||||
|
||||
var repositories = new List<Repository>();
|
||||
|
||||
foreach (var r in UmbracoConfig.For.UmbracoSettings().PackageRepositories.Repositories)
|
||||
{
|
||||
var repository = new Repository
|
||||
{
|
||||
Guid = r.Id.ToString(),
|
||||
Name = r.Name
|
||||
};
|
||||
|
||||
repository.RepositoryUrl = r.RepositoryUrl;
|
||||
repository.WebserviceUrl = repository.RepositoryUrl.Trim('/') + "/" + r.WebServiceUrl.Trim('/');
|
||||
if (r.HasCustomWebServiceUrl)
|
||||
{
|
||||
string wsUrl = r.WebServiceUrl;
|
||||
|
||||
if (wsUrl.Contains("://"))
|
||||
{
|
||||
repository.WebserviceUrl = r.WebServiceUrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
repository.WebserviceUrl = repository.RepositoryUrl.Trim('/') + "/" + wsUrl.Trim('/');
|
||||
}
|
||||
}
|
||||
|
||||
repositories.Add(repository);
|
||||
}
|
||||
|
||||
return repositories;
|
||||
}
|
||||
|
||||
public static Repository getByGuid(string repositoryGuid)
|
||||
{
|
||||
Guid id;
|
||||
if (System.Guid.TryParse(repositoryGuid, out id) == false)
|
||||
{
|
||||
throw new FormatException("The repositoryGuid is not a valid GUID");
|
||||
}
|
||||
|
||||
var found = UmbracoConfig.For.UmbracoSettings().PackageRepositories.Repositories.FirstOrDefault(x => x.Id == id);
|
||||
if (found == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var repository = new Repository
|
||||
{
|
||||
Guid = found.Id.ToString(),
|
||||
Name = found.Name
|
||||
};
|
||||
|
||||
repository.RepositoryUrl = found.RepositoryUrl;
|
||||
repository.WebserviceUrl = repository.RepositoryUrl.Trim('/') + "/" + found.WebServiceUrl.Trim('/');
|
||||
|
||||
if (found.HasCustomWebServiceUrl)
|
||||
{
|
||||
string wsUrl = found.WebServiceUrl;
|
||||
|
||||
if (wsUrl.Contains("://"))
|
||||
{
|
||||
repository.WebserviceUrl = found.WebServiceUrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
repository.WebserviceUrl = repository.RepositoryUrl.Trim('/') + "/" + wsUrl.Trim('/');
|
||||
}
|
||||
}
|
||||
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//shortcut method to download pack from repo and place it on the server...
|
||||
public string fetch(string packageGuid)
|
||||
{
|
||||
return fetch(packageGuid, string.Empty);
|
||||
}
|
||||
|
||||
public string fetch(string packageGuid, int userId)
|
||||
{
|
||||
// log
|
||||
Audit.Add(AuditTypes.PackagerInstall,
|
||||
string.Format("Package {0} fetched from {1}", packageGuid, this.Guid),
|
||||
userId, -1);
|
||||
return fetch(packageGuid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to get the correct package file from the repo for the current umbraco version
|
||||
/// </summary>
|
||||
/// <param name="packageGuid"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="currentUmbracoVersion"></param>
|
||||
/// <returns></returns>
|
||||
public string GetPackageFile(string packageGuid, int userId, System.Version currentUmbracoVersion)
|
||||
{
|
||||
// log
|
||||
Audit.Add(AuditTypes.PackagerInstall,
|
||||
string.Format("Package {0} fetched from {1}", packageGuid, this.Guid),
|
||||
userId, -1);
|
||||
|
||||
var fileByteArray = Webservice.GetPackageFile(packageGuid, currentUmbracoVersion.ToString(3));
|
||||
|
||||
//successfull
|
||||
if (fileByteArray.Length > 0)
|
||||
{
|
||||
// Check for package directory
|
||||
if (Directory.Exists(IOHelper.MapPath(Settings.PackagerRoot)) == false)
|
||||
Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagerRoot));
|
||||
|
||||
using (var fs1 = new FileStream(IOHelper.MapPath(Settings.PackagerRoot + Path.DirectorySeparatorChar + packageGuid + ".umb"), FileMode.Create))
|
||||
{
|
||||
fs1.Write(fileByteArray, 0, fileByteArray.Length);
|
||||
fs1.Close();
|
||||
return "packages\\" + packageGuid + ".umb";
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public bool HasConnection()
|
||||
{
|
||||
|
||||
string strServer = this.RepositoryUrl;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
HttpWebRequest reqFP = (HttpWebRequest) HttpWebRequest.Create(strServer);
|
||||
HttpWebResponse rspFP = (HttpWebResponse) reqFP.GetResponse();
|
||||
|
||||
if (HttpStatusCode.OK == rspFP.StatusCode)
|
||||
{
|
||||
|
||||
// HTTP = 200 - Internet connection available, server online
|
||||
rspFP.Close();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Other status - Server or connection not available
|
||||
|
||||
rspFP.Close();
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
|
||||
// Exception - connection not available
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This goes and fetches the Byte array for the package from OUR, but it's pretty strange
|
||||
/// </summary>
|
||||
/// <param name="packageGuid">
|
||||
/// The package ID for the package file to be returned
|
||||
/// </param>
|
||||
/// <param name="key">
|
||||
/// This is a strange Umbraco version parameter - but it's not really an umbraco version, it's a special/odd version format like Version41
|
||||
/// but it's actually not used for the 7.5+ package installs so it's obsolete/unused.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public string fetch(string packageGuid, string key)
|
||||
{
|
||||
|
||||
byte[] fileByteArray = new byte[0];
|
||||
|
||||
if (key == string.Empty)
|
||||
{
|
||||
//SD: this is odd, not sure why it returns a different package depending on the legacy xml schema but I'll leave it for now
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema)
|
||||
fileByteArray = Webservice.fetchPackage(packageGuid);
|
||||
else
|
||||
{
|
||||
fileByteArray = Webservice.fetchPackageByVersion(packageGuid, Version.Version41);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fileByteArray = Webservice.fetchProtectedPackage(packageGuid, key);
|
||||
}
|
||||
|
||||
//successfull
|
||||
if (fileByteArray.Length > 0)
|
||||
{
|
||||
|
||||
// Check for package directory
|
||||
if (Directory.Exists(IOHelper.MapPath(Settings.PackagerRoot)) == false)
|
||||
Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagerRoot));
|
||||
|
||||
using (var fs1 = new FileStream(IOHelper.MapPath(Settings.PackagerRoot + Path.DirectorySeparatorChar + packageGuid + ".umb"), FileMode.Create))
|
||||
{
|
||||
fs1.Write(fileByteArray, 0, fileByteArray.Length);
|
||||
fs1.Close();
|
||||
return "packages\\" + packageGuid + ".umb";
|
||||
}
|
||||
}
|
||||
|
||||
// log
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObjectSlim"/> which handles common required locking logic.
|
||||
/// </summary>
|
||||
protected override void DisposeResources()
|
||||
{
|
||||
Webservice.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -346,8 +346,6 @@
|
||||
<Compile Include="businesslogic\member\MemberType.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="businesslogic\Packager\Repositories\Repository.cs" />
|
||||
<Compile Include="businesslogic\Packager\Repositories\RepositoryWebservice.cs" />
|
||||
<Compile Include="businesslogic\Packager\Settings.cs" />
|
||||
<Compile Include="businesslogic\Permission.cs">
|
||||
<SubType>Code</SubType>
|
||||
|
||||
Reference in New Issue
Block a user