本文整理汇总了PHP中install_data函数的典型用法代码示例。如果您正苦于以下问题:PHP install_data函数的具体用法?PHP install_data怎么用?PHP install_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了install_data函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_others
/**
* 其它设置
*
* @access public
* @param string $system_lang 系统语言
* @param string $disable_captcha 是否开启验证码
* @param array $goods_types 预选商品类型
* @param string $install_demo 是否安装测试数据
* @param string $integrate_code 用户接口
* @return boolean 成功返回true,失败返回false
*/
function do_others($system_lang, $captcha, $goods_types, $install_demo, $integrate_code)
{
global $err, $_LANG;
/* 安装预选商品类型 */
if (!install_goods_types($goods_types, $system_lang))
{
$err->add(implode('', $err->last_message()));
return false;
}
/* 安装测试数据 */
if (intval($install_demo))
{
if (file_exists(ROOT_PATH . 'demo/'. $system_lang . '.sql'))
{
$sql_files = array(ROOT_PATH . 'demo/'. $system_lang . '.sql');
}
else
{
$sql_files = array(ROOT_PATH . 'demo/zh_cn.sql');
}
if (!install_data($sql_files))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/brandlogo/', ROOT_PATH . 'data/brandlogo/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/200905/goods_img/', ROOT_PATH . 'images/200905/goods_img/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/200905/thumb_img/', ROOT_PATH . 'images/200905/thumb_img/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/200905/source_img/', ROOT_PATH . 'images/200905/source_img/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/afficheimg/', ROOT_PATH . 'data/afficheimg/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/packimg/', ROOT_PATH . 'data/packimg/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
if (!copy_files(ROOT_PATH . 'demo/cardimg/', ROOT_PATH . 'data/cardimg/'))
{
$err->add(implode('', $err->last_message()));
return false;
}
}
include(ROOT_PATH . 'data/config.php');
include_once(ROOT_PATH . 'includes/cls_mysql.php');
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
/* 更新 ECSHOP 语言 */
$sql = "UPDATE $prefix"."shop_config SET value='" . $system_lang . "' WHERE code='lang'";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
return false;
}
/* 更新用户接口 */
if (!empty($integrate_code))
{
$sql = "UPDATE $prefix"."shop_config SET value='" . $integrate_code . "' WHERE code='integrate_code'";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
return false;
}
}
/* 处理验证码 */
if (!empty($captcha))
//.........这里部分代码省略.........
示例2: VALUES
@mkdir(ROOT_PATH . 'data/backup_' . $backupdir, 0777);
}
if (is_dir(ROOT_PATH . 'data/backup_' . $backupdir)) {
$db->query("REPLACE INTO {$tablepre}common_setting (skey, svalue) VALUES ('backupdir', '{$backupdir}')");
}
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$siteuniqueid = 'DX' . $chars[date('y') % 60] . $chars[date('n')] . $chars[date('j')] . $chars[date('G')] . $chars[date('i')] . $chars[date('s')] . substr(md5($onlineip . $timestamp), 0, 4) . random(4);
$db->query("REPLACE INTO {$tablepre}common_setting (skey, svalue) VALUES ('authkey', '{$authkey}')");
$db->query("REPLACE INTO {$tablepre}common_setting (skey, svalue) VALUES ('siteuniqueid', '{$siteuniqueid}')");
$db->query("REPLACE INTO {$tablepre}common_setting (skey, svalue) VALUES ('adminemail', '{$email}')");
install_extra_setting();
$db->query("REPLACE INTO {$tablepre}common_setting (skey, svalue) VALUES ('backupdir', '" . $backupdir . "')");
$password = md5(random(10));
$db->query("REPLACE INTO {$tablepre}common_member (uid, username, password, adminid, groupid, email, regdate) VALUES ('{$uid}', '{$username}', '{$password}', '1', '1', '{$email}', '" . time() . "');");
$db->query("UPDATE {$tablepre}common_cron SET lastrun='0', nextrun='" . ($timestamp + 3600) . "'");
install_data($username, $uid);
if ($testdata) {
install_testdata($username, $uid);
}
if (!$portalstatus) {
$db->query("REPLACE INTO {$tablepre}common_setting (skey, svalue) VALUES ('portalstatus', '0')");
}
if (!$groupstatus) {
$db->query("REPLACE INTO {$tablepre}common_setting (skey, svalue) VALUES ('groupstatus', '0')");
}
if (!$homestatus) {
$db->query("REPLACE INTO {$tablepre}common_setting (skey, svalue) VALUES ('homestatus', '0')");
}
$yearmonth = date('Ym_', time());
loginit($yearmonth . 'ratelog');
loginit($yearmonth . 'illegallog');
示例3: JSON
break;
/* 获得版本列表 */
/* 获得版本列表 */
case 'get_ver_list':
include_once ROOT_PATH . 'includes/cls_json.php';
$json = new JSON();
$cur_ver = get_current_version();
$new_ver = get_new_version();
$needup_ver_list = get_needup_version_list($cur_ver, $new_ver);
/* 安装测试数据 */
if (file_exists(ROOT_PATH . 'demo/' . $system_lang . '.sql')) {
$sql_files = array(ROOT_PATH . 'demo/' . $system_lang . '.sql');
} else {
$sql_files = array(ROOT_PATH . 'demo/zh_cn.sql');
}
if (!install_data($sql_files)) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/brandlogo/', ROOT_PATH . 'data/brandlogo/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/200905/goods_img/', ROOT_PATH . 'images/200905/goods_img/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/200905/thumb_img/', ROOT_PATH . 'images/200905/thumb_img/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/200905/source_img/', ROOT_PATH . 'images/200905/source_img/')) {
die(implode(',', $err->last_message()));
}
if (!copy_files(ROOT_PATH . 'demo/afficheimg/', ROOT_PATH . 'data/afficheimg/')) {
示例4: create_config_file
$result = create_config_file($db_host, $db_port, $db_user, $db_pass, $db_name, $prefix, $timezone);
if ($result === false) {
data_back('构建配置文件失败');
}
$result = create_database($db_host, $db_port, $db_user, $db_pass, $db_name);
if ($result === false) {
data_back('创建数据库失败');
}
$system_lang = isset($_POST['system_lang']) ? $_POST['system_lang'] : 'zh_cn';
if (file_exists(ROOT_PATH . 'install/data/data_' . $system_lang . '.sql')) {
$data_path = ROOT_PATH . 'install/data/data_' . $system_lang . '.sql';
} else {
$data_path = ROOT_PATH . 'install/data/data_zh_cn.sql';
}
$sql_files = array(ROOT_PATH . 'install/data/structure.sql', $data_path);
$result = install_data($sql_files);
if ($result === false) {
data_back('构建数据库内容失败');
}
$admin_name = isset($_POST['admin_name']) ? json_str_iconv(trim($_POST['admin_name'])) : 'admin';
$admin_password = isset($_POST['password']) ? trim($_POST['password']) : '549c6dd086d5c7127745';
//ecshop123654
$admin_password2 = isset($_POST['admin_password2']) ? trim($_POST['admin_password2']) : '549c6dd086d5c7127745';
$admin_email = isset($_POST['admin_email']) ? trim($_POST['admin_email']) : '';
$result = create_admin_passport($admin_name, $admin_password, $admin_password2, $admin_email);
if ($result === false) {
data_back('创建管理员失败');
}
$system_lang = isset($_POST['system_lang']) ? $_POST['system_lang'] : 'zh_cn';
$captcha = isset($_POST['disable_captcha']) ? intval($_POST['disable_captcha']) : '0';
$install_demo = isset($_POST['data']) ? $_POST['data'] : 1;
示例5: install_base_data
function install_base_data()
{
$sql_files = array(WWW_ROOT . '/data/tools/o2o_CreateTable.sql', WWW_ROOT . '/data/tools/o2o_DefaultData.sql');
if (constant("Product") == "AllInOne") {
$sql_files[] = WWW_ROOT . '/data/tools/o2o-allinone.sql';
}
$sql_files[] = WWW_ROOT . '/data/tools/o2o_dictionaries.sql';
$db_host = isset($_POST['db_host']) ? trim($_POST['db_host']) : '';
$db_user = isset($_POST['db_user']) ? trim($_POST['db_user']) : '';
$db_pass = isset($_POST['db_pass']) ? trim($_POST['db_pass']) : '';
$db_name = isset($_POST['db_name']) ? trim($_POST['db_name']) : '';
$result = install_data($db_host, $db_user, $db_pass, $db_name, $sql_files);
if ($result === false) {
echo "install_base_data erro";
} else {
echo 'OK';
}
exit;
}
示例6: do_others
/**
* 其它设置
*
* @access public
* @param string $system_lang 系统语言
* @param string $disable_captcha 是否开启验证码
* @param array $goods_types 预选商品类型
* @param string $install_demo 是否安装测试数据
* @param string $integrate_code 用户接口
* @return boolean 成功返回true,失败返回false
*/
function do_others($db_host, $db_user, $db_pass, $db_name, $system_lang, $captcha, $goods_types, $install_demo, $install_lang, $integrate_code)
{
/* 安装测试数据 */
if (intval($install_demo)) {
if (file_exists(WWW_ROOT . '/data/tools/o2o_DemoData.sql')) {
$sql_files = array(WWW_ROOT . '/data/tools/o2o_DemoData.sql');
}
$result = install_data($db_host, $db_user, $db_pass, $db_name, $sql_files);
if (!empty($result) && $result === false) {
return false;
}
}
/* 修改多语言 */
if (intval($install_lang)) {
if (file_exists(WWW_ROOT . '/data/tools/lang.sql')) {
$sql_files = array(WWW_ROOT . '/data/tools/lang.sql');
}
$result = install_data($db_host, $db_user, $db_pass, $db_name, $sql_files);
if (!empty($result) && $result === false) {
return false;
}
}
//创建锁定文件
$db_path = dirname(ROOT_PATH) . '/data/install.lock';
//echo $db_path;
$fp = @fopen($db_path, 'wb+');
if (!$fp) {
return false;
}
if (!@fwrite($fp, "install")) {
return false;
}
@fclose($fp);
return true;
}
示例7: create_school_database
/**
* 创建学校数据库以及学校中需要的相关表
* @param string $code
*/
function create_school_database($code)
{
global $err;
$GLOBALS['db']->open_transaction();
//创建数据库
$flag = $GLOBALS['db']->query("create database " . $code . "_school");
if ($flag) {
try {
$sql_files = array(ROOT_PATH . 'admin/install/school.sql');
include_once ROOT_PATH . 'admin/install/lib_installer.php';
$flag = install_data($sql_files, $code . "_school");
if ($flag === false) {
echo implode(',', $err->get_all());
}
} catch (Exception $e) {
$GLOBALS['db']->query("drop database " . $code . "_school");
}
}
$GLOBALS['db']->close_transaction($flag);
return $flag;
}