2013-12-16 1 views
1

DirectAdmin이있는 서버에서 나는 약 80 개의 웹 사이트를 호스팅합니다. 이제 모든 웹 사이트에서 CKEditor를 업데이트하고 싶습니다. 이 CKEditor는 같은 폴더의 모든 웹 사이트에 있습니다. Like : public_html/admin/plugin/CKeditor직접 관리자 변경 파일 여러 도메인

CKEditor 맵이있는 모든 도메인에 새 CKEditor를 업로드 할 수있는 옵션이 있습니까?

답변

1

모든 사이트에 FTP 업로드 스크립트를 작성할 수 있습니다. IP 주소, 사용자 이름 및 암호와 같은 FTP 정보를 포함하는 객체의 배열/목록을 만들어야합니다. 그런 다음 객체 목록을 반복하고 올바른 디렉토리에 파일을 업로드하십시오.

기존 디렉터리를 삭제할 수도 있습니다. 단일 사이트에서이 작업을 먼저 시도하여 프로세스가 작동하는지 확인하는 것이 좋습니다. 그런 다음 한 번에 두세 가지를 시도하고 오류가 있는지 확인할 수 있습니다. 그런 다음 남은 70 ~ 80 세를 돌릴 수 있습니다.

예를 들어

는 PHP 사이트에서 가져온이 코드를 보면 :

<?php 

class SFTPConnection 
{ 
    private $connection; 
    private $sftp; 

    public function __construct($host, $port=22) 
    { 
     $this->connection = @ssh2_connect($host, $port); 
     if (! $this->connection) 
      throw new Exception("Could not connect to $host on port $port."); 
    } 

    public function login($username, $password) 
    { 
     if (! @ssh2_auth_password($this->connection, $username, $password)) 
      throw new Exception("Could not authenticate with username $username " . 
           "and password $password."); 

     $this->sftp = @ssh2_sftp($this->connection); 
     if (! $this->sftp) 
      throw new Exception("Could not initialize SFTP subsystem."); 
    } 

    public function uploadFile($local_file, $remote_file) 
    { 
     $sftp = $this->sftp; 
     $stream = @fopen("ssh2.sftp://$sftp$remote_file", 'w'); 

     if (! $stream) 
      throw new Exception("Could not open file: $remote_file"); 

     $data_to_send = @file_get_contents($local_file); 
     if ($data_to_send === false) 
      throw new Exception("Could not open local file: $local_file."); 

     if (@fwrite($stream, $data_to_send) === false) 
      throw new Exception("Could not send data from file: $local_file."); 

     @fclose($stream); 
    } 
} 

try 
{ 
    $sftp = new SFTPConnection("localhost", 22); 
    $sftp->login("username", "password"); 
    $sftp->uploadFile("/tmp/to_be_sent", "/tmp/to_be_received"); 
} 
catch (Exception $e) 
{ 
    echo $e->getMessage() . "\n"; 
} 

?> 

참조하십시오. http://www.php.net/manual/en/function.ssh2-sftp.php#94651

그걸로 로그인하고 파일을 업로드 할 수 있습니다. 당신은 단지 사이트 목록을 통해 반복하고 업로드하려는 전체 디렉토리를 반복하기 위해이를 수정해야합니다.