组保留的标签 余下为需要删除的标签
unset($oldtag[$key]);
}
}
}
if (!empty($oldtag)) {
$tagids = array();
foreach ($oldtag as $tagid => $tagname) {
$tagids[] = $tagid;
}
well_oldtag_delete($tagids, $tid);
}
$r = well_tag_process($tid, $fid, $create_tag, $tagarr);
return $r;
}
// 删除标签和绑定的主题
function well_oldtag_delete($tagids, $tid)
{
$pagesize = count($tagids);
$arrlist = well_tag_find_by_tagids($tagids, 1, $pagesize);
$delete_tagids = array(); // 删除
$tagids = array();
$n = 0;
foreach ($arrlist as $val) {
++$n;
if (1 == $val['count']) {
// 只有一个主题
$delete_tagids[] = $val['tagid'];
} else {
$tagids[] = $val['tagid'];
}
}
!empty($delete_tagids) and well_tag_delete($delete_tagids);
$arlist = well_tag_thread_find_by_tid($tid, 1, $n);
if ($arlist) {
$ids = array();
foreach ($arlist as $val) $ids[] = $val['id'];
well_tag_thread_delete($ids);
}
!empty($tagids) and well_tag_update($tagids, array('count-' => 1));
}
// 标签数据处理 $arr=新提交的数组 $tagarr=保留的旧标签
function well_tag_process($tid, $fid, $new_tags = array(), $tagarr = array())
{
if (empty($tid)) return '';
// 新标签处理入库
if ($new_tags) {
$threadarr = array();
$tagids = array();
$i = 0;
$size = 5;
$n = count($tagarr);
$n = $n > $size ? $size : $size - $n;
foreach ($new_tags as $name) {
++$i;
$name = trim($name);
$name = stripslashes($name);
$name = strip_tags($name);
$name = str_replace(array(' ', '#', "@", "$", "%", "^", '&', '·', '<', '>', ';', '`', '~', '!', '¥', '……', ';', '?', '?', '-', '—', '_', '=', '+', '.', '{', '}', '|', ':', ':', '、', '/', '。', '[', ']', '【', '】', '‘', ' ', ' ', ' ', ' ', ' '), '', $name);
$name = htmlspecialchars($name, ENT_QUOTES);
if ($name && $i <= $n) {
// 查询标签
$read = well_tag_read_name($name);
if ($read) {
// 存在 count+1
$tagids[] = $read['tagid'];
} else {
// 入库
$arr = array('name' => $name, 'count' => 1);
$tagid = well_tag_create($arr);
FALSE === $tagid and message(-1, lang('create_failed'));
$read = array('tagid' => $tagid, 'name' => $name);
}
$tag_thread = array('tagid' => $read['tagid'], 'tid' => $tid);
$threadarr[] = $tag_thread;
$tagarr[$read['tagid']] = $read['name'];
}
}
!empty($threadarr) and tag_thread_big_insert($threadarr);
!empty($tagids) and well_tag_update($tagids, array('count+' => 1));
}
$json = empty($tagarr) ? '' : xn_json_encode($tagarr);
return $json;
}
?>
如何清理 Windows 更新缓存?-阿南达文事网
如何清理 Windows 更新缓存?
编程日记20
更新时间:2025-05-26 09:12:31 如何清理 Windows 更新缓存?
方法一:通过命令提示符清理更新缓存
- 步骤:
- 打开“命令提示符”(管理员权限):
- 按下
Win + X
键,选择“Windows终端(管理员)”或“命令提示符(管理员)”。
- 输入以下命令以停止相关服务:net stop wuauserv net stop bits net stop appidsvc net stop cryptsvc
- 导航到以下文件夹并重命名相关文件夹以清除缓存:ren C:\Windows\SoftwareDistribution SoftwareDistribution_old ren C:\Windows\System32\catroot2 catroot2_old
- 输入以下命令以重新启动服务:net start wuauserv net start bits net start appidsvc net start cryptsvc
- 重启计算机后再次尝试检查和安装更新。
方法二:手动删除更新缓存文件
- 步骤:
- 打开文件资源管理器,导航到以下路径:C:\Windows\SoftwareDistribution C:\Windows\System32\catroot2
- 删除这两个文件夹中的所有内容(如果无法删除,请先停止相关服务,参考方法一中的命令)。
- 重启计算机后,系统会自动重新创建这些文件夹。
方法三:使用第三方工具清理更新缓存
- 推荐工具:
- CCleaner:
- Windiff:
- 步骤:
- 下载并安装上述工具之一。
- 打开工具并导航到清理选项。
- 选择“Windows更新缓存”并执行清理操作。
方法四:通过 PowerShell 清理更新缓存
- 步骤:
- 打开“PowerShell”(管理员权限):
- 按下
Win + X
键,选择“Windows PowerShell(管理员)”。
- 输入以下命令以停止相关服务:
Stop-Service wuauserv, bits, appidsvc, cryptsvc
- 删除缓存文件夹:
Remove-Item -Path C:\Windows\SoftwareDistribution -Recurse -Force Remove-Item -Path C:\Windows\System32\catroot2 -Recurse -Force
- 重新启动服务:
Start-Service wuauserv, bits, appidsvc, cryptsvc
本文发布于:2025-05-26,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何清理 Windows 更新缓存
发布评论