/** * Constructor. * * @param array $options Class instances / Echo to cli? */ public function __construct(array $options = []) { $defaults = ['Echo' => true, 'Logger' => null, 'Groups' => null, 'NNTP' => null, 'Settings' => null]; $options += $defaults; $this->_echoCLI = $options['Echo'] && nZEDb_ECHOCLI; $this->pdo = $options['Settings'] instanceof \nzedb\db\Settings ? $options['Settings'] : new \nzedb\db\Settings(); $this->_groups = $options['Groups'] instanceof Groups ? $options['Groups'] : new \Groups(['Settings' => $this->pdo]); $this->_nntp = $options['NNTP'] instanceof NNTP ? $options['NNTP'] : new \NNTP(['Settings' => $this->pdo]); $this->_debug = nZEDb_LOGGING || nZEDb_DEBUG; if ($this->_debug) { try { $this->_debugging = $options['Logger'] instanceof Logger ? $options['Logger'] : new \Logger(['ColorCLI' => $this->pdo->log]); } catch (\LoggerException $error) { $this->_debug = false; } } $this->_compressedHeaders = $this->pdo->getSetting('compressedheaders') == 1 ? true : false; $this->_safeBackFillDate = $this->pdo->getSetting('safebackfilldate') != '' ? (string) $this->pdo->getSetting('safebackfilldate') : '2008-08-14'; $this->_safePartRepair = $this->pdo->getSetting('safepartrepair') == 1 ? 'update' : 'backfill'; $this->_tablePerGroup = $this->pdo->getSetting('tablepergroup') == 1 ? true : false; }