function getConfigurationsForBranch($rootid, $depth) { $configurationsForBranch = array(); $pageTSconfig = $this->getPageTSconfigForId($rootid); if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'])) { $sets = $pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.']; if (is_array($sets)) { foreach ($sets as $key => $value) { if (!is_array($value)) { continue; } $configurationsForBranch[] = substr($key, -1) == '.' ? substr($key, 0, -1) : $key; } } } $pids = array(); $rootLine = t3lib_BEfunc::BEgetRootLine($rootid); foreach ($rootLine as $node) { $pids[] = $node['uid']; } /* @var t3lib_pageTree */ $tree = t3lib_div::makeInstance('t3lib_pageTree'); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $tree->init('AND ' . $perms_clause); $tree->getTree($rootid, $depth, ''); foreach ($tree->tree as $node) { $pids[] = $node['row']['uid']; } $res = $this->db->exec_SELECTquery('*', 'tx_crawler_configuration', 'pid IN (' . implode(',', $pids) . ') ' . t3lib_BEfunc::BEenableFields('tx_crawler_configuration') . t3lib_BEfunc::deleteClause('tx_crawler_configuration') . ' ' . t3lib_BEfunc::versioningPlaceholderClause('tx_crawler_configuration') . ' '); while ($row = $this->db->sql_fetch_assoc($res)) { $configurationsForBranch[] = $row['name']; } $this->db->sql_free_result($res); return $configurationsForBranch; }
/** * Return the memory for the sql query. * * @return void */ public function free() { $this->db->sql_free_result($this->resource); }
/** * Directly execute a query on the db and return the result. * * @param string $query The query. * @param mixed $result If set to false, no result is returned. If set to true, an array with the rows is returned. If set to a string, an associated array is returned, where the $row[$result] is used as the key. * @return array The assoc return array. * @internal */ public function _sql($query, $result = true) { $resource = $this->db->sql_query($query); if ($resource === null) { // mysqli 6.2 return; } if ($result === false) { if ($resource !== null) { $this->db->sql_free_result($resource); } return; } if ($resource === null) { return array(); } $output = array(); if ($result === true) { while (($row = $this->db->sql_fetch_assoc($resource)) !== false) { $output[] = $row; } } else { $result = (string) $result; while (($row = $this->db->sql_fetch_assoc($resource)) !== false) { $output[$row[$result]] = $row; } } $this->db->sql_free_result($resource); return $output; }