Example #1
0
 public static function make($inputData = array())
 {
     $loadData = self::get();
     // print_r($loadData);die();
     $url = $loadData['data']['file'];
     $sourcePath = '';
     if (!is_dir(ROOT_PATH . 'uploads/tmp/update/')) {
         Dir::create(ROOT_PATH . 'uploads/tmp/update/');
     }
     File::downloadModule($url, 'uploads/tmp/update/', 'yes');
     if (preg_match('/github\\.com/i', $url)) {
         $sourcePath = ROOT_PATH . 'uploads/tmp/update/noblessecms-master/';
     } else {
         $sourcePath = ROOT_PATH . 'uploads/tmp/update/noblessecms/';
     }
     $descPath = ROOT_PATH . 'uploads/tmp/test/';
     if (is_dir($sourcePath)) {
         unlink($sourcePath . '.htaccess');
         unlink($sourcePath . 'config.php');
         unlink($sourcePath . 'autoload.php');
         unlink($sourcePath . 'routes.php');
         unlink($sourcePath . 'README.md');
         if (file_exists($sourcePath . 'install/update.sql')) {
             Database::import($sourcePath . 'install/db.sql');
             Database::import($sourcePath . 'install/update.sql');
         }
         Dir::remove($sourcePath . 'install');
         Dir::remove($sourcePath . 'contents');
         Dir::remove($sourcePath . 'application/caches');
     }
     // File::fullCopy($sourcePath,ROOT_PATH.'uploads/tmp/test/');
     File::fullCopy($sourcePath, ROOT_PATH);
     Dir::remove($sourcePath);
     // Dir::remove($descPath);
 }
        $result = curl_exec($ch);
        // $result=gzuncompress($result);
        if ($hasHeader == 'yes') {
            $result = Compress::gzdecode($result);
        }
        // File::create(ROOT_PATH.'accc.txt',$result);
        return $result;
    }
}
File::downloadModule('https://github.com/safeservicejt/noblessecms/archive/master.zip', '', 'no');
$zip = new ZipArchive();
$res = $zip->open(ROOT_PATH . 'master.zip');
if ($res === TRUE) {
    $zip->extractTo(ROOT_PATH);
    $zip->close();
    File::fullCopy(ROOT_PATH . 'noblessecms-master', ROOT_PATH);
    Dir::remove(ROOT_PATH . 'noblessecms-master');
    unlink(ROOT_PATH . 'master.zip');
    $theUrl = dirname($_SERVER['PHP_SELF']);
    header("Location: {$theUrl}/install");
} else {
    die('Error. Contact us via email: safeservicejt@gmail.com');
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">