Ignore:
Timestamp:
09/26/13 15:41:49 (11 years ago)
Author:
angelo
Message:

Ticket #3491 - Compatibilizar Expresso com novas versoes do PHP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/adodb-csvlib.inc.php

    r34 r8222  
    99/*  
    1010 
    11   V4.94 23 Jan 2007  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 
     11  V5.18 3 Sep 2012   (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. 
    1212  Released under both BSD license and Lesser GPL library license.  
    1313  Whenever there is any discrepancy between the two licenses,  
     
    5555                 
    5656                if ($rs->databaseType == 'array') { 
    57                         $rows =& $rs->_array; 
     57                        $rows = $rs->_array; 
    5858                } else { 
    5959                        $rows = array(); 
     
    6565                 
    6666                for($i=0; $i < $max; $i++) { 
    67                         $o =& $rs->FetchField($i); 
     67                        $o = $rs->FetchField($i); 
    6868                        $flds[] = $o; 
    6969                } 
     
    7272                $class = $rs->connection->arrayClass; 
    7373                $rs2 = new $class(); 
     74                $rs2->timeCreated = $rs->timeCreated; # memcache fix 
    7475                $rs2->sql = $rs->sql; 
    7576                $rs2->oldProvider = $rs->dataProvider;  
     
    9192*                       empty recordset is returned 
    9293*/ 
    93         function &csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array') 
     94        function csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array') 
    9495        { 
    9596                $false = false; 
     
    262263        /** 
    263264        * Save a file $filename and its $contents (normally for caching) with file locking 
     265        * Returns true if ok, false if fopen/fwrite error, 0 if rename error (eg. file is locked) 
    264266        */ 
    265267        function adodb_write_file($filename, $contents,$debug=false) 
     
    281283                        // getmypid() actually returns 0 on Win98 - never mind! 
    282284                        $tmpname = $filename.uniqid($mtime).getmypid(); 
    283                         if (!($fd = @fopen($tmpname,'a'))) return false; 
    284                         $ok = ftruncate($fd,0);                  
    285                         if (!fwrite($fd,$contents)) $ok = false; 
     285                        if (!($fd = @fopen($tmpname,'w'))) return false; 
     286                        if (fwrite($fd,$contents)) $ok = true; 
     287                        else $ok = false; 
    286288                        fclose($fd); 
    287                         chmod($tmpname,0644); 
    288                         // the tricky moment 
    289                         @unlink($filename); 
    290                         if (!@rename($tmpname,$filename)) { 
    291                                 unlink($tmpname); 
    292                                 $ok = false; 
    293                         } 
    294                         if (!$ok) { 
    295                                 if ($debug) ADOConnection::outp( " Rename $tmpname ".($ok? 'ok' : 'failed')); 
     289                         
     290                        if ($ok) { 
     291                                @chmod($tmpname,0644); 
     292                                // the tricky moment 
     293                                @unlink($filename); 
     294                                if (!@rename($tmpname,$filename)) { 
     295                                        unlink($tmpname); 
     296                                        $ok = 0; 
     297                                } 
     298                                if (!$ok) { 
     299                                        if ($debug) ADOConnection::outp( " Rename $tmpname ".($ok? 'ok' : 'failed')); 
     300                                } 
    296301                        } 
    297302                        return $ok; 
     
    299304                if (!($fd = @fopen($filename, 'a'))) return false; 
    300305                if (flock($fd, LOCK_EX) && ftruncate($fd, 0)) { 
    301                         $ok = fwrite( $fd, $contents ); 
     306                        if (fwrite( $fd, $contents )) $ok = true; 
     307                        else $ok = false; 
    302308                        fclose($fd); 
    303                         chmod($filename,0644); 
     309                        @chmod($filename,0644); 
    304310                }else { 
    305311                        fclose($fd); 
Note: See TracChangeset for help on using the changeset viewer.