Changeset 1519


Ignore:
Timestamp:
Oct 1, 2010, 1:18:01 AM (10 years ago)
Author:
goya
Message:

Decompression des rapports compatible avec une forte consommation de mémoire

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/lib/model/doctrine/Texteloi.class.php

    r1517 r1519  
    281281  public function getContenu() {
    282282    $c = $this->_get('contenu');
    283     return gzinflate(base64_decode($c));
     283    $t = base64_decode($c);
     284    $c = '';
     285    $file = tempnam(sys_get_temp_dir(), 'textloi');
     286    $temp = fopen($file, 'w');
     287    fwrite($temp, $t);
     288    fclose($temp);
     289    $temp = gzopen($file, 'r');
     290    $z = gzgets($temp, memory_get_usage(true)*2/3);
     291    gzclose($temp);
     292    unlink($file);
     293    return $z;
    284294  }
    285295
    286296  public function setContenu($c) {
    287     return $this->_set('contenu', base64_encode(gzdeflate($c)));
     297    $file = tempnam(sys_get_temp_dir(), 'textloi');
     298    $temp = gzopen($file, 'w');
     299    gzwrite($temp, $c);
     300    gzclose($temp);
     301    $ret = $this->_set('contenu', base64_encode(file_get_contents($file)));
     302    unlink($file);
     303    return $ret;
    288304  }
    289305
Note: See TracChangeset for help on using the changeset viewer.