54 $this->Utilities =
get_package(
'utilities' ,
'last' , __FILE__ );
85 $Params->load_settings( $ScriptLine );
87 if( $Params->get_setting(
'command' ,
'' ) ===
'install_package' )
89 $PackageFilePath = $Params->get_setting(
'package_file_path' ,
'' );
90 $MasterPackageName = $Params->get_setting(
'master_package_name' ,
'' );
91 $MasterPackageVersion = $Params->get_setting(
'master_package_version' ,
'' );
93 $this->
install_package( $PackageFilePath , $MasterPackageName , $MasterPackageVersion );
97 throw(
new Exception(
'Command '.$ScriptLine.
' was not executed' ) );
139 if( $MasterPackageName ===
'auto' )
141 $Zip =
new ZipArchive;
142 if( $Zip->open( $FileSource ) === true )
144 $Conf = $Zip->getFromName(
'./install/cf_install' );
145 if( $Conf ===
false )
148 $Settings->load_setings( $Conf );
149 $MasterPackageName = $Settings->get_setting(
'master_package_name' ,
'/' );
150 $MasterPackageVersion = $Settings->get_setting(
'master_package_version' ,
'last' );
157 return( array( $MasterPackageName , $MasterPackageVersion ) );
159 catch( Exception $e )
191 private function get_root_dir( $MasterPackageName , $MasterPackageVersion )
195 if( $MasterPackageName ===
'/' )
202 $ROOT_DIR =
_get_package_path( $MasterPackageName , $MasterPackageVersion , $ROOT_DIR );
207 catch( Exception $e )
239 function install_package( $PackageFilePath , $MasterPackageName , $MasterPackageVersion )
244 $PackageFilePath , $MasterPackageName , $MasterPackageVersion
247 $ROOT_DIR = $this->get_root_dir( $MasterPackageName , $MasterPackageVersion );
251 $PageComposer =
get_package(
'page::page_composer' ,
'last' , __FILE__ );
252 $PageComposer->add_success_message(
'package_was_installed' );
256 catch( Exception $e )
293 $Files =
$Utilities->get_files_from_directory( $Directory );
295 if( count( $Files ) )
297 $Time = $TimeFunc( $Files[ 0 ] );
298 foreach( $Files as $k => $v )
300 $Tmp = $TimeFunc( $v );
312 catch( Exception $e )
342 foreach( $List as $i => $l )
345 $PackagePath =
_get_package_path( $l[
'package_name' ] , $l[
'package_version' ] , $RootDir );
348 $List[ $i ][
'modify_date' ] = date(
'Y-m-d&\nb\sp;G:i:s' , $FileMTime );
351 $List[ $i ][
'access_date' ] = date(
'Y-m-d&\nb\sp;G:i:s' , $FileATime );
356 catch( Exception $e )
389 $PackageInfo[
'full_package_name' ] , $PackageInfo[
'full_package_version' ]
392 return( $this->Utilities->get_files_from_directory(
"$PackagePath/meta" ,
'/meta_.+/' ) );
394 catch( Exception $e )
427 $PackageInfo[
'full_package_name' ] , $PackageInfo[
'full_package_version' ]
430 return( $this->Utilities->get_files_from_directory(
"$PackagePath/conf" ,
'/_.+/' ) );
432 catch( Exception $e )
464 if( $List ===
false )
469 foreach( $List as $i => $l )
471 $List[ $i ][
'subpackages' ] = $this->
get_packages_tree( $List[ $i ][
'subpackages' ] );
478 catch( Exception $e )
522 $List = $this->get_all_packages();
523 if( $Order !==
false )
525 $SortSign = $Order ===
'ascending' ?
'<' :
'>';
526 $SortFunc = create_function(
528 "if( \$a[ '$Field' ] == \$b[ '$Field' ] )return(0);".
529 "return( \$a[ '$Field' ] $SortSign \$b[ '$Field' ] ? -1 : 1 );"
531 usort( $List , $SortFunc );
535 foreach( $List as $i => $l )
537 if( $i >= $Start && $i < $Start + $Limit )
544 catch( Exception $e )