Esempio n. 1
0
 public function deploy()
 {
     $this->ftpSettings = new Settings('ftp');
     $this->utils = new Utils();
     $this->remote = new Remote($this->ftpSettings);
     $localChanges = $this->getModifiedLocalFiles();
     $remoteChanges = $this->getModifiedRemoteFiles();
     $missingRemote = $this->getMissingRemoteFiles();
     // Merge the changes together
     foreach ($remoteChanges as $file => $change) {
         if (!isset($localChanges[$file])) {
             $localChanges[$file] = $change;
         }
     }
     foreach ($missingRemote as $file => $change) {
         if (!isset($localChanges[$file])) {
             $localChanges[$file] = $change;
         }
     }
     // Send the changes to the remote server:
     $status = $this->remote->sendChanges($localChanges);
     foreach ($status->messages as $message) {
         echo "Remote: {$message}\n";
     }
     $this->remote->cleanUp();
     // ...grab another remote snapshot
     $this->currentRemoteState = $this->remote->remoteScan();
     // if all went well (how do we know?), we're still here... so save state
     $this->remote->cleanUp();
     $this->remote->close();
     $this->saveState();
 }
Esempio n. 2
0
 public function mirror()
 {
     $this->remoteSettings = new Settings('remote');
     $this->utils = new Utils();
     $this->remote = new Remote($this->remoteSettings);
     $this->mirrorFiles();
     $this->rewriteWpConfig();
     $this->mirrorDb();
     $this->rewriteDb();
     // Grab another local snapshot
     $this->currentLocalState = $this->utils->localScan($this->remoteSettings->localpath);
     $this->saveState();
     // if all went well (how do we know?), we're still here... so save state
     $this->remote->cleanUp();
 }