2014-05-03 19:50:35 +02:00
|
|
|
<?php
|
2014-05-03 22:18:41 +02:00
|
|
|
class ScorePostJob extends AbstractPostJob
|
2014-05-03 19:50:35 +02:00
|
|
|
{
|
|
|
|
public function execute()
|
|
|
|
{
|
|
|
|
$post = $this->post;
|
2014-05-12 00:13:18 +02:00
|
|
|
$score = intval($this->getArgument(JobArgs::ARG_NEW_POST_SCORE));
|
2014-05-03 19:50:35 +02:00
|
|
|
|
|
|
|
UserModel::updateUserScore(Auth::getCurrentUser(), $post, $score);
|
2014-05-09 13:46:29 +02:00
|
|
|
|
|
|
|
return $post;
|
2014-05-03 19:50:35 +02:00
|
|
|
}
|
|
|
|
|
2014-05-12 10:31:34 +02:00
|
|
|
public function getRequiredSubArguments()
|
|
|
|
{
|
|
|
|
return JobArgs::ARG_NEW_POST_SCORE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredPrivileges()
|
2014-05-03 19:50:35 +02:00
|
|
|
{
|
2014-05-04 16:27:15 +02:00
|
|
|
return new Privilege(
|
2014-05-03 19:50:35 +02:00
|
|
|
Privilege::ScorePost,
|
2014-05-04 16:27:15 +02:00
|
|
|
Access::getIdentity($this->post->getUploader()));
|
2014-05-03 19:50:35 +02:00
|
|
|
}
|
2014-05-06 18:36:11 +02:00
|
|
|
|
2014-05-12 10:31:34 +02:00
|
|
|
public function isAuthenticationRequired()
|
2014-05-06 18:36:11 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-05-03 19:50:35 +02:00
|
|
|
}
|