/** * Constructor. */ public function __construct() { Piwik::postTestEvent("MySQLMetadataProvider.createDao", array(&$this->dataAccess)); if ($this->dataAccess === null) { $this->dataAccess = new MySQLMetadataDataAccess(); } }
/** * Returns a configuration value or section by name. * * @param string $name The value or section name. * @return string|array The requested value requested. Returned by reference. * @throws Exception If the value requested not found in either `config.ini.php` or * `global.ini.php`. * @api */ public function &__get($name) { if (!$this->initialized) { $this->init(); // must be called here, not in init(), since setTestEnvironment() calls init(). (this avoids // infinite recursion) Piwik::postTestEvent('Config.createConfigSingleton', array($this)); } // check cache for merged section if (isset($this->configCache[$name])) { $tmp =& $this->configCache[$name]; return $tmp; } $section = $this->getFromGlobalConfig($name); $sectionCommon = $this->getFromCommonConfig($name); if (empty($section) && !empty($sectionCommon)) { $section = $sectionCommon; } elseif (!empty($section) && !empty($sectionCommon)) { $section = $this->array_merge_recursive_distinct($section, $sectionCommon); } if (isset($this->configLocal[$name])) { // local settings override the global defaults $section = $section ? array_merge($section, $this->configLocal[$name]) : $this->configLocal[$name]; } if ($section === null) { throw new Exception("Error while trying to read a specific config file entry <strong>'{$name}'</strong> from your configuration files.</b>If you just completed a Piwik upgrade, please check that the file config/global.ini.php was overwritten by the latest Piwik version."); } // cache merged section for later $this->configCache[$name] = $this->decodeValues($section); $tmp =& $this->configCache[$name]; return $tmp; }
/** * Reload super user access * * @return bool */ protected function reloadAccessSuperUser() { $this->isSuperUser = true; try { $allSitesId = Plugins\SitesManager\API::getInstance()->getAllSitesId(); } catch (\Exception $e) { $allSitesId = array(); } $this->idsitesByAccess['superuser'] = $allSitesId; $this->login = Config::getInstance()->superuser['login']; Piwik::postTestEvent('Access.loadingSuperUserAccess', array(&$this->idsitesByAccess, &$this->login)); return true; }
public function send($transport = null) { if (defined('PIWIK_TEST_MODE')) { // hack Piwik::postTestEvent("Test.Mail.send", array($this)); } else { return parent::send($transport); } }
/** * Returns a configuration value or section by name. * * @param string $name The value or section name. * @return string|array The requested value requested. Returned by reference. * @throws Exception If the value requested not found in either `config.ini.php` or * `global.ini.php`. * @api */ public function &__get($name) { if (!$this->initialized) { $this->init(); // must be called here, not in init(), since setTestEnvironment() calls init(). (this avoids // infinite recursion) Piwik::postTestEvent('Config.createConfigSingleton', array($this, &$this->configCache, &$this->configLocal)); } // check cache for merged section if (isset($this->configCache[$name])) { $tmp =& $this->configCache[$name]; return $tmp; } $section = $this->getFromGlobalConfig($name); $sectionCommon = $this->getFromCommonConfig($name); if (empty($section) && !empty($sectionCommon)) { $section = $sectionCommon; } elseif (!empty($section) && !empty($sectionCommon)) { $section = $this->array_merge_recursive_distinct($section, $sectionCommon); } if (isset($this->configLocal[$name])) { // local settings override the global defaults $section = $section ? array_merge($section, $this->configLocal[$name]) : $this->configLocal[$name]; } if ($section === null && $name == 'superuser') { $user = $this->getConfigSuperUserForBackwardCompatibility(); return $user; } else { if ($section === null) { $section = array(); } } // cache merged section for later $this->configCache[$name] = $this->decodeValues($section); $tmp =& $this->configCache[$name]; return $tmp; }
/** * Returns a configuration value or section by name. * * @param string $name The value or section name. * @return string|array The requested value requested. Returned by reference. * @throws Exception If the value requested not found in either `config.ini.php` or * `global.ini.php`. * @api */ public function &__get($name) { if (!$this->initialized) { $this->reload(array($this->pathGlobal, $this->pathCommon), $this->pathLocal); // must be called here, not in init(), since setTestEnvironment() calls init(). (this avoids // infinite recursion) $allSettings =& $this->settings->getAll(); Piwik::postTestEvent('Config.createConfigSingleton', array($this, &$allSettings)); } $section =& $this->settings->get($name); return $section; }