public function install()
{
define("INSTALL", true);
import("Dir");
//安装目录
$path = APP_PATH . C("APP_GROUP_PATH") . DIRECTORY_SEPARATOR . $this->config['module'] . DIRECTORY_SEPARATOR . 'Install' . DIRECTORY_SEPARATOR;
$Dir = new Dir();
//SQL文件
if (file_exists($path . $this->config['module'] . '.sql')) {
$sql = file_get_contents($path . $this->config['module'] . '.sql');
$sql_split = $this->sql_split($sql, C("DB_PREFIX"));
$db = M('');
if (is_array($sql_split)) {
foreach ($sql_split as $s) {
$db->execute($s);
}
}
}
//Extention,菜单添加
if (file_exists($path . 'Extention.inc.php')) {
@(include $path . 'Extention.inc.php');
}
//前台模板
if (file_exists($path . "Template" . DIRECTORY_SEPARATOR)) {
$Dir->copyDir($path . "Template", $this->templatePath);
}
D("Module")->add(array("module" => $this->config['module'], "name" => $this->config['modulename'], "iscore" => 0, "version" => $this->config['version'], "description" => $this->config['introduce'], "disabled" => 1, "installdate" => date("Y-m-d"), "updatedate" => date("Y-m-d")));
return true;
}