controllers/manager/rebuild.php
protected function rebuildFiles( Array $files )
	{
        // Generate the dependencies declaration file.
        DependencyInjector::getInstance()->generateDependenciesDeclaration();

		$this->setLayout( 'manager/templates.tpl' );

		$output = array( );

		$instance_inheritance 	= array_unique( \Sifo\Domains::getInstance()->getInstanceInheritance() );

		$instance_inheritance_reverse = array_reverse( $instance_inheritance );

		// Build the instance configuration: instance name and his parent instance name is exists.
		foreach( $instance_inheritance_reverse as $key => $instance )
		{
			$instance_config['current'] 	= $instance;
			if ( isset( $instance_inheritance[ $key+1 ] ) )
			{
				$instance_config['parent'] 	= $instance_inheritance_reverse[$key+1];
			}
			$instances_configuration[] = $instance_config;
			unset( $instance_config );
		}

		// For each instance in the inheritance it regenerates his configuration files.
        foreach( $instances_configuration as $instance )
		{
			$current_instance		= $instance['current'];

			$this->assign( 'instance_parent', null );
			if ( isset( $instance['parent'] ) )
			{
				$this->assign( 'instance_parent', $instance['parent'] );
			}

			foreach ( $files as $file => $folders )
			{
				$configs = array( );
				foreach ( $folders as $folder )
				{
					$configs = array_merge( $configs, $this->getAvailableFiles( $folder, $current_instance ) );
				}

				$this->assign( 'config', $configs );
				$this->assign( 'file_name', $this->filenames[$file] );

				$configs_content = $this->grabHtml();

                $file_destination = ROOT_PATH . "/instances/" . $current_instance . "/config/" . $this->filenames[$file];
                if ($current_instance == 'common')
                {
                    $file_destination = ROOT_PATH . "/vendor/sifophp/sifo-common-instance/config/" . $this->filenames[$file];
                }

				$success = file_put_contents( $file_destination, $configs_content );
				if ( !$success )
				{
					$this->failed_files[] = $file_destination;
				}
				$output[$current_instance][$file] = $configs_content;
			}
		}

		return $output;

	}
protected function rebuildFiles( Array $files )
	{
        // Generate the dependencies declaration file.
        DependencyInjector::getInstance()->generateDependenciesDeclaration();

		$this->setLayout( 'manager/templates.tpl' );

		$output = array( );

		$instance_inheritance 	= array_unique( \Sifo\Domains::getInstance()->getInstanceInheritance() );

		$instance_inheritance_reverse = array_reverse( $instance_inheritance );

		// Build the instance configuration: instance name and his parent instance name is exists.
		foreach( $instance_inheritance_reverse as $key => $instance )
		{
			$instance_config['current'] 	= $instance;
			if ( isset( $instance_inheritance[ $key+1 ] ) )
			{
				$instance_config['parent'] 	= $instance_inheritance_reverse[$key+1];
			}
			$instances_configuration[] = $instance_config;
			unset( $instance_config );
		}

		// For each instance in the inheritance it regenerates his configuration files.
        foreach( $instances_configuration as $instance )
		{
			$current_instance		= $instance['current'];

			$this->assign( 'instance_parent', null );
			if ( isset( $instance['parent'] ) )
			{
				$this->assign( 'instance_parent', $instance['parent'] );
			}

			foreach ( $files as $file => $folders )
			{
				$configs = array( );
				foreach ( $folders as $folder )
				{
					$configs = array_merge( $configs, $this->getAvailableFiles( $folder, $current_instance ) );
				}

				$this->assign( 'config', $configs );
				$this->assign( 'file_name', $this->filenames[$file] );

				$configs_content = $this->grabHtml();

                $file_destination = ROOT_PATH . "/instances/" . $current_instance . "/config/" . $this->filenames[$file];
                if ($current_instance == 'common')
                {
                    $file_destination = ROOT_PATH . "/vendor/sifophp/sifo-common-instance/config/" . $this->filenames[$file];
                }

				$success = file_put_contents( $file_destination, $configs_content );
				if ( !$success )
				{
					$this->failed_files[] = $file_destination;
				}
				$output[$current_instance][$file] = $configs_content;
			}
		}

		return $output;

	}
protected function rebuildFiles ( Array $ files ) { // Generate the dependencies declaration file. DependencyInjector :: getInstance ( ) -> generateDependenciesDeclaration ( ) ; $ this -> setLayout ( 'manager/templates.tpl' ) ; $ output = array ( ) ; $ instance_inheritance = array_unique ( \ Sifo \ Domains :: getInstance ( ) -> getInstanceInheritance ( ) ) ; $ instance_inheritance_reverse = array_reverse ( $ instance_inheritance ) ; // Build the instance configuration: instance name and his parent instance name is exists. foreach ( $ instance_inheritance_reverse as $ key => $ instance ) { $ instance_config [ 'current' ] = $ instance ; if ( isset ( $ instance_inheritance [ $ key + 1 ] ) ) { $ instance_config [ 'parent' ] = $ instance_inheritance_reverse [ $ key + 1 ] ; } $ instances_configuration [ ] = $ instance_config ; unset ( $ instance_config ) ; } // For each instance in the inheritance it regenerates his configuration files. foreach ( $ instances_configuration as $ instance ) { $ current_instance = $ instance [ 'current' ] ; $ this -> assign ( 'instance_parent' , null ) ; if ( isset ( $ instance [ 'parent' ] ) ) { $ this -> assign ( 'instance_parent' , $ instance [ 'parent' ] ) ; } foreach ( $ files as $ file => $ folders ) { $ configs = array ( ) ; foreach ( $ folders as $ folder ) { $ configs = array_merge ( $ configs , $ this -> getAvailableFiles ( $ folder , $ current_instance ) ) ; } $ this -> assign ( 'config' , $ configs ) ; $ this -> assign ( 'file_name' , $ this -> filenames [ $ file ] ) ; $ configs_content = $ this -> grabHtml ( ) ; $ file_destination = ROOT_PATH . "/instances/" . $ current_instance . "/config/" . $ this -> filenames [ $ file ] ; if ( $ current_instance == 'common' ) { $ file_destination = ROOT_PATH . "/vendor/sifophp/sifo-common-instance/config/" . $ this -> filenames [ $ file ] ; } $ success = file_put_contents ( $ file_destination , $ configs_content ) ; if ( ! $ success ) { $ this -> failed_files [ ] = $ file_destination ; } $ output [ $ current_instance ] [ $ file ] = $ configs_content ; } } return $ output ; }
Writes all the configurattion files to disk.

Input expected is:

array( 'filename' => array( 'folder_to_parse1', 'folder_to_parse2', '...' ) )

@param array $files
@return array Array of contents write to each file.
Writes all the configurattion files to disk .