Location: PHPKode > scripts > NabiCI > CI/Continuous_integration.php

require_once realpath(dirname(__FILE__))."/".('Loop.php');
require_once realpath(dirname(__FILE__))."/".('website_builder.php');
require_once realpath(dirname(__FILE__))."/".('../include/read_ini_file.php');
define ("stop_ci","stop_ci.lock");

 * class Continuous_integration prepares all necessary steps to
 * run and finish a Loop and checks the feasibilty to run a Loop
 * @author Derya Oez
 * @version 1.0
 * @package NabidooCI

class Continuous_integration
	 * function __construct($name) checks if a Loop is already running or not, locks for other Loops 
	 * to run the current Loop till finishing, gets all Information about the Loop from the configuration file,
	 * initializes to run the Continuous Integration Loop, unlocks after finishing Loop
	 * @access public
	 * @param String $name  
	 * Instruction to run this Continuous Integration Loop

	public function __construct($name)
		//checking, if a loop is already running
		//if a loop is not running
		if (! easy_file::exists(build_lock))
			echo "starting with loop $name\n";
			//create a file named build.lock
			//get all Information from the configuration file, save as an Array
			$ini_array = read_ini_file("ci.ini");
			//creating an Object of Loop
			$loopObject  = new  Loop($name);
			//use the function run from the class loop to run
			//checking, if the file stop_ci.lock exists 
			if (! easy_file::exists(stop_ci))
			{	//if stop_ci.lock does not exist, 
				//delete the build.lock file to unlock, so it´s possible to run another Loop 
				echo "Loop $name finished.\n";
			//if the stop_ci.lock exists, it is not possible to unlock
			else {
				echo "build.lock could not be deleted. Loops are still blocked.\n";
		// if the build.lock exists, so it could not be started another loop 
			echo"There is already a Loop running.\n";

Return current item: NabiCI