|
@@ -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");
|