From 186a80939d8e87feedb244bf420308f17c8e5597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 24 Mar 2014 14:24:30 +0100 Subject: [PATCH 1/2] Allow TCPDF to be removed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We currently require TCPDF to be present, but in most cases this is feature which users do not need and thus can reduce size of installed phpMyAdmin. Also this is helpful for Linux distributions as they can provide soft dependency on tcpdf package. Signed-off-by: Michal Čihař --- ChangeLog | 1 + libraries/plugins/export/ExportPdf.class.php | 10 +++++++++- libraries/schema/Pdf_Relation_Schema.class.php | 8 ++++++++ libraries/schema/User_Schema.class.php | 8 ++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 84fe91a4d9..ab811bbdfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ phpMyAdmin - ChangeLog 4.1.12.0 (not yet released) - bug #4334 Add event : datepicker won't open - bug #4338 Fix missing value error while executing SQL query +- TCPDF library is now optional dependency 4.1.11.0 (2014-03-23) - bug #4335 reCaptcha problem (4.1.10 regression) diff --git a/libraries/plugins/export/ExportPdf.class.php b/libraries/plugins/export/ExportPdf.class.php index ffabb96efa..876f0700bb 100644 --- a/libraries/plugins/export/ExportPdf.class.php +++ b/libraries/plugins/export/ExportPdf.class.php @@ -10,6 +10,14 @@ if (! defined('PHPMYADMIN')) { exit; } +/** + * Skip the plugin if TCPDF is not available. + */ +if (! file_exists(TCPDF_INC)) { + $GLOBALS['skip_import'] = true; + return; +} + /* Get the export interface */ require_once 'libraries/plugins/ExportPlugin.class.php'; /* Get the PMA_ExportPdf class */ @@ -265,4 +273,4 @@ class ExportPdf extends ExportPlugin $this->_pdfReportTitle = $pdfReportTitle; } } -?> \ No newline at end of file +?> diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php index 67db5c42b0..7d881ec465 100644 --- a/libraries/schema/Pdf_Relation_Schema.class.php +++ b/libraries/schema/Pdf_Relation_Schema.class.php @@ -9,6 +9,14 @@ if (! defined('PHPMYADMIN')) { exit; } +/** + * Skip the plugin if TCPDF is not available. + */ +if (! file_exists(TCPDF_INC)) { + $GLOBALS['skip_import'] = true; + return; +} + /** * block attempts to directly run this script */ diff --git a/libraries/schema/User_Schema.class.php b/libraries/schema/User_Schema.class.php index 7cb6b83eb9..7d8c4d150c 100644 --- a/libraries/schema/User_Schema.class.php +++ b/libraries/schema/User_Schema.class.php @@ -663,7 +663,15 @@ class PMA_User_Schema __('File doesn\'t exist') ); } + $GLOBALS['skip_import'] = false; include $filename; + if ( $GLOBALS['skip_import']) { + PMA_Export_Relation_Schema::dieSchema( + $_POST['chpage'], + $export_type, + __('Plugin is disabled') + ); + } $class_name = 'PMA_' . $path . '_Relation_Schema'; $obj_schema = new $class_name(); $obj_schema->showOutput(); From dcb18efddc93a8a2b9e332b507c51e0f2f03379e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 25 Mar 2014 08:32:01 +0100 Subject: [PATCH 2/2] Do not offer PDF export if TCPDF is not present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/schema/User_Schema.class.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libraries/schema/User_Schema.class.php b/libraries/schema/User_Schema.class.php index 7d8c4d150c..b92c732025 100644 --- a/libraries/schema/User_Schema.class.php +++ b/libraries/schema/User_Schema.class.php @@ -419,12 +419,19 @@ class PMA_User_Schema $htmlString .= PMA_Util::getImage('b_views.png'); } + /* + * TODO: This list should be generated dynamically based on list of + * available plugins. + */ $htmlString .= __('Display relational schema') . ':' . '' - . ''; + if (file_exists(TCPDF_INC)) { + $htmlString .= ''; + } + $htmlString .= + '' . '' . '' . ''