Moved some config keys

This commit is contained in:
Marcin Kurczewski 2014-05-26 12:30:23 +02:00
parent 50e4b40721
commit 34b5de72f5
12 changed files with 26 additions and 22 deletions

View file

@ -14,7 +14,6 @@ salt = "1A2/$_4xVa"
[misc]
featuredPostMaxDays=7
debugQueries=0
logAnonymousUploads=1
githubLink = http://github.com/rr-/szurubooru
[help]
@ -54,6 +53,11 @@ minLength = 5
maxLength = 2000
commentsPerPage = 10
maxCommentsInList = 5
needEmailForCommenting = 0
[uploads]
needEmailForUploading = 1
logAnonymousUploads=1
[registration]
staffActivation = 0
@ -64,8 +68,6 @@ userNameMaxLength = 20
userNameRegex = "/^[\w_-]+$/ui"
needEmailForRegistering = 1
needEmailForCommenting = 0
needEmailForUploading = 1
confirmationEmailEnabled = 1
confirmationEmailSenderName = "{host} mailing system"
confirmationEmailSenderEmail = "noreply@{host}"

View file

@ -52,6 +52,6 @@ class AddCommentJob extends AbstractJob
public function isConfirmedEmailRequired()
{
return Core::getConfig()->registration->needEmailForCommenting;
return Core::getConfig()->comments->needEmailForCommenting;
}
}

View file

@ -58,6 +58,6 @@ class PreviewCommentJob extends AbstractJob
public function isConfirmedEmailRequired()
{
return Core::getConfig()->registration->needEmailForCommenting;
return Core::getConfig()->comments->needEmailForCommenting;
}
}

View file

@ -48,7 +48,7 @@ class AddPostJob extends AbstractJob
PostModel::save($post);
Logger::log('{user} added {post} (tags: {tags}, safety: {safety}, source: {source})', [
'user' => ($anonymous and !Core::getConfig()->misc->logAnonymousUploads)
'user' => ($anonymous and !Core::getConfig()->uploads->logAnonymousUploads)
? TextHelper::reprUser(UserModel::getAnonymousName())
: TextHelper::reprUser(Auth::getCurrentUser()),
'post' => TextHelper::reprPost($post),
@ -83,6 +83,6 @@ class AddPostJob extends AbstractJob
public function isConfirmedEmailRequired()
{
return Core::getConfig()->registration->needEmailForUploading;
return Core::getConfig()->uploads->needEmailForUploading;
}
}

View file

@ -61,7 +61,7 @@ class ApiAuthTest extends AbstractFullApiTest
public function testAuthEnforcing()
{
Core::getConfig()->registration->needEmailForCommenting = false;
Core::getConfig()->comments->needEmailForCommenting = false;
$this->grantAccess('addComment');
$comment = $this->commentMocker->mockSingle();

View file

@ -3,8 +3,8 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest
{
public function testRegularEmailRequirements()
{
Core::getConfig()->registration->needEmailForCommenting = true;
Core::getConfig()->registration->needEmailForUploading = true;
Core::getConfig()->comments->needEmailForCommenting = true;
Core::getConfig()->uploads->needEmailForUploading = true;
$this->testRegularEmailRequirement(new AcceptUserRegistrationJob());
$this->testRegularEmailRequirement(new ActivateUserEmailJob());
@ -69,10 +69,10 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest
{
$this->testedJobs []= $job;
Core::getConfig()->registration->needEmailForCommenting = false;
Core::getConfig()->comments->needEmailForCommenting = false;
$this->assert->areEqual(false, $job->isConfirmedEmailRequired());
Core::getConfig()->registration->needEmailForCommenting = true;
Core::getConfig()->comments->needEmailForCommenting = true;
$this->assert->areEqual(true, $job->isConfirmedEmailRequired());
}
@ -82,10 +82,10 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest
$this->testedJobs []= $job;
Core::getConfig()->registration->needEmailForUploading = false;
Core::getConfig()->uploads->needEmailForUploading = false;
$this->assert->areEqual(false, $job->isConfirmedEmailRequired());
Core::getConfig()->registration->needEmailForUploading = true;
Core::getConfig()->uploads->needEmailForUploading = true;
$this->assert->areEqual(true, $job->isConfirmedEmailRequired());
}
@ -93,7 +93,7 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest
{
$this->grantAccess('addComment');
$this->login($this->userMocker->mockSingle());
Core::getConfig()->registration->needEmailForCommenting = true;
Core::getConfig()->comments->needEmailForCommenting = true;
$this->assert->throws(function()
{
$post = $this->postMocker->mockSingle();

View file

@ -205,7 +205,7 @@ class ApiPrivilegeTest extends AbstractFullApiTest
public function testPrivilegeEnforcing()
{
$post = $this->postMocker->mockSingle();
Core::getConfig()->registration->needEmailForCommenting = false;
Core::getConfig()->comments->needEmailForCommenting = false;
$this->assert->throws(function() use ($post)
{
@ -221,7 +221,7 @@ class ApiPrivilegeTest extends AbstractFullApiTest
public function testComplexPrivilegeEnforcing()
{
$post = $this->postMocker->mockSingle();
Core::getConfig()->registration->needEmailForCommenting = false;
Core::getConfig()->comments->needEmailForCommenting = false;
$this->grantAccess('editPost.own');
$this->grantAccess('editPostTags.own');
$this->revokeAccess('editPost.all');

View file

@ -4,7 +4,7 @@ class ApiControllerTest extends AbstractTest
public function testRunning()
{
Core::getConfig()->registration->needEmailForRegistering = false;
Core::getConfig()->registration->needEmailForUploading = false;
Core::getConfig()->uploads->needEmailForUploading = false;
$user = $this->userMocker->mockSingle();
$this->grantAccess('addPost');

View file

@ -109,7 +109,7 @@ class AddCommentJobTest extends AbstractTest
protected function prepare()
{
Core::getConfig()->registration->needEmailForCommenting = false;
Core::getConfig()->comments->needEmailForCommenting = false;
$this->grantAccess('addComment');
$this->login($this->userMocker->mockSingle());
}

View file

@ -180,6 +180,6 @@ class AddPostJobTest extends AbstractTest
protected function prepare()
{
Core::getConfig()->registration->needEmailForUploading = false;
Core::getConfig()->uploads->needEmailForUploading = false;
}
}

View file

@ -106,7 +106,7 @@ class PreviewCommentJobTest extends AbstractTest
protected function prepare()
{
Core::getConfig()->registration->needEmailForCommenting = false;
Core::getConfig()->comments->needEmailForCommenting = false;
$this->grantAccess('addComment');
$this->login($this->userMocker->mockSingle());
}

View file

@ -10,7 +10,6 @@ salt = "salt..."
[misc]
featuredPostMaxDays=7
debugQueries=0
logAnonymousUploads=1
[help]
title=Help
@ -50,6 +49,9 @@ maxLength = 2000
commentsPerPage = 10
maxCommentsInList = 5
[uploads]
logAnonymousUploads=1
[registration]
staffActivation = 0
passMinLength = 5