Skip to content

Instantly share code, notes, and snippets.

@ig0r74
Created December 13, 2017 21:28
Show Gist options
  • Select an option

  • Save ig0r74/98d270642df391acf6c46a91c22e5dfc to your computer and use it in GitHub Desktop.

Select an option

Save ig0r74/98d270642df391acf6c46a91c22e5dfc to your computer and use it in GitHub Desktop.
MODX пересохраняем все категории MiniShop2
<?php
ini_set('max_execution_time', 0);
ignore_user_abort(true);
$c = 'modResource';
$q = $modx->newQuery($c);
$q->where(array('class_key' => 'msCategory'));
$q->sortby('id');
$q->select(array(
"{$c}.*",
));
$s = $q->prepare();
$s->execute();
while ($row = $s->fetch(2)) {
$response = $modx->runProcessor('resource/update', $row);
if($response->isError()){
print_r($response->getResponse());
return;
}
$modx->error->reset();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment