/** * 处理文件 * @param $host * @param $port * @param $root * @param $modify_table * @param $filename * @param $socket * @return array */ function http_process_file($url, $filename, $dest, $changed) { $mtime = modify_time($filename); if ($mtime != ($filemtime = filemtime($filename))) { modify_time($filename, $filemtime); echo "send file {$filename} to {$dest}\n"; http_send_relet_file($url, $filename, $dest); return true; } else { return $changed; } }
function pwi_toolbar($username, $cur_path) { print "<div id=\"phpwebide_toolbar\">\n"; if (isset($_REQUEST['svn_rev'])) { $restoreurl = "admin.php?user={$username}&path=" . urlencode($cur_path) . "&action=restore_revision&svn_rev=" . intval($_REQUEST['svn_rev']); ?> <span class="tree-button"><a href="<?php echo $restoreurl; ?> "><i class="fa fa-eye-slash fa-2x"></i> Restore this revision</a></span> <?php } send_homework_button($username, $cur_path); test_button($username, $cur_path); modify_time($username, $cur_path); print "</div>\n"; }
/** * 发送改变了的文件 * @param $host * @param $port * @param $root * @param $filemtime * @param $modify_table * @param $filename * @param $socket * @return array */ function send_file_change($host, $port, $id, $root, $filemtime, $modify_table, $filename, $socket) { modify_time($filename, $filemtime); // echo "time diff $modify_table[$filename] $filemtime\n"; echo "send file {$filename}\n"; if ($socket === null) { $socket = open_socket($host, $port); } send_relet_file($socket, $id, $root, $filename); $changed = true; return array($modify_table, $socket, $changed); }