2014-05-03 18:09:31 +02:00
|
|
|
<?php
|
2014-05-04 17:53:40 +02:00
|
|
|
class EditPostJob extends AbstractPostEditJob
|
2014-05-03 18:09:31 +02:00
|
|
|
{
|
|
|
|
public function execute()
|
|
|
|
{
|
|
|
|
$post = $this->post;
|
|
|
|
|
2014-05-04 13:39:00 +02:00
|
|
|
LogHelper::bufferChanges();
|
|
|
|
|
2014-05-03 18:09:31 +02:00
|
|
|
$subJobs =
|
|
|
|
[
|
|
|
|
new EditPostSafetyJob(),
|
|
|
|
new EditPostTagsJob(),
|
|
|
|
new EditPostSourceJob(),
|
|
|
|
new EditPostRelationsJob(),
|
|
|
|
new EditPostContentJob(),
|
|
|
|
new EditPostUrlJob(),
|
|
|
|
new EditPostThumbJob(),
|
|
|
|
];
|
|
|
|
|
|
|
|
foreach ($subJobs as $subJob)
|
|
|
|
{
|
2014-05-04 17:53:40 +02:00
|
|
|
if ($this->skipSaving)
|
|
|
|
$subJob->skipSaving();
|
|
|
|
|
2014-05-03 18:09:31 +02:00
|
|
|
$args = $this->getArguments();
|
2014-05-04 17:53:40 +02:00
|
|
|
$args[self::POST_ENTITY] = $post;
|
2014-05-03 18:09:31 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
Api::run($subJob, $args);
|
|
|
|
}
|
|
|
|
catch (ApiMissingArgumentException $e)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-04 17:53:40 +02:00
|
|
|
if (!$this->skipSaving)
|
|
|
|
PostModel::save($post);
|
|
|
|
|
2014-05-04 13:39:00 +02:00
|
|
|
LogHelper::flush();
|
2014-05-03 18:09:31 +02:00
|
|
|
return $post;
|
|
|
|
}
|
|
|
|
}
|