Subversion Repositories qbpwcf-lib(archive)

Rev

Rev 850 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2014~2025 Min-Jhin,Chen

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/

#使用命名空間qbpwcf
namespace qbpwcf;

#assets dir
$assetsDir="assets_of_phpLib::updateCopyRightYear_20250213";

#函式說明:
#使用 linux 的 uuid 指令來產生 uuid 字串
#回傳結果:
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
#$result["error"],錯誤訊息.
#$result["function"],當前執行的函式名稱.
#$result["content"],uuid.
#必填參數:
#無.
#可省略參數:
#無.
#參考資料:
#無.
#備註:
#無.
$uuid=cmd::uuid();

#如果執行失敗
if($uuid["status"]==="false"){

        #debug
        var_dump($uuid);
        
        #結束執行回傳代碼1給shell
        exit(1);

        }#if end

#函式說明:
#更新程式檔案開頭版權宣告的年份
#回傳結果:
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
#$reuslt["error"],執行不正常結束的錯訊息陣列.
#$result["function"],當前執行的函式名稱.
#$result["content"],有更新的檔案清單,其元素有被取代的檔案路徑與名稱跟replacedInfo,其中replacedInfo為陣列,其key為要變動的行號(從0開始算),其數值有"from"代表要被取代的原始內容,"to"代表要置換成的新內容.
#$result["scannedFile"],陣列,有檢查過的檔案清單其完整路徑與檔案名稱.
#必填參數:
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
$conf["fileArgu"]=__FILE__;
#可省略參數:
#$conf["replaceFrom"],陣列,目標關鍵字,每個元素代表一行的內容,預設內容可參照本檔案開頭的版權宣告文字.
#$conf["replaceFrom"]=array();
#$conf["yearFrom],字串,起始年份,預設為西元"2014"年.
#$conf["yearFrom"]="2014";
#$conf["yearTo],字串,結束年份,預設為西元"gmdate('Y')"年.
#$conf["yearTo"]=gmdate('Y');
#$conf["Authors"],陣列,該套件的參與者,預設為array("Min-Jhin,Chen");
#$conf["Authors"]=array("Min-Jhin,Chen");
#$conf["searchPath"],陣列,要搜尋哪些地方的檔案要更新版權宣告年份,預設為使用中的本套件位置.
#$conf["searchPath"]=array("");
#$conf["skipHiddenFolder"],字串,要略過隱藏的資料夾,預設為"true";反之為"false";
#$conf["skipHiddenFolder"]="true";
#$conf["includeHiddenFolder"],陣列,符合名稱的隱藏資料夾會存取,預設不指定;
#$conf["includeHiddenFolder"]=array("");
#$conf["excludeDirName"],陣列,哪些目錄名稱要忽略,預設有"free-lib"、"no-free-lib"、"composer".
#$conf["excludeDirName"]=array("free-lib","no-free-lib","composer");
#$conf["excludeMineType"],陣列,哪些檔案類型要忽略,預設有"image/*"、"video/*"、"audio/*"、"media/*"、"application/*".
#$conf["excludeMineType"]=array("image/*","video/*","audio/*","media/*","application/*");
#$conf["excludeSecondName"],陣列,哪些附檔名的檔案要忽略,預設有"log"、"csv"、"sql"、"js"、"css"、"html".
#$conf["excludeSecondName"]=array("log"、,"csv","sql","js","css","html");
#$conf["multiThread"],字串,是否要啟用多執行序,預設為"false",反之為"true".
$conf["multiThread"]="true";
#$conf["threadType"],字串,當"multiThread"參數為"true"時,要使用的threas類型,預設為"socket",其他可能有"proc".
#$conf["threadType"]="socket";
#$conf["socket"],字串,unix domain socket 的位置與名稱,預設為 qbpwcf_usock_path;
$conf["socket"]="assets of sock::unixDomainSockServer_20250228/unixDomainSockServer.sock";
#$conf["log"],字串,log的檔案位置與名稱,預設不使用.
$conf["log"]="/tmp/phpLib::updateCopyRightYear:20250213-".$uuid["content"].".log";
#參考資料:
#無.
#備註:
#無.
$updateCopyRightYear=phpLib::updateCopyRightYear($conf);
unset($conf);

#debug
var_dump($updateCopyRightYear);