PHP UltraEdit plug-in script implementation method

Source: Internet
Author: User
Tags pscp ultraedit
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.