From edd087f80bc486b61db65383895acf9e22c4b76b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 16 Oct 2008 12:18:16 +0000 Subject: [PATCH] API CHANGE Removed SiteTree->makelinksunique() and SiteTree->makelinksuniquequick() - use new SiteTreeMaintenanceTask git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64416 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/SiteTree.php | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index b3bf3d451..6ee7337bf 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -915,46 +915,6 @@ class SiteTree extends DataObject { return $t; } - - function makelinksunique() { - $badURLs = "'" . implode("', '", DB::query("SELECT URLSegment, count(*) FROM SiteTree GROUP BY URLSegment HAVING count(*) > 1")->column()) . "'"; - $pages = DataObject::get("SiteTree", "URLSegment IN ($badURLs)"); - - foreach($pages as $page) { - echo "
  • $page->Title: "; - $urlSegment = $page->URLSegment; - $page->write(); - if($urlSegment != $page->URLSegment) { - echo sprintf(_t('SiteTree.LINKSCHANGEDTO', " changed %s -> %s"), $urlSegment, $page->URLSegment); - } - else { - echo sprintf(_t('SiteTree.LINKSALREADYUNIQUE', " %s is already unique"), $urlSegment); - } - die(); - } - } - - - function makelinksuniquequick() { - $badURLs = "'" . implode("', '", DB::query("SELECT URLSegment, count(*) FROM SiteTree GROUP BY URLSegment HAVING count(*) > 1")->column()) . "'"; - $pages = DB::query("SELECT *, SiteTree.ID FROM SiteTree LEFT JOIN Page ON Page.ID = SiteTree.ID WHERE URLSegment IN ($badURLs)"); - - foreach($pages as $page) { - echo "
  • $page[Title]: "; - $urlSegment = $page['URLSegment']; - $newURLSegment = $urlSegment . '-' . $page['ID']; - DB::query("UPDATE SiteTree SET URLSegment = '$newURLSegment' WHERE ID = $page[ID]"); - if($urlSegment != $newURLSegment) { - echo sprintf(_t('SiteTree.LINKSCHANGEDTO'), $urlSegment, $newURLSegment); - } - else { - echo sprintf(_t('SiteTree.LINKSALREADYUNIQUE'), $urlSegment); - } - } - echo "

    done"; - } - - /** * Replace a URL in html content with a new URL. * @param string $old The old URL