15m44v 续: gh_api.php 加库文件自失效(opcache_invalidate __FILE__)

This commit is contained in:
ypsdf1
2026-11-25 16:01:28 +08:00
parent 083f760207
commit 9b081a6853
+7
View File
@@ -19,6 +19,13 @@ if (!defined('GH_TICKET_PREFIX')) {
define('GH_TICKET_PREFIX', '[工单#'); // 后接 id + "] " define('GH_TICKET_PREFIX', '[工单#'); // 后接 id + "] "
} }
// ★ 15m44v: 库文件自失效 —— 每次被 require 时 invalidate 自身 OPcache 副本。
// 部署 gh_api.php 后,只要任一入口(ticket.php/gh_oauth.php)再 require 一次,
// 就强制重读磁盘新版,避免旧版常驻 OPcache 导致新逻辑(占位符替换/ghLog 路径/
// Cache-Control 头)不生效。入口顶部已有 opcache_invalidate(__FILE__),但库文件
// 需自失效自身路径,双保险。
if (function_exists('opcache_invalidate')) { @opcache_invalidate(__FILE__, true); }
/** 取 img.json 的 GitHub 配置(懒重载) */ /** 取 img.json 的 GitHub 配置(懒重载) */
function ghGetCfg() { function ghGetCfg() {
return loadImgJson(); return loadImgJson();