Skip to content

Instantly share code, notes, and snippets.

@jaygilmore
Forked from opengeek/recalculateURIs.php
Created October 25, 2017 19:41
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 jaygilmore/8c4e27da42fa64662832805dd4c70a7a to your computer and use it in GitHub Desktop.
Save jaygilmore/8c4e27da42fa64662832805dd4c70a7a to your computer and use it in GitHub Desktop.
Script to recalculate all unfrozen URI values for MODX Resources in 2.1.x+
<?php
include 'config.core.php';
include MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->exec("UPDATE {$modx->getTableName('modResource')} SET uri = '' WHERE uri_override = 0");
$modx->call('modResource', 'refreshURIs', array(&$modx));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment