From 70080fde65a6f24a7d4022a7fc982001d3024399 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 23 May 2008 22:24:00 +0000 Subject: [PATCH] Conditionally execute create/drop table dbmanager functions. MDL-14955 --- .../view_structure_php/view_structure_php.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/admin/xmldb/actions/view_structure_php/view_structure_php.class.php b/admin/xmldb/actions/view_structure_php/view_structure_php.class.php index 5fca953aaa..3e5846c127 100644 --- a/admin/xmldb/actions/view_structure_php/view_structure_php.class.php +++ b/admin/xmldb/actions/view_structure_php/view_structure_php.class.php @@ -211,8 +211,10 @@ class view_structure_php extends XMLDBAction { /// Launch the proper DDL $result .= XMLDB_LINEFEED; - $result .= ' /// Launch create table for ' . $table->getName() . XMLDB_LINEFEED; - $result .= ' $result = $result && create_table($table);' . XMLDB_LINEFEED; + $result .= ' /// Conditionally launch create table for ' . $table->getName() . XMLDB_LINEFEED; + $result .= ' if (!table_exists($table)) {' . XMLDB_LINEFEED; + $result .= ' $result = $result && create_table($table);' . XMLDB_LINEFEED; + $result .= ' }' . XMLDB_LINEFEED; /// Add the proper upgrade_xxxx_savepoint call $result .= $this->upgrade_savepoint_php ($structure); @@ -252,8 +254,10 @@ class view_structure_php extends XMLDBAction { /// Launch the proper DDL $result .= XMLDB_LINEFEED; - $result .= ' /// Launch drop table for ' . $table->getName() . XMLDB_LINEFEED; - $result .= ' $result = $result && drop_table($table);' . XMLDB_LINEFEED; + $result .= ' /// Conditionally launch drop table for ' . $table->getName() . XMLDB_LINEFEED; + $result .= ' if (table_exists($table)) {' . XMLDB_LINEFEED; + $result .= ' $result = $result && drop_table($table);' . XMLDB_LINEFEED; + $result .= ' }' . XMLDB_LINEFEED; /// Add the proper upgrade_xxxx_savepoint call $result .= $this->upgrade_savepoint_php ($structure); -- 2.39.5