Skip to content

Commit

Permalink
Update Plugin.php
Browse files Browse the repository at this point in the history
sqlite version
  • Loading branch information
TwinIsland authored Dec 30, 2022
1 parent 79f14f2 commit 2cfe8af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static function activate()

// 创建表
$dbname =$db->getPrefix() . 'exsearch';
$sql = "SHOW TABLES LIKE '%" . $dbname . "%'";
$sql = "SELECT * FROM sqlite_master WHERE type='table' AND name='".$dbname."'";
if (count($db->fetchAll($sql)) == 0) {
$sql = '
DROP TABLE IF EXISTS `'.$dbname.'`;
Expand All @@ -43,7 +43,7 @@ public static function activate()
`key` char(32) not null,
`data` longtext,
primary key (`id`)
) default charset=utf8';
)';

$sqls = explode(';', $sql);
foreach ($sqls as $sql) {
Expand Down Expand Up @@ -179,7 +179,7 @@ private static function clean()
{
$db = Typecho_Db::get();
$dbname = $db->getPrefix() . 'exsearch';
$sql = "SHOW TABLES LIKE '%" . $dbname . "%'";
$sql = "SELECT * FROM sqlite_master WHERE type='table' AND name='".$dbname."'";
if(count($db->fetchAll($sql)) != 0){
$db->query($db->delete('table.exsearch')->where('id >= ?', 0));
}
Expand Down Expand Up @@ -331,4 +331,4 @@ public static function footer()
<script src="<?php Helper::options()->pluginUrl('ExSearch/assets/ExSearch-6e577ac4e0.js'); ?>"></script>
<?php
}
}
}

0 comments on commit 2cfe8af

Please sign in to comment.