コード例 #1
0
 public function setUp()
 {
     // make sure logging logic is executed so we can test whether there are bugs in the logging code
     Log::getInstance()->setLogLevel(Log::VERBOSE);
     $this->ldapUsers = new LdapUsers();
     $this->ldapUsers->setLdapServers(array(new ServerInfo("localhost", "basedn")));
     $this->ldapUsers->setLdapUserMapper(new UserMapper());
 }
コード例 #2
0
ファイル: CoreArchiver.php プロジェクト: brienomatty/elmsln
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $url = $input->getOption('url');
     if ($input->getOption('piwik-domain') && !$url) {
         $_SERVER['argv'][] = '--url=' . $input->getOption('piwik-domain');
     }
     if (is_string($url) && $url && in_array($url, array('http://', 'https://'))) {
         // see http://dev.piwik.org/trac/ticket/5180 and http://forum.piwik.org/read.php?2,115274
         throw new \InvalidArgumentException('No valid URL given. If you have specified a valid URL try --piwik-domain instead of --url');
     }
     if ($input->getOption('verbose')) {
         Log::getInstance()->setLogLevel(Log::VERBOSE);
     }
     include PIWIK_INCLUDE_PATH . '/misc/cron/archive.php';
 }
コード例 #3
0
ファイル: CoreArchiver.php プロジェクト: a4tunado/piwik
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $url = $input->getOption('url') ?: $input->getOption('piwik-domain');
     if (empty($url)) {
         throw new \InvalidArgumentException("The --url argument is not set. It should be set to your Piwik URL, for example: --url=http://example.org/piwik/.");
     }
     if (is_string($url) && $url && in_array($url, array('http://', 'https://'))) {
         // see https://github.com/piwik/piwik/issues/5180 and http://forum.piwik.org/read.php?2,115274
         throw new \InvalidArgumentException('No valid URL given. If you have specified a valid URL try --piwik-domain instead of --url');
     }
     if ($input->getOption('verbose')) {
         Log::getInstance()->setLogLevel(Log::VERBOSE);
     }
     $archiver = $this->makeArchiver($url, $input);
     try {
         $archiver->main();
     } catch (Exception $e) {
         $archiver->logFatalError($e->getMessage());
     }
 }
コード例 #4
0
 public function setUp()
 {
     if (!function_exists('ldap_bind')) {
         throw new \Exception("PHP not compiled w/ --with-ldap!");
     }
     if (!$this->isLdapServerRunning()) {
         throw new \Exception("LDAP server not found on port localhost:389. For integration tests, an LDAP server must be running with the " . "data and configuration found in tests/travis/setup_ldap.sh script. An OpenLDAP server is expected, but any " . "will work assuming the attributes names & data are the same.");
     }
     parent::setUp();
     Log::info("Setting up " . get_class($this));
     // make sure logging logic is executed so we can test whether there are bugs in the logging code
     Log::getInstance()->setLogLevel(Log::DEBUG);
     Config::getInstance()->LoginLdap = Config::getInstance()->LoginLdapTest + array('servers' => 'testserver', 'use_webserver_auth' => 'false', 'new_user_default_sites_view_access' => '1,2', 'synchronize_users_after_login' => 1);
     Config::getInstance()->LoginLdap_testserver = Config::getInstance()->LoginLdap_testserver + array('hostname' => self::SERVER_HOST_NAME, 'port' => self::SERVER_PORT, 'base_dn' => self::SERVER_BASE_DN, 'admin_user' => 'cn=fury,' . self::SERVER_BASE_DN, 'admin_pass' => 'secrets');
     LdapFunctions::$phpUnitMock = null;
     // create sites referenced in setup_ldap.sh
     Fixture::createWebsite('2013-01-01 00:00:00');
     Fixture::createWebsite('2013-01-01 00:00:00');
     Fixture::createWebsite('2013-01-01 00:00:00');
 }
コード例 #5
0
ファイル: Common.php プロジェクト: emersonmatsumoto/piwik
 public static function printDebug($info = '')
 {
     if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
         if (is_object($info)) {
             $info = var_export($info, true);
         }
         Log::getInstance()->setLogLevel(Log::DEBUG);
         if (is_array($info) || is_object($info)) {
             $info = Common::sanitizeInputValues($info);
             $out = var_export($info, true);
             foreach (explode("\n", $out) as $line) {
                 Log::debug($line);
             }
         } else {
             foreach (explode("\n", $info) as $line) {
                 Log::debug(htmlspecialchars($line, ENT_QUOTES));
             }
         }
     }
 }
コード例 #6
0
ファイル: CronArchive.php プロジェクト: pombredanne/ArcherSys
 /**
  * Configures Piwik\Log so messages are written in output
  */
 private function initLog()
 {
     $config = Config::getInstance();
     $log = $config->log;
     $log['log_only_when_debug_parameter'] = 0;
     $log[Log::LOG_WRITERS_CONFIG_OPTION][] = "screen";
     $config->log = $log;
     // Make sure we log at least INFO (if logger is set to DEBUG then keep it)
     $logLevel = Log::getInstance()->getLogLevel();
     if ($logLevel < Log::INFO) {
         Log::getInstance()->setLogLevel(Log::INFO);
     }
 }
コード例 #7
0
ファイル: CronArchive.php プロジェクト: brienomatty/elmsln
 /**
  * Configures Piwik\Log so messages are written in output
  */
 private function initLog()
 {
     $config = Config::getInstance();
     /**
      * access a property that is not overriden by TestingEnvironment before accessing log as the
      * log section is used in TestingEnvironment. Otherwise access to magic __get('log') fails in
      * TestingEnvironment as it tries to acccess it already here with __get('log').
      * $config->log ==> __get('log') ==> Config.createConfigInstance ==> nested __get('log') ==> returns null
      */
     $initConfigToPreventErrorWhenAccessingLog = $config->mail;
     $log = $config->log;
     $log['log_only_when_debug_parameter'] = 0;
     $log[\Piwik\Log::LOG_WRITERS_CONFIG_OPTION] = array("screen");
     if (!empty($_GET['forcelogtoscreen'])) {
         Log::getInstance()->addLogWriter('screen');
     }
     // Make sure we log at least INFO (if logger is set to DEBUG then keep it)
     $logLevel = Log::getInstance()->getLogLevel();
     if ($logLevel != Log::VERBOSE && $logLevel != Log::DEBUG) {
         Log::getInstance()->setLogLevel(Log::INFO);
     }
     $config->log = $log;
 }
コード例 #8
0
 public function setUp()
 {
     // make sure logging logic is executed so we can test whether there are bugs in the logging code
     Log::getInstance()->setLogLevel(Log::VERBOSE);
     LdapFunctions::$phpUnitMock = $this->getMock('stdClass', array('ldap_connect', 'ldap_close', 'ldap_bind', 'ldap_search', 'ldap_set_option', 'ldap_get_entries', 'ldap_count_entries'));
 }