public function __construct(ApplicationTool $appTool) { $this->tablePrefix = $appTool->getProperty('tablePrefix'); $jsonFile = $appTool->getProperty('directory') . '/meta.json'; $dataStr = file_get_contents($jsonFile); if ($dataStr === false) { throw new Error("Cannot open the meta file: {$jsonFile}"); } $this->data = json_decode($dataStr, true); if (!isset($this->data)) { throw new Error("Invalid JSON data in the meta file: {$jsonFile}"); } Helper::formatArray($this->data, ['fields' => ['fields' => ['default' => []], 'fieldSets' => ['default' => []], 'taxonomies' => ['default' => []], 'roles' => ['default' => []], 'langs' => ['default' => []], 'status' => ['default' => []], 'contributorTypes' => ['default' => []]]]); }
private function loadRootId() { $site = $this->app->getProperty('site'); $qi = $this->getQI(); $id = $qi->queryFetchSingleCell('select s.root_id from site s inner join resource r on s.root_id = r.resource_id where s.code = ' . $qi->quote($site, \PDO::PARAM_STR) . ' and r.status_code = ' . $qi->quote(MetaService::STATUS_PUBLISHED, \PDO::PARAM_STR)); return isset($id) ? intval($id) : null; }
public function __construct(ApplicationTool $appTool) { $this->AppTool = $appTool; $cnInfo = $appTool->getProperty('db'); if (isset($cnInfo['tablePrefix'])) { $this->TablePrefix = $cnInfo['tablePrefix']; unset($cnInfo['tablePrefix']); } else { $this->TablePrefix = ''; } $this->cnInfo = $cnInfo; }