f (!empty($uidarr)) {
$uids = array();
$update = array();
foreach ($uidarr as $_uid => $n) {
$uids[] = $_uid;
$update[$_uid] = array('articles-' => $n);
'mysql' != $conf['cache']['type'] and cache_delete('user-' . $_uid);
}
user_big_update(array('uid' => $uids), $update);
}
!empty($operate_create) && function_exists('operate_big_insert') and operate_big_insert($operate_create);
return TRUE;
}
// 大数据量容易超时 删除用户时使用,删除主题 回复 栏目统计 附件 全站统计
function well_thread_delete_all_by_uid($uid)
{
// 用户主题数
$user = user_read_cache($uid);
set_time_limit(0);
// 删除所有回复
if ($user['comments']) {
$postist = comment_pid_find_by_uid($uid, 1, $user['comments'], FALSE);
$pidarr = array();
foreach ($postist as $val) {
$pidarr[] = $val['pid'];
}
unset($postist);
!empty($pidarr) and comment_delete_by_pids($pidarr);
}
if ($user['articles']) {
// 如果主题、附件和回复数量太大会超时
$tidlist = thread_tid_find_by_uid($uid, 1, $user['articles'], FALSE, 'tid', array('tid'));
$tidarr = array();
foreach ($tidlist as $val) {
$tidarr[] = $val['tid'];
}
unset($tidlist);
!empty($tidarr) and well_thread_delete_all($tidarr);
}
return TRUE;
}
// 搜索标题
function well_thread_find_by_keyword($keyword, $d = NULL)
{
if (empty($keyword)) return NULL;
$db = $_SERVER['db'];
$d = $d ? $d : $db;
if (!$d) return FALSE;
$threadlist = db_sql_find("SELECT * FROM `{$d->tablepre}website_thread` WHERE subject LIKE '%$keyword%' LIMIT 60;", 'tid', $d);
if ($threadlist) {
$threadlist = arrlist_multisort($threadlist, 'tid', FALSE);
foreach ($threadlist as &$thread) {
well_thread_format($thread);
// 关键词标色
//$thread['subject'] = comment_highlight_keyword($thread['subject'], $keyword);
}
}
return $threadlist;
}
// 查找 最后评论 lastpid
function well_thread_find_lastpid($tid)
{
$arr = comment_pid_read(array('tid' => $tid), array('pid' => -1), array('pid'));
$lastpid = empty($arr) ? 0 : $arr['pid'];
return $lastpid;
}
// 更新最后的 uid
function well_thread_update_last($tid)
{
if (empty($tid)) return FALSE;
$lastpid = well_thread_find_lastpid($tid);
if (empty($lastpid)) return FALSE;
$lastpost = comment_read($lastpid);
if (empty($lastpost)) return FALSE;
$r = well_thread_update($tid, array('lastuid' => $lastpost['uid']));
return $r;
}
function well_thread_maxid()
{
$n = db_maxid('website_thread', 'tid');
return $n;
}
// 主题状态 0:通过 1~9 审核:1待审核 10~19:10退稿 11逻辑删除
function well_thread_format(&$thread)
{
global $gid, $uid, $forumlist;
$conf = _SERVER('conf');
if (empty($thread)) return;
$thread['create_date_fmt'] = humandate($thread['create_date']);
$thread['last_date_fmt'] = humandate($thread['last_date']);
$thread['create_date_fmt_ymd'] = date('Y-m-d', $thread['create_date']);
$thread['last_date_fmt_ymd'] = date('Y-m-d', $thread['last_date']);
$user = user_read_cache($thread['uid']);
$onlinelist = online_user_list_cache();
$user['online_status'] = isset($onlinelist[$user['uid']]) ? 1 : 0;
$thread['username'] = $user['username'];
$thread['user_avatar_url'] = array_value($user, 'avatar_url');
$thread['user'] = user_safe_info($user);
unset($user);
$forum = array_value($forumlist, $thread['fid']);
$thread['forum_name'] = array_value($forum, 'name');
$thread['forum_url'] = array_value($forum, 'url');
if ($thread['last_date'] == $thread['create_date']) {
$thread['last_date_fmt'] = '';
$thread['lastuid'] = 0;
$thread['lastusername'] = '';
} else {
$lastuser = $thread['lastuid'] ? user_read_cache($thread['lastuid']) : array();
$thread['lastusername'] = $thread['lastuid'] ? $lastuser['username'] : lang('guest');
$thread['lastuser'] = $thread['lastuid'] ? user_safe_info($lastuser) : array();
unset($lastuser);
}
$thread['url'] = url('read-' . $thread['tid'], '', FALSE);
if ($conf['url_rewrite_on'] > 1) {
!empty($forum['well_alias']) and $thread['url'] = url(urlencode($forum['well_alias'])."-$thread[create_date]a$thread[tid]", '', FALSE);
} else {
$thread['url'] = url("read-$thread[create_date]a$thread[tid]", '', FALSE);
}
$thread['user_url'] = url('user-' . $thread['uid']);
$thread['sticky_class'] = '';
if ($thread['sticky'] > 0) {
if (1 == $thread['sticky']) {
$thread['sticky_class'] = 'success';
} elseif (2 == $thread['sticky']) {
$thread['sticky_class'] = 'warning';
} elseif (3 == $thread['sticky']) {
$thread['sticky_class'] = 'danger';
}
}
$nopic = view_path() . 'img/nopic.png';
if ($thread['icon']) {
$attach_dir_save_rule = array_value($conf, 'attach_dir_save_rule', 'Ym');
$day = date($attach_dir_save_rule, $thread['icon']);
$thread_format_icon_default = 1;
if (1 == $thread_format_icon_default) {
// 本地文件绝对路径
$destfile = $conf['upload_path'] . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg';
// 本地
$thread['icon_fmt'] = is_file($destfile) ? file_path($thread['attach_on']) . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg' : $nopic;
if (1 == $conf['attach_on'] && 1 == $thread['attach_on']) {
// 云储存
$thread['icon_fmt'] = file_path($thread['attach_on']) . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg';
} elseif (2 == $conf['attach_on'] && 2 == $thread['attach_on']) {
// 图床 未上传成功 本地图片在的话使用本地,不在则默认
$thread['icon_fmt'] = $thread['image_url'] ? $thread['image_url'] : $thread['icon_fmt'];
}
}
} else {
$thread['icon_fmt'] = $nopic;
}
// 回复页面
$thread['pages'] = ceil($thread['posts'] / $conf['comment_pagesize']);
$thread['tag_fmt'] = $thread['tag'] ? xn_json_decode($thread['tag']) : '';
// 权限判断
$thread['allowupdate'] = ($uid == $thread['uid']) || forum_access_mod($thread['fid'], $gid, 'allowupdate');
$thread['allowdelete'] = (group_access($gid, 'allowuserdelete') and $uid == $thread['uid']) || forum_access_mod($thread['fid'], $gid, 'allowdelete');
$thread['allowtop'] = forum_access_mod($thread['fid'], $gid, 'allowtop');
$thread = well_thread_safe_info($thread);
}
function well_thread_format_last_date(&$thread)
{
if ($thread['last_date'] != $thread['create_date']) {
$thread['last_date_fmt'] = humandate($thread['last_date']);
} else {
$thread['create_date_fmt'] = humandate($thread['create_date']);
}
}
// 对 $threadlist 权限过滤
function well_thread_list_access_filter(&$threadlist, $gid)
{
global $forumlist;
if (empty($threadlist)) return NULL;
foreach ($threadlist as $tid => $thread) {
if (empty($forumlist[$thread['fid']]['accesson'])) continue;
if ($thread['sticky'] > 0) continue;
if (!forum_access_user($thread['fid'], $gid, 'allowread')) {
unset($threadlist[$tid]);
}
}
}
function well_thread_safe_info($thread)
{
unset($thread['userip'], $thread['user']['threads'], $thread['user']['posts'], $thread['user']['credits'], $thread['user']['golds'], $thread['user']['money']);
empty($thread['user']) || $thread['user'] = user_safe_info($thread['user']);
return $thread;
}
// 过滤安全数据
function well_thread_filter(&$val)
{
unset($val['userip'], $val['fid'], $val['flagid'], $val['type'], $val['user'], $val['create_date']);
}
//------------------------ 其他方法 ------------------------
// 集合主题tid,统一拉取,避免多次查询thread表
function thread_unified_pull($arr)
{
global $gid, $fid;
$stickylist = array_value($arr, 'stickylist', array());
$tidlist = array_value($arr, 'tidlist', array());
//$fid = array_value($arr, 'fid');
// 合并过滤空数组
//$tidlist = array_filter($stickylist + $tidlist);
$tidarrlist = $tidlist = $stickylist + $tidlist;
// 版块自定义
list($flaglist, $flagtids) = flag_thread_by_fid($fid);
empty($flagtids) || $tidarrlist += $flagtids;
unset($flagtids);
// 在这之前合并所有二维数组 tid值为键/array('tid值' => tid值)
$tidarr = empty($tidarrlist) ? array() : arrlist_values($tidarrlist, 'tid');
// 在这之前使用array_merge()前合并所有一维数组 tid/array(1,2,3)
if (empty($tidarr)) return NULL;
$tidarr = array_unique($tidarr);
// 主题相关统一遍历后再归类
$arrlist = well_thread_find($tidarr, count($tidarr));
// 过滤没有权限访问的主题 / filter no permission thread
well_thread_list_access_filter($arrlist, $gid);
$threadlist = array();
foreach ($arrlist as $_tid => &$_thread) {
$_thread = well_thread_safe_info($_thread);
// 归类列表数据
isset($tidlist[$_thread['tid']]) and $threadlist[$_tid] = $_thread;
// flag thread
if (!empty($flaglist)) {
foreach ($flaglist as $key => $val) {
if (isset($val['tids']) && in_array($_thread['tid'], $val['tids'])) {
$flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
ksort($flaglist[$key]['list']);
}
}
}
}
// 按之前tidlist排序
$threadlist = array2_sort_key($threadlist, $tidlist, 'tid');
unset($arrlist, $tidlist);
$arr = array('threadlist' => $threadlist, 'flaglist' => $flaglist);
return $arr;
}
// read.php 详情页其他主题调用,集合tid统一拉取数据,最后归类
function thread_other_pull($thread)
{
global $forumlist, $gid;
$fid = array_value($thread, 'fid');
$forum = array_value($forumlist, $fid);
if (empty($forum)) return NULL;
//$tid = array_value($thread, 'tid');
//$tag_fmt = array_value($thread, 'tag_fmt');
$arrlist = array();
$tidlist = array();
// 版块自定义
list($flaglist, $flagtids) = flag_thread_by_fid($fid);
empty($flagtids) || $tidlist += $flagtids;
unset($flagtids);
// 在这之前合并所有二维数组 tid值为键/array('tid值' => tid值)
$tidarr = empty($tidlist) ? array() : arrlist_values($tidlist, 'tid');
// 在这之前使用array_merge()前合并所有一维数组 tid/array(1,2,3)
if (empty($tidarr)) return NULL;
$tidarr = array_unique($tidarr);
// 主题相关统一遍历后再归类
$threadlist = well_thread_find($tidarr, count($tidarr));
// 过滤没有权限访问的主题 / filter no permission thread
well_thread_list_access_filter($threadlist, $gid);
foreach ($threadlist as &$_thread) {
$_thread = well_thread_safe_info($_thread);
// flag thread
if (!empty($flaglist)) {
foreach ($flaglist as $key => $val) {
if (isset($val['tids']) && in_array($_thread['tid'], $val['tids'])) {
$flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
ksort($flaglist[$key]['list']);
}
}
}
}
unset($threadlist);
if (!empty($flaglist)) {
foreach ($flaglist as &$val) {
$i = 0;
if (!isset($val['list'])) continue;
foreach ($val['list'] as &$v) {
++$i;
$v['i'] = $i;
}
}
$arrlist['flaglist'] = $flaglist;
unset($flaglist);
}
return $arrlist;
}
//--------------------------cache--------------------------
// 已格式化 从缓存中读取,避免重复从数据库取数据
function well_thread_read_cache($tid)
{
global $conf;
$key = 'website_thread_' . $tid;
static $cache = array(); // 用静态变量只能在当前 request 生命周期缓存,跨进程需要再加一层缓存:redis/memcached/xcache/apc
if (isset($cache[$key])) return $cache[$key];
if ('mysql' == $conf['cache']['type']) {
$r = well_thread_read($tid);
} else {
$r = cache_get($key);
if (NULL === $r) {
$r = well_thread_read($tid);
$r and cache_set($key, $r, 1800);
}
}
$cache[$key] = $r ? $r : NULL;
return $cache[$key];
}
?>
windos10+ubuntu16.4安装历程(超级详细,解决识别不出未分配空间等问题)编程频道|福州电脑网
windos10+ubuntu16.4安装历程(超级详细,解决识别不出未分配空间等问题)
编程之家900
更新时间:2026-04-10 02:38:11
Windows10安装ubuntu16.04全过程(很详细)
#1 电脑详细情况
UEFI新式bios+单硬盘(固态)
怎么看自己电脑是MBR还是UEFI:win+r输入msinfo32回车确认,出现以下信息
#2 准备材料
安装ubuntu 首先需要准备以下工具以及安装包:
- ubuntu 系统安装镜像(中科大源
http://mirrors.ustc.edu/ubuntu-releases/16.04/
阿里云开源镜像站
http://mirrors.aliyun/ubuntu-releases/16.04/
兰州大学开源镜像站
http://mirror.lzu.edu/ubuntu-releases/16.04/
北京理工大学开源
http://mirror.bit.edu/ubuntu-releases/16.04/
-
刻录软件,推荐软碟通,会提示注册,选择继续试用就好
-
一个大于 2G 的 U 盘
步骤一:在 WIN10系统下创建空白磁盘分区
- 回到桌面,鼠标右键点击此电脑,选择管理,结果如下:
- 进入然后选择磁盘管理,结果如下:
- 选择最后一个磁盘空间的磁盘,比如 CD两个盘的最后一个盘是D盘(CDE盘的最后一个E盘,CDEF盘的最后一个盘F盘,以此类推),右键点击该磁盘,选择压缩卷,如下:最后出现的是黑颜色的未分配空间(有的教程有绿色,不必介意,黑色的也对呢)
如果大小不够就腾一腾空间,保证能分出30~50G的空余空间吧,如果你磁盘空间足够,强烈建议多分一点,比如60、80、100G或者120G,百利无一害。
好了,磁盘分区到此结束,现在进行第二步;
步骤二:用软碟通将ubuntu的镜像写入 U 盘
-
安装并打开软碟通,插上 U 盘,并且最好备份你的 U 盘,因为之后需要格式化
-
进入软碟通,进行如下操作 选择文件,并且打开你下载的 ubuntu 所在的目录,选择 unbuntu 镜像(改成选择自己的ubuntu镜像即可),双击打开,如图:
-
在软碟通界面菜单栏选择启动,选择写入硬盘映像,如图所示
接下来很重要,记住次序:
进入以后界面如下:
1) 看你的硬盘驱动器是否对应的是你的 U 盘(必须是) ,一般默认是
2) 看映像文件是否对应你的 ubuntu 镜像
3) 如果上述均没有错误,选择格式化,之后就会格式化你的 U 盘
4) 在 U 盘格式化完毕之后,选择写入,之后就是慢慢等待了,等待写入完毕
5) 步骤二完毕。
步骤三:U 盘安装系统
写在前面,因为个厂商的计算机 BOOT 启动的快捷键不相同,所以 个人觉得要是你无法进入接下来的 BOOT 界面,还是自行百度如何 进入 BOOT 界面,也就是进bios,如果这你都不知道,你还是放弃多学学再装,以免翻车。 第 6 步非常关键,如果你不想重装系统,一定要小心。
-
重启系统,在开机进bios,在boot manager里关secure boot,(有些secure boot在另外的位置,自己找找)然后第一启动选择 USB,回车确认
-
SATA comtroller mode option(将电脑BIOS硬盘模式修改为ahci模式)这点很重要,安装时候ubuntu识别不出未分配空间就是因为这个。
-
之后就进入 unbuntu 的安装界面了这个界面可能不太一样,直接选择安装ubuntu就对啦。
-
然后左侧选择语言,右侧选择install ubuntu!
-
接下来不要选择联网,因为联网会安装的很慢。
-
选择继续,然后注意这一步很关键,一定要选择其他选项,切记,因为我们要手动分区,然后进入如下界面。这里说明一点,有人试过选择第一个选项,系统会自动找到你的空白分区进行安装,并且成功过,我不否认这样的装法,但是这样装完之后,磁盘基本上都会分给根目录,拿windows打比方,相当于你只有C盘,之后你的任何文件都只能存放在这个盘(不是说没有别的盘,而是别的盘空间太小。。。),试想你的文件存放在了系统盘,这会多么危险,所以既然你看到了这篇教程,强烈建议按照我的步骤来进行手动分区。看到没有,里面会有一个空闲分区,也就是我们之前所创建的那个分区
在这里,我们谈谈关于 Linux的分区:
a.首先 Linux 分区和 windows分区是不一样的, Linux 是以文件形式作为分区
b.所以分区就像划分磁盘大小一样,在这假如你划分的空盘分区为 80G,则我们可以将其分为 :
点空闲盘符,点击+进行分区,分区如下
1) efi:这个就是实现你双系统的原因了,这个就是用启动 ubuntu 的目录,里面会有系统的引导,这个文件其实只有几十兆,但是我们建议将其划分为 200M 文件格式为efi,这个分区必不可少,否则后果你懂得!
(这也就是MBR和UEFI的区别!!!!不用/boot,看不懂请忽略这句话)
2) swap:这个是 Linux 也就是 ubuntu 的交换区目录,这个一般的大小为内存的 2 倍左右,主要是用来在电脑内存不足的情况下,系统会调用这片区域,来运行程序,我们可以将其分为 8G, 文件格式选择交换空间,英文swap
- /:这是 linux 也就是 ubuntu 的根目录就一个反斜杠表示,相当于windows的C盘,我们将其分为 20G,文件格式为 ext4(根据你的磁盘空间调整,可以大一点,毕竟ubuntu装软件都是默认装在根目录的)
4) /home:这是 ubuntu的其他盘,相当于windows的其他盘,所以为了让我们自己的目录大一点,剩下的全分给它,文件格式为 ext4
好了,这部分分区讲述完毕,你完全可以按照上面的描述进行分区,不会有任何问题,起码我一直都是这么做的(强烈建议)。当然,你可以划分的更详细,具体划分可以百度。
下来的这一步很重要,切记(关系到 ubuntu 的开机启动)在这个界面下方,选择安装启动下拉菜单,我们刚刚不是创建了200M的efi的文件吗,现在你看看这个区前面的编号是多少,我的是/dev/sda1,不同的机子在这个上面会有不同的编号,也就是选efi对应的编号(这里一定要注意,windows的启动项也是efi文件,大小大概是500M,而我们创建的ubuntu的efi大小是200M,一定要选对(下图中大小不准)!
然后在安装启动的下拉菜单中找到 对应编号(例如sda1,可能是sda2,3等,具体看自己电脑efi对应的),选择它,切记一定是efi的编号如下图:
7. 选择继续,进入下一步操作,设置地区不重要,按你需要设置,也可以直接继续,不影响,在下一步操作中选择键盘布局
接下来的步骤我相信你肯定就没有问题了,本次文章也是在 https://wwwblogs/masbay/p/10745170.html基础上增加了我安装时候的一些经验而来。希望对大家有所帮助。卡萨米达!!!
本文发布于:2024-10-17,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不出历程分配详细空间
发布评论