浏览代码

Minor - format code, add "CREATE TABLE IF NOT EXISTS" see BT#14091

jmontoyaa 7 年之前
父节点
当前提交
54ea6f5833
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      plugin/dictionary/DictionaryPlugin.php

+ 13 - 1
plugin/dictionary/DictionaryPlugin.php

@@ -1,8 +1,14 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+/**
+ * Class DictionaryPlugin
+ */
 class DictionaryPlugin extends Plugin
 {
+    /**
+     * DictionaryPlugin constructor.
+     */
     protected function __construct()
     {
         parent::__construct(
@@ -23,9 +29,12 @@ class DictionaryPlugin extends Plugin
         return $result ? $result : $result = new self();
     }
 
+    /**
+     * @throws \Doctrine\DBAL\DBALException
+     */
     public function install()
     {
-        $sql = "CREATE TABLE plugin_dictionary (
+        $sql = "CREATE TABLE IF NOT EXISTS plugin_dictionary (
                 id INT NOT NULL AUTO_INCREMENT,
                 term VARCHAR(255) NOT NULL,
                 definition LONGTEXT NOT NULL,
@@ -34,6 +43,9 @@ class DictionaryPlugin extends Plugin
         Database::query($sql);
     }
 
+    /**
+     * @throws \Doctrine\DBAL\DBALException
+     */
     public function uninstall()
     {
         $sql = "DROP TABLE IF EXISTS plugin_dictionary";