PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.12.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.12.1
5.12.1 5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / testMinimumPhpVersion.php
matomo / app / core Last commit date
API 2 weeks ago Access 2 weeks ago Application 2 weeks ago Archive 2 weeks ago ArchiveProcessor 2 weeks ago Archiver 2 years ago AssetManager 2 weeks ago Auth 2 weeks ago Category 2 weeks ago Changes 2 months ago CliMulti 2 weeks ago Columns 2 weeks ago Concurrency 2 weeks ago Config 2 weeks ago Container 2 months ago CronArchive 2 weeks ago DataAccess 2 weeks ago DataFiles 2 years ago DataTable 2 weeks ago Db 2 weeks ago DeviceDetector 1 year ago Email 2 years ago Exception 5 months ago Http 2 weeks ago Intl 4 months ago Log 2 years ago Mail 1 year ago Measurable 8 months ago Menu 2 weeks ago Metrics 2 weeks ago Notification 8 months ago Period 2 weeks ago Plugin 2 weeks ago Policy 2 months ago ProfessionalServices 1 year ago Report 1 year ago ReportRenderer 2 weeks ago Request 2 weeks ago Scheduler 2 weeks ago Segment 2 weeks ago Session 1 month ago Settings 2 weeks ago Tracker 2 weeks ago Translation 2 months ago Twig 1 year ago UpdateCheck 4 months ago Updater 2 weeks ago Updates 1 month ago Validators 1 year ago View 2 months ago ViewDataTable 2 weeks ago Visualization 2 weeks ago Widget 2 weeks ago .htaccess 2 years ago Access.php 2 weeks ago Archive.php 2 months ago ArchiveProcessor.php 2 weeks ago AssetManager.php 2 weeks ago Auth.php 8 months ago AuthResult.php 8 months ago BaseFactory.php 2 years ago Cache.php 2 weeks ago CacheId.php 5 months ago CliMulti.php 2 weeks ago Common.php 2 weeks ago Config.php 2 weeks ago Console.php 4 months ago Context.php 2 years ago Cookie.php 2 weeks ago CronArchive.php 2 weeks ago DI.php 4 months ago DataArray.php 2 weeks ago DataTable.php 2 weeks ago Date.php 2 months ago Db.php 2 months ago DbHelper.php 2 weeks ago Development.php 2 weeks ago ErrorHandler.php 8 months ago EventDispatcher.php 2 months ago ExceptionHandler.php 5 months ago FileIntegrity.php 2 weeks ago Filechecks.php 1 year ago Filesystem.php 2 weeks ago FrontController.php 2 weeks ago Http.php 2 weeks ago IP.php 1 year ago Log.php 4 months ago LogDeleter.php 2 weeks ago Mail.php 1 year ago Metrics.php 2 months ago NoAccessException.php 2 years ago Nonce.php 8 months ago Notification.php 2 months ago NumberFormatter.php 2 weeks ago Option.php 2 weeks ago Period.php 2 weeks ago Piwik.php 2 weeks ago Plugin.php 2 months ago Process.php 2 months ago Profiler.php 2 weeks ago ProxyHeaders.php 5 months ago ProxyHttp.php 2 weeks ago QuickForm2.php 4 months ago RankingQuery.php 2 months ago ReportRenderer.php 2 weeks ago Request.php 2 months ago Segment.php 2 weeks ago Sequence.php 2 weeks ago Session.php 1 month ago SettingsPiwik.php 2 weeks ago SettingsServer.php 2 weeks ago Singleton.php 2 years ago Site.php 2 months ago SiteContentDetector.php 2 months ago SupportedBrowser.php 2 years ago TCPDF.php 1 year ago Theme.php 2 weeks ago Timer.php 2 weeks ago Tracker.php 2 weeks ago Twig.php 2 months ago Unzip.php 1 year ago UpdateCheck.php 2 months ago Updater.php 2 weeks ago UpdaterErrorException.php 2 years ago Updates.php 2 weeks ago Url.php 2 weeks ago UrlHelper.php 2 months ago Version.php 2 weeks ago View.php 2 weeks ago bootstrap.php 1 year ago dispatch.php 2 years ago testMinimumPhpVersion.php 8 months ago
testMinimumPhpVersion.php
160 lines
1 <?php
2
3 namespace {
4 /**
5 * Matomo - free/libre analytics platform
6 *
7 * @link https://matomo.org
8 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
9 */
10 /**
11 * This file is executed before anything else.
12 * It checks the minimum PHP version required to run Matomo.
13 * This file must be compatible with PHP 5.3.
14 */
15 $piwik_errorMessage = '';
16 // Minimum requirement: stream_resolve_include_path, working json_encode in 5.3.3, namespaces in 5.3
17 // NOTE: when changing this variable, we also need to update
18 // 1) api.matomo.org
19 // 2) composer.json (in two places)
20 // 3) tests/PHPUnit/Integration/ReleaseCheckListTest.php
21 global $piwik_minimumPHPVersion;
22 $piwik_minimumPHPVersion = '7.2.5';
23 $piwik_currentPHPVersion = \PHP_VERSION;
24 $minimumPhpInvalid = \version_compare($piwik_minimumPHPVersion, $piwik_currentPHPVersion) > 0;
25 if ($minimumPhpInvalid) {
26 $piwik_errorMessage .= "<p><strong>To run Matomo you need at least PHP version {$piwik_minimumPHPVersion}</strong></p>\n\t\t\t\t<p>Unfortunately it seems your webserver is using PHP version {$piwik_currentPHPVersion}. </p>\n\t\t\t\t<p>Please try to update your PHP version, Matomo is really worth it! Nowadays most web hosts\n\t\t\t\tsupport PHP {$piwik_minimumPHPVersion}.</p>";
27 } else {
28 if (!\extension_loaded('session')) {
29 $piwik_errorMessage .= "<p><strong>Matomo and Zend_Session require the session extension</strong></p>\n\t\t\t\t\t<p>It appears your PHP was compiled with <pre>--disable-session</pre>.\n\t\t\t\t\tTo enjoy Matomo, you need PHP compiled without that configure option.</p>";
30 }
31 if (!\function_exists('ini_set')) {
32 $piwik_errorMessage .= "<p><strong>Matomo and Zend_Session require the <code>ini_set()</code> function</strong></p>\n\t\t\t\t\t<p>It appears your PHP has disabled this function.\n\t\t\t\t\tTo enjoy Matomo, you need remove <pre>ini_set</pre> from your <pre>disable_functions</pre> directive in php.ini, and restart your webserver.</p>";
33 }
34 if (\ini_get('mbstring.func_overload')) {
35 $piwik_errorMessage .= "<p><strong>Matomo does not work when PHP is configured with <pre>mbstring.func_overload = " . \ini_get('mbstring.func_overload') . "</pre></strong></p>\n\t\t\t\t\t<p>It appears your mbstring extension in PHP is configured to override string functions.\n\t\t\t\t\tTo enjoy Matomo, you need to modify php.ini <pre>mbstring.func_overload = 0</pre>, and restart your webserver.</p>";
36 }
37 if (!\function_exists('json_encode')) {
38 $piwik_errorMessage .= "<p><strong>Matomo requires the php-json extension which provides the functions <code>json_encode()</code> and <code>json_decode()</code></strong></p>\n\t\t\t\t\t<p>It appears your PHP has not yet installed the php-json extension.\n\t\t\t\t\tTo use Matomo, please ask your web host to install php-json or install it yourself, for example on debian system: <code>sudo apt-get install php-json</code>. <br/>Then restart your webserver and refresh this page.</p>";
39 }
40 if (!\file_exists(\PIWIK_VENDOR_PATH . '/autoload.php')) {
41 $composerInstall = "In the matomo directory, run in the command line the following (eg. via ssh): \n\n" . "<pre> curl -sS https://getcomposer.org/installer | php \n\n php composer.phar install\n\n</pre> ";
42 if (\DIRECTORY_SEPARATOR === '\\') {
43 $composerInstall = "Download and run <a href=\"https://getcomposer.org/Composer-Setup.exe\"><b>Composer-Setup.exe</b></a>, it will install the latest Composer version and set up your PATH so that you can just call composer from any directory in your command line. " . " <br>Then run this command in a terminal in the matomo directory: <br> \$ php composer.phar install ";
44 }
45 $piwik_errorMessage .= "<p>It appears the <a href='https://getcomposer.org/' rel='noreferrer noopener' target='_blank'>composer</a> tool is not yet installed. You can install Composer in a few easy steps:\n\n" . "<br/>" . $composerInstall . " This will initialize composer for Matomo and download libraries we use in vendor/* directory." . "\n\n<br/><br/>Then reload this page to access your analytics reports." . "\n\n<br/><br/>For more information check out this FAQ: <a href='https://matomo.org/faq/how-to-install/faq_18271/' rel='noreferrer noopener' target='_blank'>How do I use Matomo from the Git repository?</a>." . "\n\n<br/><br/>Note: if for some reasons you cannot install composer, instead install the latest Matomo release from " . "<a href='https://builds.matomo.org/piwik.zip' rel='noreferrer noopener'>builds.matomo.org</a>.</p>";
46 }
47 }
48 \define('PAGE_TITLE_WHEN_ERROR', 'Matomo &rsaquo; Error');
49 if (!\function_exists('Piwik_GetErrorMessagePage')) {
50 /**
51 * Returns true if Piwik should print the backtrace with error messages.
52 *
53 * To make sure the backtrace is printed, define PIWIK_PRINT_ERROR_BACKTRACE.
54 *
55 * @return bool
56 */
57 function Piwik_ShouldPrintBackTraceWithMessage()
58 {
59 if (!\class_exists(\Piwik\ExceptionHandler::class)) {
60 return \false;
61 }
62 return \Piwik\ExceptionHandler::shouldPrintBackTraceWithMessage();
63 }
64 /**
65 * Displays info/warning/error message in a friendly UI and exits.
66 *
67 * Note: this method should not be called by anyone other than FrontController.
68 *
69 * @param string $message Main message, must be html encoded before calling
70 * @param bool|string $optionalTrace Backtrace; will be displayed in lighter color
71 * @param bool $optionalLinks If true, will show links to the Piwik website for help
72 * @param bool $optionalLinkBack If true, displays a link to go back
73 * @param bool|string $logoUrl The URL to the logo to use.
74 * @param bool|string $faviconUrl The URL to the favicon to use.
75 * @param string $errorLogPrefix String to prepend to the error in log file
76 * @param bool $writeErrorLog If true then a webserver error log will be written, defaults to true
77 * @return string
78 */
79 function Piwik_GetErrorMessagePage($message, $optionalTrace = \false, $optionalLinks = \false, $optionalLinkBack = \false, $logoUrl = \false, $faviconUrl = \false, $isCli = null, $errorLogPrefix = '', $writeErrorLog = \true, $redirectUrl = null, $countdown = null)
80 {
81 $hasCountdownRedirect = !empty($redirectUrl) && !empty($countdown);
82 if ($writeErrorLog) {
83 \error_log(\sprintf("{$errorLogPrefix}Error in Matomo: %s", \str_replace("\n", " ", \strip_tags($message))));
84 }
85 if (!\headers_sent()) {
86 \header('Content-Type: text/html; charset=utf-8');
87 \header('Cache-Control: private, no-cache, no-store');
88 $isInternalServerError = \preg_match('/(sql|database|mysql)/i', $message);
89 if ($isInternalServerError) {
90 \header('HTTP/1.1 500 Internal Server Error');
91 }
92 }
93 // We return only an HTML fragment for AJAX requests
94 if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && \strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
95 return "<div class='alert alert-danger'><strong>Error:</strong> {$message}</div>";
96 }
97 if (empty($logoUrl)) {
98 $logoUrl = "plugins/Morpheus/images/logo.svg";
99 }
100 if (empty($faviconUrl)) {
101 $faviconUrl = "plugins/CoreHome/images/favicon.png";
102 }
103 if ($optionalTrace) {
104 $optionalTrace = '<h2>Stack trace</h2><pre>' . \htmlentities($optionalTrace, \ENT_COMPAT | \ENT_HTML401, 'UTF-8') . '</pre>';
105 }
106 if ($isCli === null) {
107 $isCli = \PHP_SAPI == 'cli';
108 }
109 if ($optionalLinks) {
110 $adjustUrl = function ($url) {
111 if (\class_exists(\Piwik\Url::class)) {
112 return \Piwik\Url::addCampaignParametersToMatomoLink($url);
113 }
114 return $url;
115 };
116 $optionalLinks = '<ul>
117 <li><a rel="noreferrer noopener" target="_blank" href="' . $adjustUrl('https://matomo.org') . '">Matomo.org homepage</a></li>
118 <li><a rel="noreferrer noopener" target="_blank" href="' . $adjustUrl('https://matomo.org/faq/') . '">Frequently Asked Questions</a></li>
119 <li><a rel="noreferrer noopener" target="_blank" href="' . $adjustUrl('https://matomo.org/docs/') . '">User Guides</a></li>
120 <li><a rel="noreferrer noopener" target="_blank" href="' . $adjustUrl('https://forum.matomo.org/') . '">Matomo Forums</a></li>
121 <li><a rel="noreferrer noopener" target="_blank" href="' . $adjustUrl('https://matomo.org/support/') . '">Professional Support for Matomo</a></li>
122 </ul>';
123 }
124 if ($optionalLinkBack) {
125 $optionalLinkBack = '<a href="javascript:window.history.back();">Go Back</a>';
126 }
127 $headerPage = \file_get_contents(\PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl');
128 $headerPage = \str_replace('%logoUrl%', $logoUrl, $headerPage);
129 $headerPage = \str_replace('%faviconUrl%', $faviconUrl, $headerPage);
130 $footerPage = \file_get_contents(\PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl');
131 $headerPage = \str_replace('{$HTML_TITLE}', \PAGE_TITLE_WHEN_ERROR, $headerPage);
132 $backLinks = '<p>' . $optionalLinkBack . ' | <a href="index.php">Go to Matomo</a>' . '</p>';
133 $redirectSection = '';
134 if ($hasCountdownRedirect) {
135 $redirectSection = '<p>
136 Please click below if you are not redirected in ' . $countdown . ' seconds</br></br>
137 Go to <a href="' . $redirectUrl . '">' . \htmlspecialchars($redirectUrl) . '</a>
138 </p>
139 <style>.header,.footer { display:none;}</style>
140 <script>setTimeout(function(){window.location.href="' . $redirectUrl . '"}, ' . $countdown * 1000 . ');</script>';
141 $backLinks = '';
142 $optionalLinks = '';
143 }
144 $content = '<h2>' . $message . '</h2>' . $redirectSection . $backLinks . ' ' . (\Piwik_ShouldPrintBackTraceWithMessage() ? $optionalTrace : '') . ' ' . $optionalLinks;
145 $message = \str_replace(array("<br />", "<br>", "<br/>", "</p>"), "\n", $message);
146 $message = \str_replace("\t", "", $message);
147 $message = \strip_tags($message);
148 if (!$isCli) {
149 $message = $headerPage . $content . $footerPage;
150 }
151 $message .= "\n";
152 return $message;
153 }
154 }
155 if (!empty($piwik_errorMessage)) {
156 echo \Piwik_GetErrorMessagePage($piwik_errorMessage, \false, \true);
157 exit(1);
158 }
159 }
160