/** * Empty a map service cache * @param string $repository Repository for which to remove all tile cache * @return Redirection to the index */ function removeLayerCache() { // Create response to redirect to the index $rep = $this->getResponse("redirect"); $rep->action = "admin~config:index"; $repository = $this->param('repository'); $lrep = lizmap::getRepository($repository); if (!$lrep) { jMessage::add('The repository ' . strtoupper($repository) . ' does not exist !', 'error'); return $rep; } $project = $this->param('project'); try { $lproj = lizmap::getProject($lrep->getKey() . '~' . $project); if (!$lproj) { jMessage::add('The lizmapProject ' . strtoupper($project) . ' does not exist !', 'error'); return $rep; } $layer = $this->param('layer'); // Remove project cache $lproj->clearCache(); // Remove the cache for the layer lizmapProxy::clearLayerCache($repository, $project, $layer); jMessage::add(jLocale::get("admin~admin.cache.layer.removed", array($layer))); return $rep; } catch (UnknownLizmapProjectException $e) { jLog::logEx($e, 'error'); jMessage::add('The lizmapProject ' . strtoupper($project) . ' does not exist !', 'error'); return $rep; } return $rep; }