implements the file permissions report correctly and tests it.
This commit is contained in:
@@ -15,6 +15,25 @@ namespace Umbraco.Core
|
|||||||
///</summary>
|
///</summary>
|
||||||
internal static class DictionaryExtensions
|
internal static class DictionaryExtensions
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Method to Get a value by the key. If the key doesn't exist it will create a new TVal object for the key and return it.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TKey"></typeparam>
|
||||||
|
/// <typeparam name="TVal"></typeparam>
|
||||||
|
/// <param name="dict"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static TVal GetOrCreate<TKey, TVal>(this IDictionary<TKey, TVal> dict, TKey key)
|
||||||
|
where TVal : class, new()
|
||||||
|
{
|
||||||
|
if (dict.ContainsKey(key) == false)
|
||||||
|
{
|
||||||
|
dict.Add(key, new TVal());
|
||||||
|
}
|
||||||
|
return dict[key];
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates an item with the specified key with the specified value
|
/// Updates an item with the specified key with the specified value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<div>
|
||||||
|
<h1>Your permission settings are not ready for umbraco</h1>
|
||||||
|
<p>
|
||||||
|
In order to run umbraco, you'll need to update your permission settings.
|
||||||
|
Detailed information about the correct file & folder permissions for Umbraco can be found
|
||||||
|
<a href="http://our.umbraco.org/documentation/Installation/permissions"><strong>here</strong></a>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The following report list the permissions that are currently failing. Once the permissions are fixed press the 'Go back' button to restart the installation.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul class="permissions-report unstyled">
|
||||||
|
<li ng-repeat="(category, items) in installer.current.model.errors">
|
||||||
|
<h4>{{category}}</h4>
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="item in items">
|
||||||
|
{{item}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<button class="btn btn-success" ng-click="restart()">Go back</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
@@ -57,6 +57,7 @@ body {
|
|||||||
height: 550px;
|
height: 550px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -222,3 +223,19 @@ height: 5px;
|
|||||||
right: 0;
|
right: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.permissions-report {
|
||||||
|
overflow:auto;
|
||||||
|
height:320px;
|
||||||
|
margin:0;
|
||||||
|
display:block;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-report > li {
|
||||||
|
list-style:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-report h4 {
|
||||||
|
margin:7px;
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ namespace Umbraco.Web.Install.InstallSteps
|
|||||||
{
|
{
|
||||||
//first validate file permissions
|
//first validate file permissions
|
||||||
var permissionsOk = true;
|
var permissionsOk = true;
|
||||||
var report = new List<string>();
|
var reportParts = new Dictionary<string, List<string>>();
|
||||||
|
|
||||||
// Test default dir permissions
|
// Test default dir permissions
|
||||||
foreach (var dir in FilePermissionHelper.PermissionDirs)
|
foreach (var dir in FilePermissionHelper.PermissionDirs)
|
||||||
@@ -25,8 +25,9 @@ namespace Umbraco.Web.Install.InstallSteps
|
|||||||
var result = SaveAndDeleteFile(IOHelper.MapPath(dir + "/configWizardPermissionTest.txt"));
|
var result = SaveAndDeleteFile(IOHelper.MapPath(dir + "/configWizardPermissionTest.txt"));
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
var report = reportParts.GetOrCreate("Folder creation failed");
|
||||||
permissionsOk = false;
|
permissionsOk = false;
|
||||||
report.Add("Directory: ./" + dir);
|
report.Add(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,8 +37,9 @@ namespace Umbraco.Web.Install.InstallSteps
|
|||||||
var result = OpenFileForWrite(IOHelper.MapPath(file));
|
var result = OpenFileForWrite(IOHelper.MapPath(file));
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
var report = reportParts.GetOrCreate("File writing failed");
|
||||||
permissionsOk = false;
|
permissionsOk = false;
|
||||||
report.Add("File: " + file);
|
report.Add(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +51,9 @@ namespace Umbraco.Web.Install.InstallSteps
|
|||||||
SaveAndDeleteFile(IOHelper.MapPath(dir + "/configWizardPermissionTest.txt"));
|
SaveAndDeleteFile(IOHelper.MapPath(dir + "/configWizardPermissionTest.txt"));
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
var report = reportParts.GetOrCreate("File writing for packages failed");
|
||||||
permissionsOk = false;
|
permissionsOk = false;
|
||||||
report.Add("Directory: " + dir);
|
report.Add(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +70,8 @@ namespace Umbraco.Web.Install.InstallSteps
|
|||||||
if (tempFile.Substring(0, 1) == "/")
|
if (tempFile.Substring(0, 1) == "/")
|
||||||
tempFile = tempFile.Substring(1, tempFile.Length - 1);
|
tempFile = tempFile.Substring(1, tempFile.Length - 1);
|
||||||
|
|
||||||
report.Add(string.Format("File ./{0}. Error: {1}", tempFile, ee));
|
var report = reportParts.GetOrCreate("Cache file writing failed");
|
||||||
|
report.Add(tempFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test creation of folders
|
// Test creation of folders
|
||||||
@@ -80,12 +84,14 @@ namespace Umbraco.Web.Install.InstallSteps
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
permissionsOk = false;
|
permissionsOk = false;
|
||||||
report.Add("Folder creation failed");
|
var report = reportParts.GetOrCreate("Media folder creation failed");
|
||||||
|
report.Add("Could not create sub folders in " + SystemDirectories.Media);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (permissionsOk == false)
|
if (permissionsOk == false)
|
||||||
{
|
{
|
||||||
throw new InstallException("Permission check failed", "permissionsReport", new { errors = report });
|
throw new InstallException("Permission check failed", "permissionsreport", new { errors = reportParts });
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user