Skip to content
Permalink
Browse files

fix url update on page move

  • Loading branch information...
maskas committed Oct 28, 2014
1 parent 109f4ef commit 66db78cc8477f9e43ab1e9f53c25e25983c59e7e
Showing with 14 additions and 6 deletions.
  1. +14 −6 Ip/Internal/Content/Model.php
@@ -611,12 +611,20 @@ public static function updateUrl($oldUrl, $newUrl)
return;
}
// \b - start at word boundary
// (https?://) - protocol
// (/?) - allow optional slash at the end of url
// (?= ) - symbols expected after url
// \Z - end of subject or end of line
$search = '%\b(https?://)' . preg_quote($oldPart, '%') . '(/?)(?=["\'?]|\s|\Z)%';
if ($newUrl == ipConfig()->baseUrl()) {
//the website has been moved
$search = '%\b(https?://)' . preg_quote($oldPart, '%') . '%';
} else {
//internal page url has changed
// \b - start at word boundary
// (https?://) - protocol
// (/?) - allow optional slash at the end of url
// (?= ) - symbols expected after url
// \Z - end of subject or end of line
$search = '%\b(https?://)' . preg_quote($oldPart, '%') . '(/?)(?=["\'?]|\s|\Z)%';
}
foreach ($records as $row) {
$data = json_decode($row['data'], true);

0 comments on commit 66db78c

Please sign in to comment.
You can’t perform that action at this time.