| Total Complexity | 5 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class m2_initial_data extends \phpbb\db\migration\container_aware_migration |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @inheritdoc |
||
| 19 | */ |
||
| 20 | static public function depends_on() |
||
| 21 | { |
||
| 22 | return array( |
||
| 23 | '\blitze\content\migrations\v30x\m1_initial_schema', |
||
| 24 | '\blitze\content\migrations\converter\c1_update_config', |
||
| 25 | ); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @inheritdoc |
||
| 30 | */ |
||
| 31 | public function update_data() |
||
| 32 | { |
||
| 33 | return array( |
||
| 34 | array('custom', array(array($this, 'create_forum'))), |
||
| 35 | array('config.add', array('blitze_content_forum_id', 0)), |
||
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * |
||
| 41 | */ |
||
| 42 | public function create_forum() |
||
| 43 | { |
||
| 44 | $forum = $this->container->get('blitze.sitemaker.forum.manager'); |
||
| 45 | |||
| 46 | $forum_data = array( |
||
| 47 | 'forum_type' => FORUM_CAT, |
||
| 48 | 'forum_name' => 'Sitemaker Content', |
||
| 49 | ); |
||
| 50 | |||
| 51 | if (!empty($this->config['blitze_content_forum_id'])) |
||
| 52 | { |
||
| 53 | $forum_data['forum_id'] = (int) $this->config['blitze_content_forum_id']; |
||
| 54 | } |
||
| 55 | |||
| 56 | $errors = $forum->add($forum_data); |
||
| 57 | |||
| 58 | if (!sizeof($errors)) |
||
| 59 | { |
||
| 60 | $forum_id = (int) $forum_data['forum_id']; |
||
| 61 | $this->config->set('blitze_content_forum_id', $forum_id); |
||
| 62 | } |
||
| 65 |