Skip to content

Instantly share code, notes, and snippets.

@morozVA
Created March 7, 2018 20:38
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 morozVA/3dbd6df75ee73bc6cb84d45284898584 to your computer and use it in GitHub Desktop.
Save morozVA/3dbd6df75ee73bc6cb84d45284898584 to your computer and use it in GitHub Desktop.
revo массовое обновление ресурсов через процессор modx
//include MODX API
define('MODX_API_MODE', true);
require_once($_SERVER['DOCUMENT_ROOT'].'/index.php');
$modx=new modX();
$modx->initialize('web');
$q = $modx->newQuery('modResource');
$q->limit('500','0'); //($limit,$offset)
$modx->addDerivativeCriteria('modResource', $q);//
$docs = $modx->getIterator('modResource', $q);
foreach($docs as $doc){
$title = $doc->get('pagetitle') . '-' . $doc->get('id');
$alias = $doc->cleanAlias($title);
$doc->set('alias', $alias);;
$doc->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment