#5658: Add FILE_APPEND flag to file_put_contents function on basics.php
------------------------------------------+---------------------------------
    Reporter:  mxcoder                    |          Type:  Enhancement   
      Status:  new                        |      Priority:  Medium        
   Milestone:  1.2.x.x                    |     Component:  Core Libs     
     Version:  RC2                        |      Severity:  Normal        
    Keywords:  basics, file_put_contents  |   Php_version:  PHP 4 >= 4.3.2
Cake_version:                             |  
------------------------------------------+---------------------------------
 This is important because there're so many people using PHP4 + Cake, and
 its very easy to implement.


 Here's one implementation from "egingell at sisna dot com" from php.net


 {{{
 if ( !function_exists('file_put_contents') && !defined('FILE_APPEND') ) {
         define('FILE_APPEND', 1);
         function file_put_contents($n, $d, $flag = false) {
             $mode = ($flag == FILE_APPEND || strtoupper($flag) ==
 'FILE_APPEND') ? 'a' : 'w';
             $f = @fopen($n, $mode);
             if ($f === false) {
                 return 0;
             } else {
                 if (is_array($d)) $d = implode($d);
                 $bytes_written = fwrite($f, $d);
                 fclose($f);
                 return $bytes_written;
             }
         }
 }
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5658>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to