Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active October 23, 2019 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/b6cf3ac6279d55c5dbb0a62ae7ca2786 to your computer and use it in GitHub Desktop.
Save hissy/b6cf3ac6279d55c5dbb0a62ae7ca2786 to your computer and use it in GitHub Desktop.
#concrete5 c5:exec command to bulk clear page paths for all pages
<?php
$list = new \Concrete\Core\Page\PageList();
$list->ignorePermissions();
$pages = $list->getResults();
$count = 0;
/** @var \Concrete\Core\Page\Page $page */
foreach ($pages as $page) {
$paths = $page->getAdditionalPagePaths();
if (count($paths) > 0) {
$page->clearPagePaths();
$page->rescanCollectionPath();
}
++$count;
}
echo sprintf('%d pages rescanned.', $count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment