diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2016-12-19 05:22:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-19 05:22:53 +0300 |
commit | 8f4bc9695380d465e7dfe365e66a0153f76040ff (patch) | |
tree | 3d6bbfa74611f54feb70c3fc5c1df81e8ca6bf94 | |
parent | af368cfc02bae5026429b0418d83de2b0890ef44 (diff) | |
parent | 8dbc563e99432f38de107be3dfb0f0a17b9e8f87 (diff) |
Merge pull request #11038 from piwik/3.x-dev3.0.0
Piwik 3.0.0 release
14 files changed, 110 insertions, 146 deletions
diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php index e738c6c4c8..990d232163 100644 --- a/core/API/DocumentationGenerator.php +++ b/core/API/DocumentationGenerator.php @@ -43,69 +43,49 @@ class DocumentationGenerator /** * Returns a HTML page containing help for all the successfully loaded APIs. - * For each module it will return a mini help with the method names, parameters to give, - * links to get the result in Xml/Csv/etc * * @param bool $outputExampleUrls - * @param string $prefixUrls * @return string */ - public function getAllInterfaceString($outputExampleUrls = true, $prefixUrls = '') + public function getApiDocumentationAsString($outputExampleUrls = true) { - if (!empty($prefixUrls)) { - $prefixUrls = 'http://demo.piwik.org/'; - } - - $str = $toc = ''; - - foreach (Proxy::getInstance()->getMetadata() as $class => $info) { - $moduleName = Proxy::getInstance()->getModuleNameFromClassName($class); - $rClass = new ReflectionClass($class); - - if (!Piwik::hasUserSuperUserAccess() && $this->checkIfClassCommentContainsHideAnnotation($rClass)) { - continue; - } - - if ($this->checkIfCommentContainsInternalAnnotation($rClass)) { - continue; - } - - $toDisplay = $this->prepareModulesAndMethods($info, $moduleName); - - foreach ($toDisplay as $moduleName => $methods) { - foreach ($methods as $index => $method) { - $reflectionMethod = new \ReflectionMethod($class, $method); - if ($this->checkIfCommentContainsInternalAnnotation($reflectionMethod)) { - unset($toDisplay[$moduleName][$index]); - } - } - if (empty($toDisplay[$moduleName])) { - unset($toDisplay[$moduleName]); - } - } + list($toc, $str) = $this->generateDocumentation($outputExampleUrls, $prefixUrls = '', $displayTitlesAsAngularDirective = true); - foreach ($toDisplay as $moduleName => $methods) { - $toc .= $this->prepareModuleToDisplay($moduleName); - $str .= $this->prepareMethodToDisplay($moduleName, $info, $methods, $class, $outputExampleUrls, $prefixUrls); - } - } - - $str = "<div piwik-content-block content-title='Quick access to APIs' id='topApiRef' name='topApiRef'> + return "<div piwik-content-block content-title='Quick access to APIs' id='topApiRef' name='topApiRef'> $toc</div> $str"; + } - return $str; + /** + * Used on developer.piwik.org + * + * @param bool|true $outputExampleUrls + * @param string $prefixUrls + * @return string + */ + public function getApiDocumentationAsStringForDeveloperReference($outputExampleUrls = true, $prefixUrls = '') + { + list($toc, $str) = $this->generateDocumentation($outputExampleUrls, $prefixUrls, $displayTitlesAsAngularDirective = false); + + return "<h2 id='topApiRef' name='topApiRef'>Quick access to APIs</h2> + $toc + $str"; } - public function prepareModuleToDisplay($moduleName) + protected function prepareModuleToDisplay($moduleName) { return "<a href='#$moduleName'>$moduleName</a><br/>"; } - public function prepareMethodToDisplay($moduleName, $info, $methods, $class, $outputExampleUrls, $prefixUrls) + protected function prepareMethodToDisplay($moduleName, $info, $methods, $class, $outputExampleUrls, $prefixUrls, $displayTitlesAsAngularDirective) { $str = ''; - $str .= "\n<a name='$moduleName' id='$moduleName'></a><div piwik-content-block content-title='Module " . $moduleName . "'>"; + $str .= "\n<a name='$moduleName' id='$moduleName'></a>"; + if($displayTitlesAsAngularDirective) { + $str .= "<div piwik-content-block content-title='Module " . $moduleName . "'>"; + } else { + $str .= "<h2>Module " . $moduleName . "</h2>"; + } $info['__documentation'] = $this->checkDocumentation($info['__documentation']); $str .= "<div class='apiDescription'> " . $info['__documentation'] . " </div>"; foreach ($methods as $methodName) { @@ -124,10 +104,14 @@ class DocumentationGenerator $str .= "</div>\n"; } - return $str . "</div>"; + if($displayTitlesAsAngularDirective) { + $str .= "</div>"; + } + + return $str; } - public function prepareModulesAndMethods($info, $moduleName) + protected function prepareModulesAndMethods($info, $moduleName) { $toDisplay = array(); @@ -141,7 +125,7 @@ class DocumentationGenerator return $toDisplay; } - public function addExamples($class, $methodName, $prefixUrls) + protected function addExamples($class, $methodName, $prefixUrls) { $token_auth = "&token_auth=" . Piwik::getCurrentUserTokenAuth(); $parametersToSet = array( @@ -150,7 +134,6 @@ class DocumentationGenerator 'date' => Common::getRequestVar('date', 'today', 'string') ); $str = ''; -// used when we include this output in the Piwik official documentation for example $str .= "<span class=\"example\">"; $exampleUrl = $this->getExampleUrl($class, $methodName, $parametersToSet); if ($exampleUrl !== false) { @@ -209,29 +192,6 @@ class DocumentationGenerator return $moduleToCheck; } - private function getInterfaceString($moduleName, $class, $info, $parametersToSet, $outputExampleUrls, $prefixUrls) - { - $str = ''; - - $str .= "\n<a name='$moduleName' id='$moduleName'></a><h2>Module " . $moduleName . "</h2>"; - $str .= "<div class='apiDescription'> " . $info['__documentation'] . " </div>"; - foreach ($info as $methodName => $infoMethod) { - if ($methodName == '__documentation') { - continue; - } - - if (Proxy::getInstance()->isDeprecatedMethod($class, $methodName)) { - continue; - } - - $str .= $this->getMethodString($moduleName, $class, $parametersToSet, $outputExampleUrls, $prefixUrls, $methodName, $str); - } - - $str .= '<div style="margin:15px;"><a href="#topApiRef">↑ Back to top</a></div>'; - - return $str; - } - /** * Returns a string containing links to examples on how to call a given method on a given API * It will export links to XML, CSV, HTML, JSON, PHP, etc. @@ -295,14 +255,6 @@ class DocumentationGenerator // we try to give an URL example to call the API $aParameters = Proxy::getInstance()->getParametersList($class, $methodName); - // Kindly force some known generic parameters to appear in the final list - // the parameter 'format' can be set to all API methods (used in tests) - // the parameter 'hideIdSubDatable' is used for system tests only - // the parameter 'serialize' sets php outputs human readable, used in system tests and debug - // the parameter 'language' sets the language for the response (eg. country names) - // the parameter 'flat' reduces a hierarchical table to a single level by concatenating labels - // the parameter 'include_aggregate_rows' can be set to include inner nodes in flat reports - // the parameter 'translateColumnNames' can be set to translate metric names in csv/tsv exports $aParameters['format'] = false; $aParameters['hideIdSubDatable'] = false; $aParameters['serialize'] = false; @@ -311,15 +263,15 @@ class DocumentationGenerator $aParameters['label'] = false; $aParameters['flat'] = false; $aParameters['include_aggregate_rows'] = false; - $aParameters['filter_offset'] = false; //@review without adding this, I can not set filter_offset in $otherRequestParameters system tests - $aParameters['filter_limit'] = false; //@review without adding this, I can not set filter_limit in $otherRequestParameters system tests - $aParameters['filter_sort_column'] = false; //@review without adding this, I can not set filter_sort_column in $otherRequestParameters system tests - $aParameters['filter_sort_order'] = false; //@review without adding this, I can not set filter_sort_order in $otherRequestParameters system tests - $aParameters['filter_excludelowpop'] = false; //@review without adding this, I can not set filter_sort_order in $otherRequestParameters system tests - $aParameters['filter_excludelowpop_value'] = false; //@review without adding this, I can not set filter_sort_order in $otherRequestParameters system tests - $aParameters['filter_column_recursive'] = false; //@review without adding this, I can not set filter_sort_order in $otherRequestParameters system tests - $aParameters['filter_pattern'] = false; //@review without adding this, I can not set filter_sort_order in $otherRequestParameters system tests - $aParameters['filter_pattern_recursive'] = false; //@review without adding this, I can not set filter_sort_order in $otherRequestParameters system tests + $aParameters['filter_offset'] = false; + $aParameters['filter_limit'] = false; + $aParameters['filter_sort_column'] = false; + $aParameters['filter_sort_order'] = false; + $aParameters['filter_excludelowpop'] = false; + $aParameters['filter_excludelowpop_value'] = false; + $aParameters['filter_column_recursive'] = false; + $aParameters['filter_pattern'] = false; + $aParameters['filter_pattern_recursive'] = false; $aParameters['filter_truncate'] = false; $aParameters['hideColumns'] = false; $aParameters['showColumns'] = false; @@ -354,7 +306,7 @@ class DocumentationGenerator * @param string $name The method name * @return string For example "(idSite, period, date = 'today')" */ - public function getParametersString($class, $name) + protected function getParametersString($class, $name) { $aParameters = Proxy::getInstance()->getParametersList($class, $name); $asParameters = array(); @@ -378,42 +330,47 @@ class DocumentationGenerator return "($sParameters)"; } - private function getMethodString($moduleName, $class, $parametersToSet, $outputExampleUrls, $prefixUrls, $methodName) + /** + * @param $outputExampleUrls + * @param $prefixUrls + * @param $displayTitlesAsAngularDirective + * @return array + */ + protected function generateDocumentation($outputExampleUrls, $prefixUrls, $displayTitlesAsAngularDirective) { - $str = ''; - $token_auth = "&token_auth=" . Piwik::getCurrentUserTokenAuth(); + $str = $toc = ''; - $params = $this->getParametersString($class, $methodName); - $str .= "\n <div class='apiMethod'>- <b>$moduleName.$methodName </b>" . $params . ""; - $str .= '<small>'; - - if ($outputExampleUrls) { - // we prefix all URLs with $prefixUrls - // used when we include this output in the Piwik official documentation for example - $str .= "<span class=\"example\">"; - $exampleUrl = $this->getExampleUrl($class, $methodName, $parametersToSet); - if ($exampleUrl !== false) { - $lastNUrls = ''; - if (preg_match('/(&period)|(&date)/', $exampleUrl)) { - $exampleUrlRss = $prefixUrls . $this->getExampleUrl($class, $methodName, array('date' => 'last10', 'period' => 'day') + $parametersToSet); - $lastNUrls = ", RSS of the last <a target='_blank' href='$exampleUrlRss&format=rss$token_auth&translateColumnNames=1'>10 days</a>"; - } - $exampleUrl = $prefixUrls . $exampleUrl; - $str .= " [ Example in - <a target='_blank' href='$exampleUrl&format=xml$token_auth'>XML</a>, - <a target='_blank' href='$exampleUrl&format=JSON$token_auth'>Json</a>, - <a target='_blank' href='$exampleUrl&format=Tsv$token_auth&translateColumnNames=1'>Tsv (Excel)</a> - $lastNUrls - ]"; - } else { - $str .= " [ No example available ]"; + foreach (Proxy::getInstance()->getMetadata() as $class => $info) { + $moduleName = Proxy::getInstance()->getModuleNameFromClassName($class); + $rClass = new ReflectionClass($class); + + if (!Piwik::hasUserSuperUserAccess() && $this->checkIfClassCommentContainsHideAnnotation($rClass)) { + continue; } - $str .= "</span>"; - } - $str .= '</small>'; - $str .= "</div>\n"; + if ($this->checkIfCommentContainsInternalAnnotation($rClass)) { + continue; + } - return $str; + $toDisplay = $this->prepareModulesAndMethods($info, $moduleName); + + foreach ($toDisplay as $moduleName => $methods) { + foreach ($methods as $index => $method) { + $reflectionMethod = new \ReflectionMethod($class, $method); + if ($this->checkIfCommentContainsInternalAnnotation($reflectionMethod)) { + unset($toDisplay[$moduleName][$index]); + } + } + if (empty($toDisplay[$moduleName])) { + unset($toDisplay[$moduleName]); + } + } + + foreach ($toDisplay as $moduleName => $methods) { + $toc .= $this->prepareModuleToDisplay($moduleName); + $str .= $this->prepareMethodToDisplay($moduleName, $info, $methods, $class, $outputExampleUrls, $prefixUrls, $displayTitlesAsAngularDirective); + } + } + return array($toc, $str); } } diff --git a/core/Version.php b/core/Version.php index 3f8ba3758d..964c773ece 100644 --- a/core/Version.php +++ b/core/Version.php @@ -20,7 +20,7 @@ final class Version * The current Piwik version. * @var string */ - const VERSION = '3.0.0-rc4'; + const VERSION = '3.0.0'; public function isStableVersion($version) { diff --git a/plugins/API/Controller.php b/plugins/API/Controller.php index e7ef5efd36..2d107182cb 100644 --- a/plugins/API/Controller.php +++ b/plugins/API/Controller.php @@ -49,7 +49,8 @@ class Controller extends \Piwik\Plugin\Controller public function listAllMethods() { $ApiDocumentation = new DocumentationGenerator(); - return $ApiDocumentation->getAllInterfaceString($outputExampleUrls = true, $prefixUrls = Common::getRequestVar('prefixUrl', '')); + $prefixUrls = Common::getRequestVar('prefixUrl', 'http://demo.piwik.org/', 'string'); + return $ApiDocumentation->getApiDocumentationAsStringForDeveloperReference($outputExampleUrls = true, $prefixUrls); } public function listAllAPI() @@ -59,7 +60,7 @@ class Controller extends \Piwik\Plugin\Controller $ApiDocumentation = new DocumentationGenerator(); $view->countLoadedAPI = Proxy::getInstance()->getCountRegisteredClasses(); - $view->list_api_methods_with_links = $ApiDocumentation->getAllInterfaceString(); + $view->list_api_methods_with_links = $ApiDocumentation->getApiDocumentationAsString(); return $view->render(); } diff --git a/plugins/CoreHome/javascripts/dataTable.js b/plugins/CoreHome/javascripts/dataTable.js index e364251f9b..763674585d 100644 --- a/plugins/CoreHome/javascripts/dataTable.js +++ b/plugins/CoreHome/javascripts/dataTable.js @@ -509,7 +509,10 @@ $.extend(DataTable.prototype, UIControl.prototype, { setMaxTableWidthIfNeeded(domElem, 1200); - var isTableVisualization = this.jsViewDataTable && this.jsViewDataTable.indexOf('table') !== -1; + var isTableVisualization = this.jsViewDataTable + && typeof this.jsViewDataTable === 'string' + && typeof this.jsViewDataTable.indexOf === 'function' + && this.jsViewDataTable.indexOf('table') !== -1; if (isTableVisualization) { // we do this only for html tables diff --git a/plugins/CoreUpdater/lang/en.json b/plugins/CoreUpdater/lang/en.json index c75736c204..cd517e0d31 100644 --- a/plugins/CoreUpdater/lang/en.json +++ b/plugins/CoreUpdater/lang/en.json @@ -34,6 +34,8 @@ "ListOfSqlQueriesFYI": "FYI: these are the SQL queries that will be executed to upgrade your database to Piwik %s", "MajorUpdateWarning1": "This is a major update! It will take longer than usual.", "MajorUpdateWarning2": "The following advice is especially important for large installations.", + "NeedHelpUpgrading": "Need help upgrading Piwik?", + "NeedHelpUpgradingText": "If you need support to upgrade your Piwik, the creators of Piwik are here to help you make the Piwik upgrade a success and provide all instructions, best practises and ongoing support. %1$sContact the Piwik experts to get started upgrading your Piwik safely.%2$s", "NoteForLargePiwikInstances": "Important notes for large Piwik installations", "NotificationClickToUpdatePlugins": "Click here to update your plugins now:", "NotificationClickToUpdateThemes": "Click here to update your themes now:", diff --git a/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig b/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig index e5899117ce..3d1a8a5357 100644 --- a/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig +++ b/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig @@ -60,6 +60,9 @@ </div> {% endif %} + <h2>{{ 'CoreUpdater_NeedHelpUpgrading'|translate }}</h2> + <p>{{ 'CoreUpdater_NeedHelpUpgradingText'|translate("<a rel='noreferrer' target='_blank' href='https://piwik.org/support/upgrading-piwik/'>", "</a>")|raw }}</p> + <h2>{{ 'CoreUpdater_ReadyToGo'|translate }}</h2> <p>{{ 'CoreUpdater_TheUpgradeProcessMayTakeAWhilePleaseBePatient'|translate }}</p> {% endif %} diff --git a/tests/UI/expected-screenshots/CoreUpdaterDb_main.png b/tests/UI/expected-screenshots/CoreUpdaterDb_main.png index 8177bcaaa6..8e60bc335f 100644 --- a/tests/UI/expected-screenshots/CoreUpdaterDb_main.png +++ b/tests/UI/expected-screenshots/CoreUpdaterDb_main.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:33c350c7584ee6937224850ac176927157ea8ecee633380cc44ff322b1721b3f -size 262822 +oid sha256:6ed9788df6f0f938486e24797ca3422f310085e336391b81e40787ecd8c5553d +size 289862 diff --git a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_2_segment_editor_update.png b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_2_segment_editor_update.png index aa53f901af..e99caa0e59 100644 --- a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_2_segment_editor_update.png +++ b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_2_segment_editor_update.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f7b947c06030d891d78ed0d0c7e1cdd7649e1da0d4e75475f7e3437137148c8 -size 48582 +oid sha256:3a1cd08f745e680fa7e167a198ed5fef4e069791821936c6f340051b222a84c0 +size 48560 diff --git a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_3_segment_editor_edit_name.png b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_3_segment_editor_edit_name.png index 88c32f48cc..c7526f6363 100644 --- a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_3_segment_editor_edit_name.png +++ b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_3_segment_editor_edit_name.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:88a844d0f57feb6f788b6322763df6542049d4aab8a5e0739b488d867fa0adf7 -size 47395 +oid sha256:af83134ac7d91edfa60300eaad7b709304faafe868656bcf17ae4cd6dd7787a1 +size 47393 diff --git a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_4_segment_editor_expanded_dimensions.png b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_4_segment_editor_expanded_dimensions.png index f8ef1a9571..525a904f9e 100644 --- a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_4_segment_editor_expanded_dimensions.png +++ b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_4_segment_editor_expanded_dimensions.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e99d0bcbb9705964c1ab233bd4d8ca792f669549f5e274a13c78a42d243b559a -size 52497 +oid sha256:4f4f99126835ee863ea6eb295eceb633abe8fbbee8c6ea3414484811b832da84 +size 52667 diff --git a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_5_segment_editor_search_dimensions.png b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_5_segment_editor_search_dimensions.png index 5f6634174c..bb9daa3135 100644 --- a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_5_segment_editor_search_dimensions.png +++ b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_5_segment_editor_search_dimensions.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:525c797e7c8c49414f50264514b981d544d53350f1064c794b2c0acc28a34ec8 -size 43877 +oid sha256:e8098f472b93da640ebfac6ce43641f8eea3d230ca42ddba359a93089fdfdcd8 +size 43896 diff --git a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_6_segment_editor_different.png b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_6_segment_editor_different.png index 39ec92b65a..466bf58cd5 100644 --- a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_6_segment_editor_different.png +++ b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_6_segment_editor_different.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1cd31cd64a4bb03d1d6a08c599b73bc3ae68016b337b4af0a6285ad69b859a8e -size 38448 +oid sha256:a863803d25a5a883293faeaed5b13bd27e838a13bd0539f182c266ad7cc16c61 +size 38469 diff --git a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_6_segment_editor_droplist.png b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_6_segment_editor_droplist.png index 3379754b35..617aa2636d 100644 --- a/tests/UI/expected-screenshots/SegmentSelectorEditorTest_6_segment_editor_droplist.png +++ b/tests/UI/expected-screenshots/SegmentSelectorEditorTest_6_segment_editor_droplist.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d9469fe003119adadf54ff5111490d85d4bdad47bcbcd463a00ab01d8f7372f1 -size 47842 +oid sha256:8c02271897f5e217b9ad31390734db144f2c9c044aeff007523e4324682faa6e +size 47865 diff --git a/tests/UI/specs/SegmentSelectorEditor_spec.js b/tests/UI/specs/SegmentSelectorEditor_spec.js index 5b22be9ad1..d144a9be54 100644 --- a/tests/UI/specs/SegmentSelectorEditor_spec.js +++ b/tests/UI/specs/SegmentSelectorEditor_spec.js @@ -28,12 +28,10 @@ describe("SegmentSelectorEditorTest", function () { }); it("should open segment editor when edit link clicked for existing segment", function (done) { - - this.retries(3); - expect.screenshot("2_segment_editor_update").to.be.captureSelector(selectorsToCapture, function (page) { - page.click('.segmentList .editSegment:first'); - page.wait(1000); + page.evaluate(function() { + $('.segmentList .editSegment:first').click() + }, 200); }, done); }); |