| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public function safeUp() |
||
| 19 | { |
||
| 20 | if (Craft::$app->db->schema->getTableSchema('{{%facebook_accounts}}') !== null) { |
||
| 21 | return null; |
||
| 22 | } |
||
| 23 | |||
| 24 | $this->createTable( |
||
| 25 | '{{%facebook_accounts}}', |
||
| 26 | [ |
||
| 27 | 'id' => $this->primaryKey(), |
||
| 28 | 'token' => $this->text(), |
||
| 29 | 'dateCreated' => $this->dateTime()->notNull(), |
||
| 30 | 'dateUpdated' => $this->dateTime()->notNull(), |
||
| 31 | 'uid' => $this->uid() |
||
| 32 | ] |
||
| 33 | ); |
||
| 34 | |||
| 35 | // Don't try to port the token to the new accounts table since the OAuth scope has changed in Facebook 2.0.4 |
||
| 36 | |||
| 37 | // Reset the token on the settings since it will now be stored in the accounts table |
||
| 38 | $settings = Plugin::$plugin->getSettings(); |
||
| 39 | $settings->token = null; |
||
| 40 | $plugin = Craft::$app->getPlugins()->getPlugin('facebook'); |
||
| 41 | Craft::$app->getPlugins()->savePluginSettings($plugin, $settings->toArray()); |
||
| 42 | } |
||
| 53 |