72 $this->Cache =
get_package(
'cache' ,
'last' , __FILE__ );
98 $this->Cache->reset();
100 catch( Exception $e )
124 private function get_mounted_storages_from_file( $FilePath )
129 if( $this->MountedStorages !==
false )
131 $this->Cache->add_data( $FilePath , $this->MountedStorages );
134 catch( Exception $e )
162 $Data = $this->Cache->get_data( $FilePath );
163 if( $Data !==
false )
165 $this->MountedStorages = $Data;
169 $this->get_mounted_storages_from_file( $FilePath );
172 $this->MountedStorages = str_replace(
"\r" ,
"\n" , $this->MountedStorages );
173 $this->MountedStorages = str_replace(
"\n\n" ,
"\n" , $this->MountedStorages );
174 $this->MountedStorages = explode(
"\n" , $this->MountedStorages );
175 foreach( $this->MountedStorages as $i => $v )
177 $this->MountedStorages[ $i ] = dirname( __FILE__ ).
'/../../'.$this->MountedStorages[ $i ];
180 catch( Exception $e )
204 if( $this->MountedStorages ===
false )
206 if(
file_exists( dirname( __FILE__ ).
'/conf/'.DOMAIN.
'.cf_data_storages' ) )
208 $StoragesConfig = dirname( __FILE__ ).
'/conf/'.DOMAIN.
'.cf_data_storages';
217 catch( Exception $e )
245 private function handle_file_was_not_found_error( $ThrowException )
249 if( $ThrowException )
251 throw(
new Exception(
"File $FilePath was not found" ) );
258 catch( Exception $e )
296 $FilePath = str_replace(
'/./' ,
'/' , $FilePath );
298 $FileName = basename( $FilePath );
299 foreach( $this->MountedStorages as $ms )
303 return( $ms.
'/'.$FileName );
312 return( $this->handle_file_was_not_found_error( $ThrowException ) );
314 catch( Exception $e )
346 $Data = $this->Cache->get_data( $OriginalFilePath );
348 if( $Data ===
false )
350 $FilePath = $this->
get_file_path( $OriginalFilePath ,
false );
352 if( $this->CachedFS ===
false )
354 $this->CachedFS =
get_package(
'cached_fs' ,
'last' , __FILE__ );
357 return( $this->CachedFS->store_file_exists_info( $OriginalFilePath , $FilePath ) );
361 return( $Data ==
'_file_was_not_found' ?
false :
true );
364 catch( Exception $e )
400 if( $Mode ==
'cleaned' )
402 $Data = str_replace(
"\r" ,
"\n" , $Data );
403 $Data = str_replace(
"\n\n" ,
"\n" , $Data );
404 if( $this->Text ===
false )
406 $this->Text =
get_package(
'string::text' ,
'last' , __FILE__ );
408 $Data = $this->Text->remove_bom( $Data );
411 if( $Mode ==
'exploded' )
413 $Data = str_replace(
"\r" ,
"\n" , $Data );
414 $Data = str_replace(
"\n\n" ,
"\n" , $Data );
415 $Data = explode(
"\n" , $Data );
420 catch( Exception $e )
456 $Data = $this->Cache->get_data( $OriginalFilePath );
457 if( $Data ===
false )
460 if( $Data ===
false )
464 $this->Cache->add_data( $OriginalFilePath , $Data );
467 if( $Mode !==
'none' )
474 catch( Exception $e )
510 $Data = $this->Cache->get_data( $OriginalFilePath );
511 if( $Data ===
false )
513 $FileName = basename( $OriginalFilePath );
519 foreach( $this->MountedStorages as $ms )
526 $this->Cache->add_data( $OriginalFilePath , $Content );
532 catch( Exception $e )
564 if( $this->Cache->data_exists( $OriginalFilePath ) )
566 $this->Cache->set_data( $OriginalFilePath , $Data );
570 $this->Cache->add_data( $OriginalFilePath , $Data );
573 $FilePath = $this->
get_file_path( $OriginalFilePath ,
false );
575 @
file_put_contents( $FilePath ===
false ? $OriginalFilePath : $FilePath , $Data );
577 catch( Exception $e )
613 return( $this->
file_get_contents( dirname( $PackagePath ).
"/res/templates/$FileName" ) );
615 catch( Exception $e )
651 return( $this->
file_get_contents( dirname( $PackagePath ).
"/conf/$FileName" ,
'cleaned' ) );
653 catch( Exception $e )
689 function get_data( $PackagePath , $FileName , $Mode =
'none' )
693 return( $this->
file_get_contents( dirname( $PackagePath ).
"/data/$FileName" , $Mode ) );
695 catch( Exception $e )
739 catch( Exception $e )
783 catch( Exception $e )
831 catch( Exception $e )
859 return( $this->MountedStorages );
861 catch( Exception $e )
885 $this->Cache->flush();
887 catch( Exception $e )