/**
  * Checks if the button could be inserted
  *
  * @param integer $pageId
  * @param string $table
  *
  * @return boolean
  */
 protected function isModuleAccessible($pageId, $table)
 {
     $access = FALSE;
     // Check edit rights for page as cache can be flushed then only
     $pageinfo = t3lib_BEfunc::readPageAccess($pageId, $this->permsClause);
     if ($pageinfo !== FALSE) {
         // Get TSconfig for extension
         $tsConfig = $this->tsConfigService->getConfiguration($pageId);
         if (isset($tsConfig[$table]) && !empty($tsConfig[$table])) {
             $access = TRUE;
         }
     }
     return $access;
 }
 /**
  * Send clear cache commands for pages to defined server
  *
  * @param string $table
  * @param integer $id
  * @param string $host
  * @param boolean $quote
  *
  * @return array
  */
 public function sendClearCacheCommandForTables($table, $uid, $host = '', $quote = TRUE)
 {
     // Get current record to process
     $record = t3lib_BEfunc::getRecord($table, $uid);
     // Build request
     if ($table === 'pages') {
         $pid = $record['uid'];
     } else {
         $pid = $record['pid'];
     }
     // Log debug information
     $logData = array('table' => $table, 'uid' => $uid, 'host' => $host, 'pid' => $pid);
     $this->loggingService->debug('CommunicationService::sendClearCacheCommandForTables arguments', $logData, $pid);
     $tsConfig = $this->tsConfigService->getConfiguration($pid);
     $typolink = $tsConfig[$table . '.']['typolink.'];
     $this->contentObject->data = $record;
     $url = $this->contentObject->typoLink_URL($typolink);
     $LD = $this->contentObject->lastTypoLinkLD;
     // Check for root site
     if ($url === '' && $table === 'pages') {
         $rootline = t3lib_BEfunc::BEgetRootLine($uid);
         if (is_array($rootline) && count($rootline) > 1) {
             // If uid equals the site root we have to process
             if ($uid == $rootline[1]['uid']) {
                 $url = '/';
             }
         }
     }
     // Log debug information
     $logData['url'] = $url;
     $this->loggingService->debug('CommunicationService::sendClearCacheCommandForTables built url', $logData, $pid);
     // Process only for valid URLs
     if ($url !== '') {
         $url = $this->removeHost($url);
         $responseArray = $this->processClearCacheCommand($url, $pid, $host, $quote);
         // Check support of index.php script
         if ($this->enableIndexScript) {
             $url = $LD['url'] . $LD['linkVars'];
             $url = $this->removeHost($url);
             $indexResponseArray = $this->processClearCacheCommand($url, $pid, $host, $quote);
             $responseArray = array_merge($responseArray, $indexResponseArray);
         }
         return $responseArray;
     }
     return array(array('status' => t3lib_FlashMessage::ERROR, 'message' => array('No valid URL was generated.', 'table: ' . $table, 'uid: ' . $uid, 'host: ' . $host), 'requestHeader' => array($url)));
 }