$checkoutresult = SvnPeer::runCmd($command);
 } catch (Exception $e) {
     $logger->log('error', 'SVN command "svn co ... target --depth empty" got exception: ' . $e->getMessage(), $loghelperArr);
     chdir("..");
     deldir($foldername);
     echo "\r\n                                <div class=\"article-block\" id=\"checkwithfailed\">\r\n                                    <span id=\"titleresult\">评估结果:</span>\r\n                                    <span id=\"resultsentence\">没有发现许可证文件</span>\r\n                                </div>\r\n                                <div class=\"article-block\" id=\"declare\">\r\n                                    <p>原因: 在您提供的代码仓库地址中没有发现许可证文件: </p>\r\n                                    <p id=\"sourlink\">\r\n                                            <a href=\"";
     echo $urlText;
     echo "\">";
     echo $urlText;
     echo "</a>\r\n                                        </p>\r\n                                </div>\r\n                                \r\n                                <div class=\"article-block\" id=\"moreinfo\">\r\n                                    <span>请参考下面的链接:</span><br>\r\n                                    <a href=\"http://www.kaiyuanshe.cn/index.php?option=com_content&view=category&id=9\">如何建立您的许可证文件?</a><br>\r\n                                    <a href=\"http://www.kaiyuanshe.cn/index.php?option=com_content&view=category&id=9\">如何建立您的开源许可证?</a>\r\n                                </div>\r\n                                <div class=\"article-block\">\r\n                                    如果对检测结果有任何意见和反馈, 您可以<a href=\"http://www.kaiyuanshe.cn/feedback.php\">联系我们</a>\r\n                                </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>";
     break;
 }
 chdir("target");
 try {
     $command = "svn up " . $foundLinceseFile;
     $checkoutresult = SvnPeer::runCmd($command);
 } catch (Exception $e) {
     $logger->log('error', 'SVN command "svn up" got exception: ' . $e->getMessage(), $loghelperArr);
     chdir("..");
     chdir("..");
     deldir($foldername);
     echo "\r\n                                <div class=\"article-block\" id=\"checkwithfailed\">\r\n                                    <span id=\"titleresult\">评估结果:</span>\r\n                                    <span id=\"resultsentence\">没有发现许可证文件</span>\r\n                                </div>\r\n                                <div class=\"article-block\" id=\"declare\">\r\n                                    <p>原因: 在您提供的代码仓库地址中没有发现许可证文件: </p>\r\n                                    <p id=\"sourlink\">\r\n                                            <a href=\"";
     echo $urlText;
     echo "\">";
     echo $urlText;
     echo "</a>\r\n                                        </p>\r\n                                </div>\r\n                                \r\n                                <div class=\"article-block\" id=\"moreinfo\">\r\n                                    <span>请参考下面的链接:</span><br>\r\n                                    <a href=\"http://www.kaiyuanshe.cn/index.php?option=com_content&view=category&id=9\">如何建立您的许可证文件?</a><br>\r\n                                    <a href=\"http://www.kaiyuanshe.cn/index.php?option=com_content&view=category&id=9\">如何建立您的开源许可证?</a>\r\n                                </div>\r\n                                <div class=\"article-block\">\r\n                                    如果对检测结果有任何意见和反馈, 您可以<a href=\"http://www.kaiyuanshe.cn/feedback.php\">联系我们</a>\r\n                                </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>";
     break;
 }
 // Load file content
 $originalfilecontentarr = file($foundLinceseFile);
 $logger->log('debug', 'the found license file name in svn check out: ' . $foundLinceseFile, $loghelperArr);
Example #2
0
 public static function getHeadRevision($path)
 {
     $command = "cd {$path} && svn up";
     $output = SvnPeer::runCmd($command);
     $output = implode('<br>', $output);
     preg_match_all("/[0-9]+/", $output, $ret);
     if (!$ret[0][0]) {
         return "<br>" . $command . "<br>" . $output;
     }
     return $ret[0][0];
 }