From c61f9d452d071516baebc33eb17897d81f5c9427 Mon Sep 17 00:00:00 2001 From: fisharebest Date: Thu, 29 Jul 2010 21:50:03 +0000 Subject: pgv-wt wizard - don't fail if fav/news modules are disabled --- pgv_to_wt.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'pgv_to_wt.php') diff --git a/pgv_to_wt.php b/pgv_to_wt.php index e3b248265c..260bc9ad24 100644 --- a/pgv_to_wt.php +++ b/pgv_to_wt.php @@ -664,18 +664,26 @@ WT_DB::prepare( //////////////////////////////////////////////////////////////////////////////// echo '

pgv_favorites => wt_favorites ...

'; flush(); -WT_DB::prepare( - "REPLACE INTO `##favorites` (fv_id, fv_username, fv_gid, fv_type, fv_file, fv_url, fv_title, fv_note)". - " SELECT fv_id, fv_username, fv_gid, fv_type, fv_file, fv_url, fv_title, fv_note FROM {$DBNAME}.{$TBLPREFIX}favorites" -)->execute(); +try { + WT_DB::prepare( + "REPLACE INTO `##favorites` (fv_id, fv_username, fv_gid, fv_type, fv_file, fv_url, fv_title, fv_note)". + " SELECT fv_id, fv_username, fv_gid, fv_type, fv_file, fv_url, fv_title, fv_note FROM {$DBNAME}.{$TBLPREFIX}favorites" + )->execute(); +} catch (PDOException $ex) { + // This table will only exist if the favorites module is installed in WT +} //////////////////////////////////////////////////////////////////////////////// echo '

pgv_news => wt_news ...

'; flush(); -WT_DB::prepare( - "REPLACE INTO `##news` (n_id, n_username, n_date, n_title, n_text)". - " SELECT n_id, n_username, n_date, n_title, n_text FROM {$DBNAME}.{$TBLPREFIX}news" -)->execute(); +try { + WT_DB::prepare( + "REPLACE INTO `##news` (n_id, n_username, n_date, n_title, n_text)". + " SELECT n_id, n_username, n_date, n_title, n_text FROM {$DBNAME}.{$TBLPREFIX}news" + )->execute(); +} catch (PDOException $ex) { + // This table will only exist if the news/blog module is installed in WT +} //////////////////////////////////////////////////////////////////////////////// @@ -760,7 +768,7 @@ try { " SELECT pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon FROM {$DBNAME}.{$TBLPREFIX}placelocation" )->execute(); } catch (PDOexception $ex) { - // This table will only exist if the gm module is installed in PGV + // This table will only exist if the gm module is installed in PGV/WT } //////////////////////////////////////////////////////////////////////////////// -- cgit v1.3