12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- class UpdateModule
- {
-
- public function autoUpdate($updateURI)
- {
- try {
- set_error_handler('err_handler');
- $ch = curl_init($updateURI);
-
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
-
- @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
- @curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- file_put_contents('../release.zip', curl_exec($ch));
- curl_close($ch);
- $zip = new ZipArchive;
- if ($zip->open('../release.zip'))
- $zip->extractTo('../');
- $zip->close();
-
- $backupDao = new BackupDao();
- $sql = $backupDao->getDatabaseBackupSql();
- $file_name = "eoLinker_backup_database_" . time() . '.sql';
- if (!file_put_contents(realpath('./dump') . DIRECTORY_SEPARATOR . $file_name, $sql)) {
- return FALSE;
- }
-
- $updateDao = new UpdateDao;
- $updateDao->updateDatabase();
-
- if (file_exists(PATH_FW . DIRECTORY_SEPARATOR . 'Common/UpdateFunction.php'))
- quickRequire(PATH_FW . DIRECTORY_SEPARATOR . 'Common/UpdateFunction.php');
- return TRUE;
- } catch (\Exception $e) {
- throw new Exception($e->getMessage(), 100001);
- }
- }
-
- public function manualUpdate()
- {
- try {
-
- $backupDao = new BackupDao();
- $sql = $backupDao->getDatabaseBackupSql();
- $file_name = "eoLinker_backup_database_" . time() . '.sql';
- if (!file_put_contents(realpath('./dump') . DIRECTORY_SEPARATOR . $file_name, $sql)) {
- return FALSE;
- }
-
- $updateDao = new UpdateDao;
- $updateDao->updateDatabase();
-
- if (file_exists(PATH_FW . DIRECTORY_SEPARATOR . 'Common/UpdateFunction.php'))
- quickRequire(PATH_FW . DIRECTORY_SEPARATOR . 'Common/UpdateFunction.php');
- return TRUE;
- } catch (\Exception $e) {
- throw new Exception($e->getMessage(), 100001);
- }
- }
- }
- ?>
|