public function _del() { $dir = Lua::get('dir'); Doo::loadHelper('DooFile'); $fileManager = new DooFile(0777); if (file_exists($this->cache . $dir . '/')) { $fileManager->delete($this->cache . $dir . '/'); } Lua::admin_msg('提示信息', '成功删除', './plugin.htm?action=ebak'); }
private function import() { set_time_limit(0); $path = Lua::get('path'); $path = LUA_ROOT . $path . '/cache/update/'; if (!file_exists($path)) { Lua::admin_msg('错误提示', '安装目录不存在'); } // 第一步 频道数据 $file = $path . 'channel.php'; include $file; $data = $data[1]; unset($data['id']); $data['createtime'] = time(); $data['isdefault'] = 0; $channel_id = Lua::insert('lua_channel', $data); // 第二步 导入数据结构 $file = $path . 'create.php'; include $file; // 第三步 模型数据 unset($data); $file = $path . 'model.php'; include $file; $models = $data[1]; $new_models = array(); $new_tables_1 = array(); // 栏目 $new_tables_2 = array(); // 碎片 $new_tables_3 = array(); // 插件 unset($data); foreach ($models as $v) { $model_id = $v['id']; unset($v['id']); $v['createtime'] = time(); $v['cid'] = $channel_id; $lastid = Lua::insert('lua_model', $v); $new_models[$model_id] = $lastid; // 第四步 数据表数据 $file = $path . 'model.' . $model_id . '.php'; include $file; $table = $data[1]; switch ($v['mtype']) { case 1: $new_tables_1 = array_merge($new_tables_1, $table); break; case 2: $new_tables_2 = array_merge($new_tables_2, $table); break; case 3: $new_tables_3 = array_merge($new_tables_3, $table); break; } $this->__import($model_id, $lastid, $table, $path); } // 第七步 栏目数据 $file = $path . 'cate.php'; include $file; $cate = $data[1]; $this->__cate(1, $new_models, $cate, $new_tables_1); unset($data); $file = $path . 'piece.php'; include $file; $cate = $data[1]; $this->__cate(2, $new_models, $cate, $new_tables_2); Doo::loadHelper('DooFile'); $fileManager = new DooFile(0777); $fileManager->delete($path); Lua::admin_msg('信息提示', '导入成功', './channel.htm'); }