szurubooru/src/Jobs/EditPostThumbJob.php

41 lines
737 B
PHP
Raw Normal View History

2014-05-03 18:09:31 +02:00
<?php
class EditPostThumbJob extends AbstractPostEditJob
{
const THUMB_CONTENT = 'thumb-content';
public function execute()
{
$post = $this->post;
$file = $this->getArgument(self::THUMB_CONTENT);
$post->setCustomThumbnailFromPath($file->filePath);
PostModel::save($post);
LogHelper::log('{user} changed thumb of {post}', [
'user' => TextHelper::reprUser(Auth::getCurrentUser()),
'post' => TextHelper::reprPost($post)]);
return $post;
}
public function requiresPrivilege()
{
return
[
Privilege::EditPostThumb,
Access::getIdentity($this->post->getUploader())
];
}
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
}