Changeset 6399 for sandbox/2.4.1-3


Ignore:
Timestamp:
06/04/12 09:57:19 (12 years ago)
Author:
cristiano
Message:

Ticket #2768 - Verificação de permissão na pasta config REST API

Location:
sandbox/2.4.1-3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.1-3/prototype/api/config.php

    r6367 r6399  
    7272        public static function writeIniFile($assoc_arr, $path, $has_sections) 
    7373        { 
    74                 $content = ''; 
    75  
    76                 if (!$handle = fopen($path, 'w')) 
    77                 { 
    78                         trigger_error("Permission failure when trying to open the file: $path ", E_USER_WARNING); 
    79                         return FALSE; 
    80                 }        
    81  
     74                $content = '';   
    8275                self::_writeIniFile($content, $assoc_arr, $has_sections); 
    83  
    84                 if (!fwrite($handle, $content)) 
     76                if( file_put_contents($path, $content) === false) 
    8577                { 
    8678                        trigger_error("Permission failure when trying to write in the file: $path ", E_USER_WARNING); 
    87                 }       return FALSE; 
    88  
    89                 fclose($handle); 
    90                 return TRUE; 
     79                        return false; 
     80                } 
     81                return true; 
    9182        } 
    9283 
  • sandbox/2.4.1-3/rest/setup/tables_current.inc.php

    r6368 r6399  
    1010  \**************************************************************************/ 
    1111 
     12//Verifica se tem permissão na pasta de configuração antes de começar a instalação do modulo. 
     13require_once dirname(__FILE__) . '/../../prototype/api/config.php'; 
     14use prototype\api\Config as Config; 
     15 
     16if( Config::writeIniFile(array() , dirname(__FILE__) . '/../../prototype/config/REST.ini', true) === false ) 
     17{ 
     18        echo "<div style='color:red;font-size:14px'>Permission failure when trying to write in folder \"/prototype/config/\". Grant write permission in folder and try again. </div>"; 
     19        die(); //Mata o restante da execução. 
     20} 
     21/// 
    1222 
    1323        $phpgw_baseline = array( 
Note: See TracChangeset for help on using the changeset viewer.