Basit bir güncelleme yöntemi. Tabiki büyük projelerde kullanamazsın.
Server tarafında
Versiyonu kontrol edip. Güncel versiyon dosyalarını gönderebileceğin bir halde yapabilirsin.
Client tarafında böyle birşey yapıp kontrol edebilirsin.
<?php class Updater { private $versionCheck = 'https://xxx.../checkVersion'; private $versionFiles = 'https://xxx.../getFiles'; public $currentVersion = '1.0'; function update() { $result = $this->get($this->versionCheck); if (!$result) { return $this->response(false, 'Manuel Güncelleme yapın'); } $lastVersion = json_decode($result); if ($this->currentVersion === $lastVersion) { return $this->response(true, 'Zaten Güncel'); } $result = $this->get($this->versionFiles); if (!$result) { return $this->response(false, 'Manuel Güncelleme yapın'); } $checkFiles = json_decode($result); foreach ($checkFiles as $filePath => $icerik) { if (!is_writable($filePath)) { return $this->response(false, "$filePath Dosyasının yazma izni yok"); } } foreach ($checkFiles as $filePath => $content) { $file = @fopen($filePath, 'w'); if (!$file) { return $this->response(false, 'Manuel Güncelleme yapın'); } fwrite($file, $content); fclose($file); } return $this->response(true, 'Güncellendi'); } function get($url) { return file_get_contents($url); } function response($status, $message) { return ['status' => $status, 'message' => $message]; } } ?>