We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21508
    • 46 Posts
    Created gadget with button on which the removal of the folder.
    $fields = array(
    	'path' => $this->modx->getOption('core_path'),
    	'folder' => 'cache'
    
    );
    if (!$this->modx->hasPermission('file_manager')) {
    	$this->chunk_array['clear_cache_ok'] = $this->modx->lexicon('permission_denied');
    	break;
    }
    
    $response = $this->modx->runProcessor('system/filesys/folder/remove', $fields);
    if ($response->isError()) {
    	$this->modx->log(modX::LOG_LEVEL_ERROR, 'Failed to remove cache folder. ' . $response->getMessage());
    	$this->chunk_array['clear_cache_ok'] = $this->modx->lexicon('refresh_failure');
    	break;
    }
    
    $response = $this->modx->runProcessor('system/filesys/folder/create', $fields);
    if ($response->isError()) {
    	$this->modx->log(modX::LOG_LEVEL_ERROR, 'Failed to create cache folder.' . $response->getMessage());
    }
    
    $this->chunk_array['clear_cache_ok'] = $this->modx->lexicon('refresh_success');
    


    With setting
    cache_handler = xPDOFileCache
    it works fine
    With setting
    cache_handler = cache.xPDOMemCached
    returns an error
    {"modx-resource-tree":["\/root\/web_0"],"undefined-sort-default":"menuindex","undefined-sort":"menuindex"}


    Help solve the problem.
      It’s Nice to Be Important, But It’s More Important to Be Nice