linfeng@zhonghui vor 2 Monaten
Ursprung
Commit
2114c0fd13

+ 4 - 4
buildPatch.php

@@ -4,15 +4,15 @@ date_default_timezone_set('PRC');
 
 require_once __DIR__.'/Patch.php';
 
-$codeDir = __DIR__.'/patch/repair_light_db_gid';
+$codeDir = __DIR__.'/patch/replace_ntp_internet_check';
 
 $code = file_get_contents($codeDir . '/code.php');
 $code = str_replace('<?php', '', $code);
 
-$name = '修复分库gid为0的情况';
-$desc = '主要用于修复群组与设备处于关联的情况,但分库里面的gid为0,会导致灯上报状态时无法找寻关联的群组,从而导致群组亮度无法与灯保持一致的问题';
+$name = '去掉ntp外网检测';
+$desc = '';
 // 适用于此版本及以下版本使用
-$ver = '999';
+$ver = '0';
 // 补丁key
 $key = 'smartLEDZ';
 

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
patch/auto_clean_assect/2025-02-19v0_17399287517768.b


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
patch/auto_clean_assect/2025-02-19v999_17399287462292.b


+ 17 - 0
patch/auto_clean_assect/code.php

@@ -0,0 +1,17 @@
+<?php
+
+// echo '0 * * * * echo "" > /var/log/nginx/access.log' >> /etc/crontabs/root
+
+// grep -qxF "* * * * * echo \"\" > /var/log/nginx/access.log" /etc/crontabs/root || echo "* * * * * echo \"\" > /var/log/nginx/access.log" >> /etc/crontabs/root
+
+// grep -qxF '0 * * * * echo "" > /var/log/nginx/access.log' /etc/crontabs/root || echo '0 * * * * echo "" > /var/log/nginx/access.log' >> /etc/crontabs/root
+
+$command = "0 * * * * echo \\\"\\\" > /var/log/nginx/access.log";
+$output = "grep -qxF \"$command\" /etc/crontabs/root || echo \"$command\" >> /etc/crontabs/root";
+exec($output)."\n";
+
+$command = "30 0 * * * /etc/init.d/php7-fpm restart";
+$output = "grep -qxF \"$command\" /etc/crontabs/root || echo \"$command\" >> /etc/crontabs/root";
+
+exec($output)."\n";
+exec("/etc/init.d/cron restart");

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
patch/replace_max_children/2025-02-24v0_17403760625607.b


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
patch/replace_max_children/2025-02-24v999_17403760679392.b


+ 44 - 0
patch/replace_max_children/code.php

@@ -0,0 +1,44 @@
+<?php
+
+$filepath = "/etc/php7-fpm.d/www.conf";
+$data = file_get_contents($filepath);
+
+// +------------------------------
+// | 替换配置
+// +------------------------------
+
+// pm.max_children = 12 改为 pm.max_children=4
+if(preg_match("/pm\.max_children[ ]*=[ ]*(\d+)/", $data, $matches) && count($matches) == 2) {
+    $oldStr = $matches[0];
+    $value = $matches[1];
+    $newStr = str_replace($value, "4", $oldStr);
+    $data = str_replace($oldStr, $newStr, $data);
+}
+
+// pm = dynamic 改为 pm = static
+if(preg_match("/pm[ ]*=[ ]*(\w+)/", $data, $matches) && count($matches) == 2) {
+    $oldStr = $matches[0];
+    $value = $matches[1];
+    $newStr = str_replace($value, "static", $oldStr);
+    $data = str_replace($oldStr, $newStr, $data);
+}
+
+// +------------------------------
+// | 写入并重启php-fpm
+// +------------------------------
+file_put_contents($filepath, $data);
+exec("/etc/init.d/php7-fpm restart");
+
+
+// +------------------------------
+// | 1小时清除1次accress.log
+// +------------------------------
+$command = "0 * * * * echo \\\"\\\" > /var/log/nginx/access.log";
+$output = "grep -qxF \"$command\" /etc/crontabs/root || echo \"$command\" >> /etc/crontabs/root";
+exec($output)."\n";
+
+// 重启定时任务
+exec("/etc/init.d/cron restart");
+
+exec("rm -rf /etc/overlayfsconfig.tar.gz");
+exec("rm -rf /etc/config.tar.gz");

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
patch/replace_ntp_internet_check/2025-03-07v0_17413162106682.b


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
patch/replace_ntp_internet_check/2025-03-07v999_17413162069133.b


+ 52 - 0
patch/replace_ntp_internet_check/code.php

@@ -0,0 +1,52 @@
+<?php
+
+$lowerDir = realpath(__DIR__."/../../smartLEDZ"); // read层·原始文件
+
+// +---------------
+// | Set.php
+// +---------------
+$filename = $lowerDir."/application/controllers/Set.php";
+$data = file_get_contents($filename);
+$isModify = false;
+
+preg_match("/.+http:\/\/www\.baidu\.com.+/", $data, $match);
+if(count($match) == 1 && $match[0] != ""){
+    $isModify = true;
+    $data = str_replace($match[0], "", $data);
+}
+
+preg_match("/.+未能成功联网,请检查您的网线和配置.+/", $data, $match);
+if(count($match) == 1 && $match[0] != "") {
+    $isModify = true;
+    $data = str_replace($match[0], "", $data);
+}
+
+if($isModify == true){
+    file_put_contents($filename, $data);
+}
+
+// +---------------
+// | Events.php
+// +---------------
+$filename = $lowerDir."/workerman/Events.php";
+$data = file_get_contents($filename);
+$isModify = false;
+
+preg_match("/.+http:\/\/www\.baidu\.com.+/", $data, $match);
+if(count($match) == 1 && $match[0] != ""){
+    $isModify = true;
+    $data = str_replace($match[0], "//".trim($match[0], "/"), $data);
+}
+
+preg_match("/if\((!\\\$check)\)\{/", $data, $match);
+if(count($match) == 2 && $match[1] != ""){
+    $isModify = true;
+    $data = str_replace($match[1], "false", $data);
+}
+
+if($isModify == true){
+    file_put_contents($filename, $data);
+}
+
+// 重启Events
+exec("php-cli $lowerDir/workerman/Server.php  restart -d");

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.