diff --git a/core/CliMulti/Process.php b/core/CliMulti/Process.php index 905523cbf23602df19ed6f68a4b565f438ec3dea..907d178e40900fd4602cbfb76cd45898bb5b8d4b 100644 --- a/core/CliMulti/Process.php +++ b/core/CliMulti/Process.php @@ -125,7 +125,7 @@ class Process } $lockedPID = trim($content); - $runningPIDs = explode("\n", trim( `ps -e | awk '{print $1}'` )); + $runningPIDs = explode("\n", trim( `ps ex | awk '{print $1}'` )); return !empty($lockedPID) && in_array($lockedPID, $runningPIDs); } diff --git a/core/Log.php b/core/Log.php index a28032be9bb6646c274c160668424610313fdf35..34364978840ede5ba92143055c697d52b5953a36 100644 --- a/core/Log.php +++ b/core/Log.php @@ -167,14 +167,6 @@ class Log extends Singleton */ protected function __construct() { - /** - * 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::getInstance()->mail; - $logConfig = Config::getInstance()->log; $this->setCurrentLogLevelFromConfig($logConfig); $this->setLogWritersFromConfig($logConfig); diff --git a/core/UrlHelper.php b/core/UrlHelper.php index b2bbd229bb769e952212dba1d3ff475c32dd9354..9262ec392da90abe198fe0e9d24a9ef708b5409e 100644 --- a/core/UrlHelper.php +++ b/core/UrlHelper.php @@ -394,20 +394,18 @@ class UrlHelper $key = self::getParameterFromQueryString($query, $variableName); $key = trim(urldecode($key)); - // Special case: Google & empty q parameter + // Special cases: empty or no keywords if (empty($key) - && $variableName == 'q' - && ( // Google search with no keyword ($searchEngineName == 'Google' - && ( // First, they started putting an empty q= parameter - strpos($query, '&q=') !== false - || strpos($query, '?q=') !== false - // then they started sending the full host only (no path/query string) - || (empty($query) && (empty($referrerPath) || $referrerPath == '/') && empty($referrerParsed['fragment'])) - ) + && (empty($query) && (empty($referrerPath) || $referrerPath == '/') && empty($referrerParsed['fragment'])) ) + + // empty keyword parameter + || strpos($query, sprintf('&%s=', $variableName)) !== false + || strpos($query, sprintf('?%s=', $variableName)) !== false + // search engines with no keyword || $searchEngineName == 'Google Images' || $searchEngineName == 'DuckDuckGo') diff --git a/tests/PHPUnit/TestingEnvironment.php b/tests/PHPUnit/TestingEnvironment.php index d2e8ad5c76b167041bfe2b7eab87e99e9a48314f..175f5149a49c361d76ad0c17a073ff27cdc98209 100644 --- a/tests/PHPUnit/TestingEnvironment.php +++ b/tests/PHPUnit/TestingEnvironment.php @@ -149,8 +149,7 @@ class Piwik_TestingEnvironment $config->setTestEnvironment($testingEnvironment->configFileLocal, $testingEnvironment->configFileGlobal, $testingEnvironment->configFileCommon); if ($testingEnvironment->configFileLocal) { - unset($cache['General']); - $config->General['session_save_handler'] = 'dbtable'; + $local['General']['session_save_handler'] = 'dbtable'; } $manager = \Piwik\Plugin\Manager::getInstance(); @@ -161,17 +160,15 @@ class Piwik_TestingEnvironment sort($pluginsToLoad); - $config->Plugins = array('Plugins' => $pluginsToLoad); + $local['Plugins'] = array('Plugins' => $pluginsToLoad); - $trackerPluginsToLoad = array_filter($config->Plugins['Plugins'], function ($plugin) use ($manager) { + $trackerPluginsToLoad = array_filter($local['Plugins']['Plugins'], function ($plugin) use ($manager) { return $manager->isTrackerPlugin($manager->loadPlugin($plugin)); }); - $config->Plugins_Tracker = array('Plugins_Tracker' => $trackerPluginsToLoad); + $local['Plugins_Tracker'] = array('Plugins_Tracker' => $trackerPluginsToLoad); - $log = $config->log; - $log['log_writers'] = array('file'); - $config->log = $log; + $local['log']['log_writers'] = array('file'); $manager->unloadPlugins(); diff --git a/tests/lib/screenshot-testing/support/page-renderer.js b/tests/lib/screenshot-testing/support/page-renderer.js index 960879b6559aeba66a1bf24ed07fb2009c042444..aa0fb12f87de441c6d76805424a53e2661657ea5 100644 --- a/tests/lib/screenshot-testing/support/page-renderer.js +++ b/tests/lib/screenshot-testing/support/page-renderer.js @@ -280,7 +280,8 @@ PageRenderer.prototype.capture = function (outputPath, callback, selector) { }, selector); if (!result) { - throw new Error("Cannot find element " + selector); + console.log("Cannot find element " + selector); + return; } if (result && result.__isCallError) { @@ -290,8 +291,10 @@ PageRenderer.prototype.capture = function (outputPath, callback, selector) { if (null === result.left || null === result.top || null === result.bottom - || null === result.right) { - throw new Error("Element(s) " + selector + " found but none is visible"); + || null === result.right + ) { + console.log("Element(s) " + selector + " found but none is visible"); + return; } page.clipRect = result; diff --git a/tests/resources/extractSearchEngineInformationFromUrlTests.yml b/tests/resources/extractSearchEngineInformationFromUrlTests.yml index d7c46cf2b47b1dd5a6e31ece2f19b90c0c054b33..b4b4f51b8c330443654eb80d2c6aa73af50e66d5 100644 --- a/tests/resources/extractSearchEngineInformationFromUrlTests.yml +++ b/tests/resources/extractSearchEngineInformationFromUrlTests.yml @@ -478,6 +478,11 @@ engine: 'InfoSpace' keywords: 'rest' +# No keyword +- url: 'http://yandex.ru/clck/jsredir?from=yandex.ru;yandsearch;web;;&text=&etext=385.4_2Hh6u_q9NEfpXpGpdVughcGncWYG-_kwHJA-7QxQ8v4xvt5Q2aAB7TvvUxHLtacHMltCoYGQFFmIdiXaIT-_yiHqjEJoZKVdHIXJylYsQ5TJuxRtqCDA0zUi_xlatVD6kx219rIP4Q4a7j9E7-2U88ZpCZwGXuhRws6LASTZUIJRfiPbVdxjIn2Qu5bCtcGKIQBqGa567Czx019cxaPvNAWQQ_8MIJjUgFHzg2vO_XvlSMmKOcooZNX5UzqgJAnaioMW7884jsYEKwXebrij39unXyWKnLXDX15607fkXqQFGIC_tp8zvjXq0ynizqcdQcfkHnZG-zxxPqCoALAWj47hwRCZtLGinfqMatmzFWG7Yo7eWxScEHyMI2J89OU2ZjpuHog0VyZpSb3hN17-CdHWEeN_ii1mLG_J24ftGMEpbWOeH-M3fZeAtCzmq0XUFchFAbVvm9Xmk8I2M-4A.66cd118e1c9292f7ec030c8580f6912eae4ac700&uuid=&state=AiuY0DBWFJ4ePaEse6rgeAjgs2pI3DW99KUdgowt9XsGes-COYeAtjuEaMUoBSHP2gxXC4630Mz4aEvXYUCXRTGAgAQwM7IGD-gsizkhSmBNCEfle91ZI3guOwMFOli3aeHzkqoQeuyYhvz_XwXodFz8gB8yMp6IgAL52sHwR5edKVNpZtbPIFNbLDRYIxJbYQciYGnLnCw_i584OfCtQO-zjBBGMlwoQFtGet-Xvmw&data=UlNrNmk5WktYejR0eWJFYk1LdmtxdE5aS05CUWU0alhkSkF1MEpOb0Jrc0dpbmNsUGhaVjljRWt6R0VackFURk5sM1psNlVKMWh6djhYazhRT1psQTdHamFGSFJacDFhQjdfbHJQU05jeDJMRHV0MTJmRG53Zw&b64e=2&sign=9072743a841f27dd5e766c4b57fa5138&keyno=0&l10n=ru' + engine: 'Yandex' + keywords: '' + # No search - url: 'http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-x&output=html&h=15&slotname=2973049897&adk=3777420323&w=728&lmt=1381755030&flash=11.9.900.117&url=http%3A%2F%2Fexample.com%2F&dt=1381755030169&bpp=8&bdt=2592&shv=r20131008&cbv=r20130906&saldr=sa&correlator=1381755030200&frm=20&ga_vid=1659309719.1381755030&ga_sid=1381755030&ga_hid=1569070879&ga_fc=0&u_tz=660&u_his=3&u_java=1&u_h=768&u_w=1366&u_ah=728&u_aw=1366&u_cd=24&u_nplug=0&u_nmime=0&dff=times%20new%20roman&dfs=13&adx=311&ady=107&biw=1349&bih=673&oid=2&ref=http%3A%2F%2Fwww.google.com.au%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3D%26esrc%3Ds%26frm%3D1%26source%3Dweb%26cd%3D10%26ved%3D0CGcQFjAJ%26url%3Dhttp%253A%252F%252Fexample.com%252F%26ei%3DXNtbUvrJPKXOiAfw1IH4Bw%26usg%3DAFQjCNE66zRf2zaUw8FKf0JWxiM1FiXHVg&vis=1&fu=0&ifi=1&pfi=32&dtd=122&xpc=tBekiCZTWM&p=http%3A//example.com&rl_rc=true&adsense_enabled=true&ad_type=text_image&oe=utf8&height=15&width=728&format=fp_al_lp&kw_type=radlink&prev_fmts=728x15_0ads_al&rt=ChBSW-iYAADltAqmmOfZAA2SEg1BbmltYXRlZCBUZXh0Ggj019wBciBqgSgBUhMI8OHhzq6WugIVhJOmCh2NYQBO&hl=en&kw0=Animated+Text&kw1=Animated+GIF&kw2=Animated+Graphics&kw3=Fonts&okw=Animated+Text' engine: