<commit_before><?php

class Desa_model extends CI_Model{

  var $table = 'customers';
  var $column_order = array(null, 'nama_desa','nama_kecamatan','nama_kabupaten','nama_provinsi','url_referrer','opensid_version','tgl'); //set column field database for datatable orderable
  var $column_search = array('nama_desa','nama_kecamatan','nama_kabupaten','nama_provinsi'); //set column field database for datatable searchable
  var $order = array('id' => 'asc'); // default order

  public function __construct(){
    parent::__construct();
    $this->load->database();
    $this->load->library('user_agent');
  }

  public function insert(&$data){
    $url = $data['url'];
    $data['url'] = parse_url($url, PHP_URL_HOST);
    unset($data['version']);

    // Masalah dengan auto_increment meloncat. Paksa supaya berurutan.
    // https://ubuntuforums.org/showthread.php?t=2086550
    // $sql = "ALTER TABLE desa AUTO_INCREMENT = 1";
    // $this->db->query($sql);

    $cek_desa = array(
      "nama_desa" => $data['nama_desa'],
      "nama_kecamatan" => $data['nama_kecamatan'],
      "nama_kabupaten" => $data['nama_kabupaten'],
      "nama_provinsi" => $data['nama_provinsi']
      );
    $data['id'] = $this->db->select('id')->where($cek_desa)->get('desa')->row()->id;
    if (empty($data['id'])){
      $out = $this->db->insert('desa', $data);
      $data['id'] = $this->db->insert_id();
      $this->email("Desa baru", json_encode($data));
      $hasil = "<br>Desa baru: ".$data['id'];
    } else {
      $out = $this->db->where('id',$data['id'])->update('desa',$data);
      $hasil = "<br>Desa lama: ".$data['id'];
    }
    return $hasil." ".$out;<commit_msg>Kembali set auto_increment di desa_model<commit_after><?php

class Desa_model extends CI_Model{

  var $table = 'customers';
  var $column_order = array(null, 'nama_desa','nama_kecamatan','nama_kabupaten','nama_provinsi','url_referrer','opensid_version','tgl'); //set column field database for datatable orderable
  var $column_search = array('nama_desa','nama_kecamatan','nama_kabupaten','nama_provinsi'); //set column field database for datatable searchable
  var $order = array('id' => 'asc'); // default order

  public function __construct(){
    parent::__construct();
    $this->load->database();
    $this->load->library('user_agent');
  }

  public function insert(&$data){
    $url = $data['url'];
    $data['url'] = parse_url($url, PHP_URL_HOST);
    unset($data['version']);

    // Masalah dengan auto_increment meloncat. Paksa supaya berurutan.
    // https://ubuntuforums.org/showthread.php?t=2086550
    $sql = "ALTER TABLE desa AUTO_INCREMENT = 1";
    $this->db->query($sql);

    $cek_desa = array(
      "nama_desa" => $data['nama_desa'],
      "nama_kecamatan" => $data['nama_kecamatan'],
      "nama_kabupaten" => $data['nama_kabupaten'],
      "nama_provinsi" => $data['nama_provinsi']
      );
    $data['id'] = $this->db->select('id')->where($cek_desa)->get('desa')->row()->id;
    if (empty($data['id'])){
      $out = $this->db->insert('desa', $data);
      $data['id'] = $this->db->insert_id();
      $this->email("Desa baru", json_encode($data));
      $hasil = "<br>Desa baru: ".$data['id'];
    } else {
      $out = $this->db->where('id',$data['id'])->update('desa',$data);
      $hasil = "<br>Desa lama: ".$data['id'];
    }
    return $hasil." ".$out;
{'fraction_non_alphanumeric': 0.20961481039116153, 'fraction_numerical': 0.00477754553598089, 'mean_word_length': 4.1617873651771955, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 57, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '798490', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1224, 'n_words': 205}