|
|
@ -1,7 +1,8 @@ |
|
|
|
<?php namespace WpsMcloud\Actions\Convert\Replacer; |
|
|
|
|
|
|
|
use WpsMcloud\Actions\Convert\ReplacerService; |
|
|
|
use WpsMcloud\Models\PostAttachment; |
|
|
|
use WpsMcloud\Actions\Convert\ReplacerService; |
|
|
|
use WpsMcloud\Exceptions\UrlDetectException; |
|
|
|
|
|
|
|
class PostAttachmentReplacer |
|
|
|
{ |
|
|
@ -36,6 +37,20 @@ class PostAttachmentReplacer |
|
|
|
$post->getUrl() |
|
|
|
); |
|
|
|
|
|
|
|
if ($this->mcloudPostUrl == $post->getUrl()) { |
|
|
|
throw new UrlDetectException( |
|
|
|
sprintf(<<<EOF |
|
|
|
Your site url has manual changed in wp-config and not appropriate with post attachments guids. |
|
|
|
Guid: %s |
|
|
|
Manual url: %s |
|
|
|
|
|
|
|
EOF, |
|
|
|
$post->getUrl(), |
|
|
|
$replacer->getUploadsDirBaseUrl() |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
$this->mcloudPostBaseUrl = trailingslashit( |
|
|
|
str_replace($this->post->getBasename(), '', $this->mcloudPostUrl) |
|
|
|
); |
|
|
|