I'm trying to use generateResource() to create my own cache files. My goal: If a cache file for resource 1 does not exist, create a cache file for it.
My code:
$modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
$modx->log(modX::LOG_LEVEL_DEBUG, 'lets write a file!');
$modx->getCacheManager();
$resOne = $modx->getObject('modResource',1);
$modx->cacheManager->generateResource($resOne);
This doesn't work. But I can see why it's failing...
In the core file, "modcachemanager.class.php", the method "generateResource()" checks if the resource object is processed, around line 218:
If I remove the getProcessed check, generateResource works perfectly and creates the cache file for the resource as expected.
[ed. note: elvispresley2k last edited this post 15 years ago.]