From 367d5168bd7a726241d086b56d59a4c8dbf4999b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 3 Jun 2015 11:06:42 +0200 Subject: [PATCH] [ticket/555] Add default currency to donation modules in migration B3P-555 --- migrations/v210.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/migrations/v210.php b/migrations/v210.php index 3512afc8..a9652c71 100644 --- a/migrations/v210.php +++ b/migrations/v210.php @@ -20,6 +20,23 @@ class v210 extends \phpbb\db\migration\migration { return array( array('config.update', array('board3_portal_version', '2.1.0')), + array('custom', array(array($this, 'add_donation_setting'))), ); } + + /** + * Adds default currency setting to already installed donation modules + */ + public function add_donation_setting() + { + $sql = 'SELECT module_id + FROM ' . $this->table_prefix . "portal_modules + WHERE module_classname = '\\\board3\\\portal\\\modules\\\donation'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $this->config->set('board3_pay_default_' . $row['module_id'], 'EUR'); + } + $this->db->sql_freeresult($result); + } }