當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Git::windows_mode方法代碼示例

本文整理匯總了PHP中Git::windows_mode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Git::windows_mode方法的具體用法?PHP Git::windows_mode怎麽用?PHP Git::windows_mode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Git的用法示例。


在下文中一共展示了Git::windows_mode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initRepo

 private function initRepo()
 {
     if (!class_exists("Git")) {
         require 'Git.php/Git.php';
     }
     $this->pullOnChange = c::get('gcapc-pull', false);
     $this->pushOnChange = c::get('gcapc-push', false);
     $this->commitOnChange = c::get('gcapc-commit', false);
     $this->gitBin = c::get('gcapc-gitBin', '');
     $this->windowsMode = c::get('gcapc-windowsMode', false);
     if ($this->windowsMode) {
         Git::windows_mode();
     }
     if ($this->gitBin) {
         Git::set_bin($this->gitBin);
     }
     $this->repo = Git::open($this->repoPath);
     if (!$this->repo->test_git()) {
         trigger_error('git could not be found or is not working properly. ' . Git::get_bin());
     }
 }
開發者ID:blankogmbh,項目名稱:kirby-git-commit-and-push-content,代碼行數:21,代碼來源:helpers.php

示例2: gitpush

function gitpush($strRepo)
{
    global $repo_dir, $eqdkp_dir, $git_path, $isWindows;
    try {
        if ($isWindows) {
            Git::windows_mode();
        }
        Git::set_bin($git_path);
        $repoPath = $strRepo == 'local_core' ? $eqdkp_dir : $repo_dir . $strRepo;
        $repo = Git::open($repoPath);
        notify($repo->status(true), 'Git Status before push');
        $repo->push('origin', 'master');
        notify($repo->status(true), 'Git Status after push');
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
開發者ID:ZerGabriel,項目名稱:misc-repohelper,代碼行數:17,代碼來源:index.php

示例3: substr

         echo "<div id=\"checkwithfailed\">\r\n                                            <span id=\"titleresult\">評估結果:</span>\r\n                                            <span id=\"resultsentence\">沒有通過評估</span>\r\n                                        </div>\r\n                                        <div id=\"declare\">\r\n                                            <p>原因: 您的許可證文件已經被檢測到, 但是內容並沒有完全匹配到由OSI批準的";
         echo substr($keyFiles[$minKey], 0, strrpos($keyFiles[$minKey], "."));
         echo "許可證文件內容, 詳細文本之間的差別請看下麵:</p>\r\n                                <p><span style=\"background-color:#005500\">&nbsp;&nbsp;&nbsp;&nbsp;</span>代表比標準文本增加的部分</p><p><span style=\"background-color:#990000\">&nbsp;&nbsp;&nbsp;&nbsp;</span>代表比標準文本減少的部分</span></p>\r\n                                        </div>\r\n                                        <div id=\"originaldiv\">\r\n                                            <div>您的許可證比較結果</div>\r\n                                            <div id=\"originalcontent\"><pre>";
         echo $comparedStandardLicenseFileContent;
         echo "</pre></div>\r\n                                        </div>\r\n                                        <div id=\"standarddiv\">\r\n                                        <div>";
         echo substr($keyFiles[$minKey], 0, strrpos($keyFiles[$minKey], "."));
         echo "</div>\r\n                                            <div id=\"standardcontent\"><pre>";
         echo htmlspecialchars($licensecollection[$keyFiles[$minKey]]);
         echo "</pre></div>\r\n                                <div class=\"contact-us\">如果對檢測結果有任何意見和反饋, 您可以<a href=\"http://www.kaiyuanshe.cn/feedback.php\">聯係我們</a></div>\r\n                                <div class=\"page-jump\">\r\n                                    <input type=\"button\" value=\"完成\" class=\"resolver-next\" data-redirect=\"/index.php\">\r\n                                </div>\r\n                                        </div>\r\n                                        </div>";
         RemoveStatusRecords($sessionId, $conn, $logger, $loghelperArr);
     }
 } else {
     $logger->log('debug', 'License file not found', $loghelperArr);
     InsertStatusRecords($sessionId, "快速檢測未找到許可文件,正在克隆代碼倉庫副本以便進一步檢測", $conn, $logger, $loghelperArr);
     // Git clone the repository based on git URL
     Git::windows_mode();
     $repo = new GitRepo();
     // Get git client folder name
     $comresult = stripos($urlText, '.git');
     if ($comresult !== FALSE) {
         $indexOfLastSplash = strrpos($urlText, "/");
         $indexOfLastDot = strrpos($urlText, '.');
         $GitName = substr($urlText, $indexOfLastSplash + 1, $indexOfLastDot - $indexOfLastSplash - 1);
     } else {
         $indexOfLastSplash = strrpos($urlText, '/');
         $GitName = substr($urlText, $indexOfLastSplash + 1);
     }
     $logger->log('debug', 'GitName: ' . $GitName, $loghelperArr);
     $ran = rand();
     $timeparts = explode(' ', microtime());
     $etime = $timeparts[1] . substr($timeparts[0], 1);
開發者ID:cloudtrends,項目名稱:kaiyuanzhixing,代碼行數:31,代碼來源:processresult.php

示例4: get_update

function get_update($sname, $file_lock, $base_url, $path, $mail_lock, $remote_git = '', $remote_branch = '')
{
    session_name($sname);
    session_start();
    set_time_limit(300);
    ignore_user_abort(true);
    $stime = time();
    $work = false;
    //檢測、設置工作標誌,存在session裏(同一個session_name在一個頁麵未結束前會保持讀寫鎖狀態)
    if (empty($_SESSION['working'])) {
        $work = true;
    }
    if (file_exists($file_lock)) {
        $last_work_time = filemtime($file_lock);
        if ($last_work_time > 0 && time() - $last_work_time < 120) {
            //上次更新至今有120秒
            echo "檢測到正在進行工作中,本頁麵停止載入,請稍後再次訪問。";
            return false;
            //exit;
        }
        $work = true;
        unlink($file_lock);
    } elseif (empty($_SESSION['work_time']) || $stime - $_SESSION['work_time'] > LOCK_TIME) {
        //保證 LOCK_TIME 秒內隻訪問一次
        $work = true;
    }
    if ($work && !file_exists($file_lock)) {
        $_SESSION['working'] = true;
        $_SESSION['work_time'] = $stime;
        file_put_contents($file_lock, $stime);
    } else {
        echo "距離上次獲取請求時間間隔多短,請稍後再次訪問。";
        return false;
        //exit;
    }
    echo date("Y-m-d H:i:s") . " 讀取列表中...<br>";
    $list = get_list($base_url);
    //獲取列表
    if (count($list) < 2) {
        echo "讀取Wiki列表失敗,等待下次檢測。<br>";
        $_SESSION['work_time'] = $stime - LOCK_TIME;
        //取消檢查時間,讓檢測可在稍後再次發起
        unlink($file_lock);
        return false;
    }
    session_write_close();
    //解除session,防止使其他訪問頁麵一直等待session
    mk_dir($path);
    if (IS_WIN) {
        Git::windows_mode();
    }
    if (!file_exists($path . '.git')) {
        echo date("Y-m-d H:i:s") . " 沒有git庫,嘗試創建...<br>";
        if ($remote_git) {
            //是否設置了遠程倉庫
            echo "嘗試從遠程倉庫克隆數據...<br>";
            $ret = Git::clone_remote($path, $remote_git, $remote_branch);
            //從遠程倉庫clone(可指定分支)
            if (!Git::is_repo($ret) || !file_exists($path . '.git') || !$ret) {
                echo "從遠程倉庫克隆失敗,本地創建...<br>";
                $ret = Git::create($path);
                //如果clone失敗,則本地創建
            }
        } else {
            $ret = Git::create($path);
        }
        //直接本地創建
        echo date("Y-m-d H:i:s") . " 創建結果:" . (Git::is_repo($ret) ? '成功' : '失敗') . "<br>";
    }
    $files = ls_file($path);
    foreach ($files as $file) {
        if (!is_dir($path . $file)) {
            unlink($path . $file);
        }
    }
    $tmp_arr = parse_url($base_url);
    $url_base = $tmp_arr['scheme'] . '://' . $tmp_arr['host'];
    write($path . 'list.txt', json($list));
    //寫出列表
    echo date("Y-m-d H:i:s") . " 讀取wiki列表完畢,開始讀取內容頁...<br>";
    $count = 0;
    $content = get_content($base_url);
    write($path . 'index.html', $content);
    $count++;
    foreach ($list as $arr) {
        if (isset($arr['ul'])) {
            foreach ($arr['ul'] as $a) {
                if (substr($a['url'], 0, 1) == '.' || substr($a['url'], 0, 1) == '/') {
                    //地址以.或/開頭,則為wiki文檔
                    $content = get_content((substr($a['url'], 0, 1) == '/' ? $url_base : (substr($a['url'], 0, 1) == '.' ? $url_base . $tmp_arr['path'] : '')) . $a['url']);
                    if ($content) {
                        write($path . $a['title'] . '.html', $content);
                        $count++;
                    }
                }
            }
        }
    }
    echo date("Y-m-d H:i:s") . " 獲取操作完成,讀取頁麵數量:" . $count . "<br>";
    $repo = Git::open($path);
//.........這裏部分代碼省略.........
開發者ID:l1291434519,項目名稱:MpWiki_check,代碼行數:101,代碼來源:Base.php


注:本文中的Git::windows_mode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。