PHP writes the UltraEdit plug-in script implementation method. For more information, see.
PHP writes the UltraEdit plug-in script implementation method. For more information, see.
Requirements:
1. There is one set of svn code locally (the editor UltraEdit) and one set of code on the development machine (centos). You need to modify the local code and then upload it to the development machine.
2. It is not directly modified and used on the development machine because multiple people use the same development machine. In order to retain local backup
Ideas:
1. Write a script as the UltraEdit plug-in to save the code locally and upload it to centos after the code is modified by pressing the set button.
2. Windows: Remote: linux. you can use pscp.exe as the file upload tool, and PHP or Python as the script language.
3. You must install PHP locally without installing the database or apache.
4. Use pscp.exe in php and put the parsing path and other logic in php.
Steps:
1 configure the script in the tool configuration in UltaEdit
Php "C: \ Users \ nickyjf \ Desktop \ mesh \ Tools \ syncFile \ sync142.php" % p % n % e
The following % p % n % e is the absolute path of the current edited file. It is passed into synv142.php as a parameter.
2 sync142.php code
The Code is as follows:
// Plug-in to synchronize windwos files to linux
// Php "rsync142.php" % p % n % e
// Valid argv
// TestCode
/*
$ Argv = array (
"Rsync142.php ",
"E: \ SVN \ test \ www \ include \ ggg \ test \ DTest. php ",
);
*/
If (count ($ argv) = 2)
{
$ SFilePath = $ argv [1];
$ SServerName = "192.168.10.142 ";
$ SServerUserName = "name ";
$ SServerPassword = "password ";
$ SServerPath = sGetServerPath ($ sFilePath );
$ RealPath = sprintf ("% s @ % s:/% s", $ sServerUserName, $ sServerName, $ sServerPath );
Try
{
$ Cmd = sprintf ("pscp.exe-pw % s", $ sServerPassword, $ sFilePath, $ realPath );
Echo $ cmd. "\ n ";
System ($ cmd );
}
Catch (Exception $ e)
{
Print_r ($ e); exit;
}
}
Function sGetServerPath ($ sWindowsPath)
{
$ Ret = "";
$ Paths = explode ("\", $ sWindowsPath );
If ($ startKey = array_search ("www", $ paths ))
{
$ Ret = "test /";
For ($ I = $ startKey + 1; $ I {
$ Ret. = $ paths [$ I]. "/";
}
$ Ret = trim ($ ret ,"/");
}
Return $ ret;
}
?>
3. Place pscp.exe in the sync142 directory of the same level.
4. Press Ctrl + 1 to map to the script.Therefore, when writing a program, you only need to press Ctrl + 1 to replace the current script with the remote script.