From 33d711215dbe6309f0206122fd7e7ebc80be31d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 8 Mar 2021 22:22:55 -0300 Subject: [PATCH] Remove the PMA_VERSION constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses the PhpMyAdmin\Version::VERSION constant instead. Signed-off-by: MaurĂ­cio Meneghini Fauth --- js/src/ajax.js | 8 ++++---- libraries/classes/Config.php | 4 ---- libraries/classes/Controllers/HomeController.php | 2 +- libraries/classes/ErrorReport.php | 2 +- libraries/classes/Header.php | 6 +++--- libraries/classes/OpenDocument.php | 4 ++-- libraries/classes/Pdf.php | 2 +- libraries/classes/Plugins/Export/ExportJson.php | 3 ++- libraries/classes/Plugins/Export/ExportLatex.php | 3 ++- .../classes/Plugins/Export/ExportPhparray.php | 3 ++- libraries/classes/Plugins/Export/ExportSql.php | 3 ++- libraries/classes/Plugins/Export/ExportXml.php | 3 ++- .../Plugins/Schema/Eps/EpsRelationSchema.php | 3 ++- .../Plugins/Schema/Svg/SvgRelationSchema.php | 3 ++- libraries/classes/Relation.php | 8 ++++---- libraries/classes/Scripts.php | 2 +- libraries/classes/Setup/ConfigGenerator.php | 3 ++- libraries/classes/Setup/Index.php | 5 ++--- libraries/classes/Sql.php | 2 +- libraries/classes/Util.php | 2 +- test/bootstrap-static.php | 1 - test/classes/AbstractTestCase.php | 15 +-------------- test/classes/BookmarkTest.php | 1 - test/classes/Config/FormDisplayTest.php | 1 - test/classes/Config/FormTest.php | 1 - test/classes/ConfigTest.php | 4 +--- .../Database/PrivilegesControllerTest.php | 1 - .../Database/StructureControllerTest.php | 1 - .../Controllers/ExportTemplateControllerTest.php | 3 ++- .../Controllers/Server/BinlogControllerTest.php | 1 - .../Server/CollationsControllerTest.php | 1 - .../Server/DatabasesControllerTest.php | 1 - .../Controllers/Server/EnginesControllerTest.php | 1 - .../Controllers/Server/PluginsControllerTest.php | 1 - .../Server/Status/VariablesControllerTest.php | 1 - .../Server/VariablesControllerTest.php | 1 - .../Table/FindReplaceControllerTest.php | 1 - .../Controllers/Table/IndexesControllerTest.php | 1 - .../Table/PrivilegesControllerTest.php | 1 - .../Controllers/Table/RelationControllerTest.php | 1 - .../Controllers/Table/ReplaceControllerTest.php | 4 ++-- .../Controllers/Table/SearchControllerTest.php | 1 - .../Controllers/Table/StructureControllerTest.php | 1 - test/classes/CoreTest.php | 1 - test/classes/Database/CentralColumnsTest.php | 4 ++-- test/classes/Database/Designer/CommonTest.php | 4 ++-- test/classes/Database/DesignerTest.php | 4 ++-- test/classes/Database/QbeTest.php | 1 - test/classes/Database/RoutinesTest.php | 1 - test/classes/Database/TriggersTest.php | 1 - test/classes/DatabaseInterfaceTest.php | 1 - test/classes/Display/ResultsTest.php | 4 ++-- test/classes/ErrorReportTest.php | 6 +++--- test/classes/HeaderTest.php | 1 - test/classes/InsertEditTest.php | 1 - test/classes/MenuTest.php | 1 - .../Navigation/Nodes/NodeDatabaseChildTest.php | 4 ++-- .../classes/Navigation/Nodes/NodeDatabaseTest.php | 1 - test/classes/NormalizationTest.php | 1 - .../Plugins/Auth/AuthenticationCookieTest.php | 1 - .../Plugins/Auth/AuthenticationSignonTest.php | 1 - test/classes/Plugins/Export/ExportCsvTest.php | 1 - .../classes/Plugins/Export/ExportHtmlwordTest.php | 8 ++++---- test/classes/Plugins/Export/ExportJsonTest.php | 4 ++-- test/classes/Plugins/Export/ExportLatexTest.php | 8 ++++---- .../Plugins/Export/ExportMediawikiTest.php | 1 - test/classes/Plugins/Export/ExportOdsTest.php | 1 - test/classes/Plugins/Export/ExportOdtTest.php | 6 +++--- test/classes/Plugins/Export/ExportPdfTest.php | 1 - .../classes/Plugins/Export/ExportPhparrayTest.php | 1 - test/classes/Plugins/Export/ExportSqlTest.php | 4 ++-- .../classes/Plugins/Export/ExportTexytextTest.php | 4 ++-- test/classes/Plugins/Export/ExportXmlTest.php | 1 - test/classes/Plugins/Export/ExportYamlTest.php | 1 - .../Plugins/Schema/DiaRelationSchemaTest.php | 4 ++-- .../Plugins/Schema/EpsRelationSchemaTest.php | 4 ++-- .../Plugins/Schema/ExportRelationSchemaTest.php | 1 - .../Plugins/Schema/PdfRelationSchemaTest.php | 4 ++-- .../Plugins/Schema/SvgRelationSchemaTest.php | 4 ++-- test/classes/RelationCleanupTest.php | 4 ++-- test/classes/RelationTest.php | 1 - test/classes/ScriptsTest.php | 3 ++- test/classes/Server/PrivilegesTest.php | 6 +++--- test/classes/Server/UserGroupsTest.php | 4 ++-- test/classes/Setup/ConfigGeneratorTest.php | 4 ++-- test/classes/Setup/FormProcessingTest.php | 1 - test/classes/SqlQueryFormTest.php | 4 ++-- test/classes/SqlTest.php | 1 - test/classes/Stubs/DbiDummy.php | 3 ++- test/classes/SystemDatabaseTest.php | 4 ++-- test/classes/TableTest.php | 1 - test/classes/ThemeManagerTest.php | 1 - test/classes/ThemeTest.php | 1 - test/classes/TrackerTest.php | 10 +++++----- test/classes/TrackingTest.php | 4 ++-- test/classes/TransformationsTest.php | 6 +++--- test/classes/TwoFactorTest.php | 1 - test/classes/UserPreferencesTest.php | 8 ++++---- test/classes/UtilTest.php | 6 ++---- test/classes/VersionInformationTest.php | 1 + test/phpstan-constants.php | 1 - 101 files changed, 115 insertions(+), 172 deletions(-) diff --git a/js/src/ajax.js b/js/src/ajax.js index 5d6cd1d71d..291ecffac8 100644 --- a/js/src/ajax.js +++ b/js/src/ajax.js @@ -699,10 +699,10 @@ var AJAX = { // Clear loaded scripts if they are from another version of phpMyAdmin. // Depends on common params being set before loading scripts in responseHandler if (self.scriptsVersion === null) { - self.scriptsVersion = CommonParams.get('PMA_VERSION'); - } else if (self.scriptsVersion !== CommonParams.get('PMA_VERSION')) { + self.scriptsVersion = CommonParams.get('version'); + } else if (self.scriptsVersion !== CommonParams.get('version')) { self.scripts = []; - self.scriptsVersion = CommonParams.get('PMA_VERSION'); + self.scriptsVersion = CommonParams.get('version'); } self.scriptsCompleted = false; self.scriptsToBeFired = []; @@ -772,7 +772,7 @@ var AJAX = { script.type = 'text/javascript'; var file = name.indexOf('vendor/') !== -1 ? name : 'dist/' + name; - script.src = 'js/' + file + '?' + 'v=' + encodeURIComponent(CommonParams.get('PMA_VERSION')); + script.src = 'js/' + file + '?' + 'v=' + encodeURIComponent(CommonParams.get('version')); script.async = false; script.onload = function () { self.done(name, callback); diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index cb9b8794bc..53351e4934 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -137,9 +137,6 @@ class Config */ public function checkSystem(): void { - // All the version handling is now done in the Version class - $this->set('PMA_VERSION', Version::VERSION); - $this->checkWebServerOs(); $this->checkWebServer(); $this->checkGd2(); @@ -1052,7 +1049,6 @@ class Config $GLOBALS['is_https'] = $this->get('is_https'); $defines = [ - 'PMA_VERSION', 'PMA_IS_WINDOWS', 'PMA_IS_GD2', 'PMA_USR_OS', diff --git a/libraries/classes/Controllers/HomeController.php b/libraries/classes/Controllers/HomeController.php index dda1f8b0aa..0a0dfe784b 100644 --- a/libraries/classes/Controllers/HomeController.php +++ b/libraries/classes/Controllers/HomeController.php @@ -247,7 +247,7 @@ class HomeController extends AbstractController 'web_server' => $webServer, 'show_php_info' => $cfg['ShowPhpInfo'], 'is_version_checked' => $cfg['VersionCheck'], - 'phpmyadmin_version' => PMA_VERSION, + 'phpmyadmin_version' => Version::VERSION, 'phpmyadmin_major_version' => Version::SERIES, 'config_storage_message' => $configStorageMessage ?? '', 'has_theme_manager' => $cfg['ThemeManager'], diff --git a/libraries/classes/ErrorReport.php b/libraries/classes/ErrorReport.php index 77855133b9..80838df816 100644 --- a/libraries/classes/ErrorReport.php +++ b/libraries/classes/ErrorReport.php @@ -80,7 +80,7 @@ class ErrorReport $relParams = $this->relation->getRelationsParam(); // common params for both, php & js exceptions $report = [ - 'pma_version' => PMA_VERSION, + 'pma_version' => Version::VERSION, 'browser_name' => PMA_USR_BROWSER_AGENT, 'browser_version' => PMA_USR_BROWSER_VER, 'user_os' => PMA_USR_OS, diff --git a/libraries/classes/Header.php b/libraries/classes/Header.php index a64d9260b8..53bcc66f02 100644 --- a/libraries/classes/Header.php +++ b/libraries/classes/Header.php @@ -256,7 +256,7 @@ class Header 'is_https' => $GLOBALS['config']->isHttps(), 'rootPath' => $GLOBALS['config']->getRootPath(), 'arg_separator' => Url::getArgSeparator(), - 'PMA_VERSION' => PMA_VERSION, + 'version' => Version::VERSION, ]; if (isset($GLOBALS['cfg']['Server'], $GLOBALS['cfg']['Server']['auth_type'])) { $params['auth_type'] = $GLOBALS['cfg']['Server']['auth_type']; @@ -369,7 +369,7 @@ class Header public function enablePrintView(): void { $this->disableMenuAndConsole(); - $this->setTitle(__('Print view') . ' - phpMyAdmin ' . PMA_VERSION); + $this->setTitle(__('Print view') . ' - phpMyAdmin ' . Version::VERSION); $this->isPrintView = true; } @@ -710,7 +710,7 @@ class Header */ public static function getVersionParameter(): string { - return 'v=' . urlencode(PMA_VERSION); + return 'v=' . urlencode(Version::VERSION); } private function getVariablesForJavaScript(): string diff --git a/libraries/classes/OpenDocument.php b/libraries/classes/OpenDocument.php index 2551883805..da36a6638c 100644 --- a/libraries/classes/OpenDocument.php +++ b/libraries/classes/OpenDocument.php @@ -44,8 +44,8 @@ EOT; . 'xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" ' . 'office:version="1.0">' . '' - . 'phpMyAdmin ' . PMA_VERSION . '' - . 'phpMyAdmin ' . PMA_VERSION + . 'phpMyAdmin ' . Version::VERSION . '' + . 'phpMyAdmin ' . Version::VERSION . '' . '' . strftime('%Y-%m-%dT%H:%M:%S') . '' diff --git a/libraries/classes/Pdf.php b/libraries/classes/Pdf.php index ae40983745..fbc0a158e1 100644 --- a/libraries/classes/Pdf.php +++ b/libraries/classes/Pdf.php @@ -65,7 +65,7 @@ class Pdf extends TCPDF $diskcache, $pdfa ); - $this->SetAuthor('phpMyAdmin ' . PMA_VERSION); + $this->SetAuthor('phpMyAdmin ' . Version::VERSION); $this->AddFont('DejaVuSans', '', 'dejavusans.php'); $this->AddFont('DejaVuSans', 'B', 'dejavusansb.php'); $this->SetFont(self::PMA_PDF_FONT, '', 14); diff --git a/libraries/classes/Plugins/Export/ExportJson.php b/libraries/classes/Plugins/Export/ExportJson.php index 23d4777b78..5a9262bfb0 100644 --- a/libraries/classes/Plugins/Export/ExportJson.php +++ b/libraries/classes/Plugins/Export/ExportJson.php @@ -15,6 +15,7 @@ use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup; use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem; use PhpMyAdmin\Properties\Options\Items\HiddenPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; +use PhpMyAdmin\Version; use function bin2hex; use function explode; @@ -122,7 +123,7 @@ class ExportJson extends ExportPlugin $meta = [ 'type' => 'header', - 'version' => PMA_VERSION, + 'version' => Version::VERSION, 'comment' => 'Export to JSON plugin for PHPMyAdmin', ]; diff --git a/libraries/classes/Plugins/Export/ExportLatex.php b/libraries/classes/Plugins/Export/ExportLatex.php index dc5e41eceb..d92d211fc6 100644 --- a/libraries/classes/Plugins/Export/ExportLatex.php +++ b/libraries/classes/Plugins/Export/ExportLatex.php @@ -16,6 +16,7 @@ use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem; use PhpMyAdmin\Properties\Options\Items\TextPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Util; +use PhpMyAdmin\Version; use function count; use function in_array; @@ -214,7 +215,7 @@ class ExportLatex extends ExportPlugin global $crlf, $cfg, $dbi; $head = '% phpMyAdmin LaTeX Dump' . $crlf - . '% version ' . PMA_VERSION . $crlf + . '% version ' . Version::VERSION . $crlf . '% https://www.phpmyadmin.net/' . $crlf . '%' . $crlf . '% ' . __('Host:') . ' ' . $cfg['Server']['host']; diff --git a/libraries/classes/Plugins/Export/ExportPhparray.php b/libraries/classes/Plugins/Export/ExportPhparray.php index 3f93ef9392..d05ee8f0e4 100644 --- a/libraries/classes/Plugins/Export/ExportPhparray.php +++ b/libraries/classes/Plugins/Export/ExportPhparray.php @@ -14,6 +14,7 @@ use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup; use PhpMyAdmin\Properties\Options\Items\HiddenPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Util; +use PhpMyAdmin\Version; use function preg_match; use function preg_replace; @@ -88,7 +89,7 @@ class ExportPhparray extends ExportPlugin 'exportComment('phpMyAdmin SQL Dump') - . $this->exportComment('version ' . PMA_VERSION) + . $this->exportComment('version ' . Version::VERSION) . $this->exportComment('https://www.phpmyadmin.net/') . $this->exportComment(); $host_string = __('Host:') . ' ' . $cfg['Server']['host']; diff --git a/libraries/classes/Plugins/Export/ExportXml.php b/libraries/classes/Plugins/Export/ExportXml.php index 6c5dbbd808..82e11b5c5e 100644 --- a/libraries/classes/Plugins/Export/ExportXml.php +++ b/libraries/classes/Plugins/Export/ExportXml.php @@ -15,6 +15,7 @@ use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem; use PhpMyAdmin\Properties\Options\Items\HiddenPropertyItem; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; use PhpMyAdmin\Util; +use PhpMyAdmin\Version; use function count; use function htmlspecialchars; @@ -248,7 +249,7 @@ class ExportXml extends ExportPlugin $head = '' . $crlf . '