PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.0.7
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.0.7
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 years ago Access 2 years ago Application 2 years ago Archive 2 years ago ArchiveProcessor 2 years ago Archiver 2 years ago AssetManager 2 years ago Auth 2 years ago Category 2 years ago Changes 2 years ago CliMulti 2 years ago Columns 2 years ago Concurrency 2 years ago Config 2 years ago Container 2 years ago CronArchive 2 years ago DataAccess 2 years ago DataFiles 2 years ago DataTable 2 years ago Db 2 years ago DeviceDetector 2 years ago Email 2 years ago Exception 2 years ago Http 2 years ago Intl 2 years ago Log 2 years ago Mail 2 years ago Measurable 2 years ago Menu 2 years ago Metrics 2 years ago Notification 2 years ago Period 2 years ago Plugin 2 years ago ProfessionalServices 2 years ago Report 2 years ago ReportRenderer 2 years ago Scheduler 2 years ago Segment 2 years ago Session 2 years ago Settings 2 years ago Tracker 2 years ago Translation 2 years ago Twig 2 years ago UpdateCheck 2 years ago Updater 2 years ago Updates 2 years ago Validators 2 years ago View 2 years ago ViewDataTable 2 years ago Visualization 2 years ago Widget 2 years ago .htaccess 2 years ago Access.php 2 years ago Archive.php 2 years ago ArchiveProcessor.php 2 years ago AssetManager.php 2 years ago Auth.php 2 years ago AuthResult.php 2 years ago BaseFactory.php 2 years ago Cache.php 2 years ago CacheId.php 2 years ago CliMulti.php 2 years ago Common.php 2 years ago Config.php 2 years ago Console.php 2 years ago Context.php 2 years ago Cookie.php 2 years ago CronArchive.php 2 years ago DI.php 2 years ago DataArray.php 2 years ago DataTable.php 2 years ago Date.php 2 years ago Db.php 2 years ago DbHelper.php 2 years ago Development.php 2 years ago ErrorHandler.php 2 years ago EventDispatcher.php 2 years ago ExceptionHandler.php 2 years ago FileIntegrity.php 2 years ago Filechecks.php 2 years ago Filesystem.php 2 years ago FrontController.php 2 years ago Http.php 2 years ago IP.php 2 years ago Log.php 2 years ago LogDeleter.php 2 years ago Mail.php 2 years ago Metrics.php 2 years ago NoAccessException.php 2 years ago Nonce.php 2 years ago Notification.php 2 years ago NumberFormatter.php 2 years ago Option.php 2 years ago Period.php 2 years ago Piwik.php 2 years ago Plugin.php 2 years ago Profiler.php 2 years ago ProxyHeaders.php 2 years ago ProxyHttp.php 2 years ago QuickForm2.php 2 years ago RankingQuery.php 2 years ago ReportRenderer.php 2 years ago Request.php 2 years ago Segment.php 2 years ago Sequence.php 2 years ago Session.php 2 years ago SettingsPiwik.php 2 years ago SettingsServer.php 2 years ago Singleton.php 2 years ago Site.php 2 years ago SiteContentDetector.php 2 years ago SupportedBrowser.php 2 years ago TCPDF.php 2 years ago Theme.php 2 years ago Timer.php 2 years ago Tracker.php 2 years ago Twig.php 2 years ago Unzip.php 2 years ago UpdateCheck.php 2 years ago Updater.php 2 years ago UpdaterErrorException.php 2 years ago Updates.php 2 years ago Url.php 2 years ago UrlHelper.php 2 years ago Version.php 2 years ago View.php 2 years ago bootstrap.php 2 years ago dispatch.php 2 years ago testMinimumPhpVersion.php 2 years ago
testMinimumPhpVersion.php
157 lines
1 <?php
2
3 namespace {
4 /**
5 * Matomo - free/libre analytics platform
6 *
7 * @link https://matomo.org
8 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
9 *
10 */
11 /**
12 * This file is executed before anything else.
13 * It checks the minimum PHP version required to run Matomo.
14 * This file must be compatible with PHP 5.3.
15 */
16 use Piwik\Url;
17 $piwik_errorMessage = '';
18 // Minimum requirement: stream_resolve_include_path, working json_encode in 5.3.3, namespaces in 5.3
19 // NOTE: when changing this variable, we also need to update
20 // 1) api.matomo.org
21 // 2) composer.json (in two places)
22 // 3) tests/PHPUnit/Integration/ReleaseCheckListTest.php
23 global $piwik_minimumPHPVersion;
24 $piwik_minimumPHPVersion = '7.2.5';
25 $piwik_currentPHPVersion = \PHP_VERSION;
26 $minimumPhpInvalid = \version_compare($piwik_minimumPHPVersion, $piwik_currentPHPVersion) > 0;
27 if ($minimumPhpInvalid) {
28 $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>";
29 } else {
30 if (!\extension_loaded('session')) {
31 $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>";
32 }
33 if (!\function_exists('ini_set')) {
34 $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>";
35 }
36 if (\ini_get('mbstring.func_overload')) {
37 $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>";
38 }
39 if (!\function_exists('json_encode')) {
40 $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>";
41 }
42 if (!\file_exists(\PIWIK_VENDOR_PATH . '/autoload.php')) {
43 $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> ";
44 if (\DIRECTORY_SEPARATOR === '\\') {
45 $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 ";
46 }
47 $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='" . Url::addCampaignParametersToMatomoLink('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>";
48 }
49 }
50 \define('PAGE_TITLE_WHEN_ERROR', 'Matomo &rsaquo; Error');
51 if (!\function_exists('Piwik_GetErrorMessagePage')) {
52 /**
53 * Returns true if Piwik should print the backtrace with error messages.
54 *
55 * To make sure the backtrace is printed, define PIWIK_PRINT_ERROR_BACKTRACE.
56 *
57 * @return bool
58 */
59 function Piwik_ShouldPrintBackTraceWithMessage()
60 {
61 if (\class_exists('\\Piwik\\SettingsServer') && \class_exists('\\Piwik\\Common') && \Piwik\SettingsServer::isArchivePhpTriggered() && \Piwik\Common::isPhpCliMode()) {
62 return \true;
63 }
64 $bool = \defined('PIWIK_PRINT_ERROR_BACKTRACE') && \PIWIK_PRINT_ERROR_BACKTRACE || !empty($GLOBALS['PIWIK_PRINT_ERROR_BACKTRACE']) || !empty($GLOBALS['PIWIK_TRACKER_DEBUG']);
65 return $bool;
66 }
67 /**
68 * Displays info/warning/error message in a friendly UI and exits.
69 *
70 * Note: this method should not be called by anyone other than FrontController.
71 *
72 * @param string $message Main message, must be html encoded before calling
73 * @param bool|string $optionalTrace Backtrace; will be displayed in lighter color
74 * @param bool $optionalLinks If true, will show links to the Piwik website for help
75 * @param bool $optionalLinkBack If true, displays a link to go back
76 * @param bool|string $logoUrl The URL to the logo to use.
77 * @param bool|string $faviconUrl The URL to the favicon to use.
78 * @param string $errorLogPrefix String to prepend to the error in log file
79 * @param bool $writeErrorLog If true then a webserver error log will be written, defaults to true
80 * @return string
81 */
82 function Piwik_GetErrorMessagePage($message, $optionalTrace = \false, $optionalLinks = \false, $optionalLinkBack = \false, $logoUrl = \false, $faviconUrl = \false, $isCli = null, $errorLogPrefix = '', $writeErrorLog = \true, $redirectUrl = null, $countdown = null)
83 {
84 $hasCountdownRedirect = !empty($redirectUrl) && !empty($countdown);
85 if ($writeErrorLog) {
86 \error_log(\sprintf("{$errorLogPrefix}Error in Matomo: %s", \str_replace("\n", " ", \strip_tags($message))));
87 }
88 if (!\headers_sent()) {
89 \header('Content-Type: text/html; charset=utf-8');
90 \header('Cache-Control: private, no-cache, no-store');
91 $isInternalServerError = \preg_match('/(sql|database|mysql)/i', $message);
92 if ($isInternalServerError) {
93 \header('HTTP/1.1 500 Internal Server Error');
94 }
95 }
96 // We return only an HTML fragment for AJAX requests
97 if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && \strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
98 return "<div class='alert alert-danger'><strong>Error:</strong> {$message}</div>";
99 }
100 if (empty($logoUrl)) {
101 $logoUrl = "plugins/Morpheus/images/logo.svg";
102 }
103 if (empty($faviconUrl)) {
104 $faviconUrl = "plugins/CoreHome/images/favicon.png";
105 }
106 if ($optionalTrace) {
107 $optionalTrace = '<h2>Stack trace</h2><pre>' . \htmlentities($optionalTrace, \ENT_COMPAT | \ENT_HTML401, 'UTF-8') . '</pre>';
108 }
109 if ($isCli === null) {
110 $isCli = \PHP_SAPI == 'cli';
111 }
112 if ($optionalLinks) {
113 $optionalLinks = '<ul>
114 <li><a rel="noreferrer noopener" target="_blank" href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org') . '">Matomo.org homepage</a></li>
115 <li><a rel="noreferrer noopener" target="_blank" href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/') . '">Frequently Asked Questions</a></li>
116 <li><a rel="noreferrer noopener" target="_blank" href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/docs/') . '">User Guides</a></li>
117 <li><a rel="noreferrer noopener" target="_blank" href="' . Url::addCampaignParametersToMatomoLink('https://forum.matomo.org/') . '">Matomo Forums</a></li>
118 <li><a rel="noreferrer noopener" target="_blank" href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/support/') . '">Professional Support for Matomo</a></li>
119 </ul>';
120 }
121 if ($optionalLinkBack) {
122 $optionalLinkBack = '<a href="javascript:window.history.back();">Go Back</a>';
123 }
124 $headerPage = \file_get_contents(\PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl');
125 $headerPage = \str_replace('%logoUrl%', $logoUrl, $headerPage);
126 $headerPage = \str_replace('%faviconUrl%', $faviconUrl, $headerPage);
127 $footerPage = \file_get_contents(\PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl');
128 $headerPage = \str_replace('{$HTML_TITLE}', \PAGE_TITLE_WHEN_ERROR, $headerPage);
129 $backLinks = '<p>' . $optionalLinkBack . ' | <a href="index.php">Go to Matomo</a>' . '</p>';
130 $redirectSection = '';
131 if ($hasCountdownRedirect) {
132 $redirectSection = '<p>
133 Please click below if you are not redirected in ' . $countdown . ' seconds</br></br>
134 Go to <a href="' . $redirectUrl . '">' . \htmlspecialchars($redirectUrl) . '</a>
135 </p>
136 <style>.header,.footer { display:none;}</style>
137 <script>setTimeout(function(){window.location.href="' . $redirectUrl . '"}, ' . $countdown * 1000 . ');</script>';
138 $backLinks = '';
139 $optionalLinks = '';
140 }
141 $content = '<h2>' . $message . '</h2>' . $redirectSection . $backLinks . ' ' . (\Piwik_ShouldPrintBackTraceWithMessage() ? $optionalTrace : '') . ' ' . $optionalLinks;
142 $message = \str_replace(array("<br />", "<br>", "<br/>", "</p>"), "\n", $message);
143 $message = \str_replace("\t", "", $message);
144 $message = \strip_tags($message);
145 if (!$isCli) {
146 $message = $headerPage . $content . $footerPage;
147 }
148 $message .= "\n";
149 return $message;
150 }
151 }
152 if (!empty($piwik_errorMessage)) {
153 echo \Piwik_GetErrorMessagePage($piwik_errorMessage, \false, \true);
154 exit(1);
155 }
156 }
157