PHP Write UltraEdit Plugin Script implementation Method _php tutorial

Source: Internet
Author: User
Tags php write pscp ultraedit
Demand:

1 The code on SVN has a set of local (editor UltraEdit), a set on the development machine (CentOS), need local code modification to upload to the development machine

2 is not modified and used directly on the development machine because many people use the same development machine, in order to keep local backups

ideas:

1 Write a script as UltraEdit plug-in, so that the code can be modified and press the key to be able to directly save the code locally after uploading to the CentOS

2 Local is Windows, remote is Linux, File Upload tool can use Pscp.exe, scripting language using PHP or Python

3 PHP must be installed locally, no database installation and Apache required

4 in PHP, a process call Pscp.exe, parsing path and other logic put in PHP


steps:

1 Ultaedit Set the script in the tool configuration .

PHP "C:\Users\nickyjf\Desktop\mesh\Tools\syncFile\sync142.php"%p%n%e

The%p%n%e is the absolute path to the currently edited file, which is passed into the synv142.php as a parameter

2 sync142.php Code
Copy CodeThe code is as follows:
Plug-ins to sync 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%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 the Pscp.exe in the sync142 sibling 4 to map the key CTRL + 1 to this script so in the writing process When you press CTRL + 1 to replace the current script with the remote script

http://www.bkjia.com/phpjc/ 324841.html www.bkjia.com true http://www.bkjia.com/phpjc/324841.html techarticle requirements: 1 SVN code on the local (editor UltraEdit) a set, on the development Machine (CentOS) has a set of local code needs to be modified after uploading to the development machine 2 is not directly on the open ...

  • 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.