services.php 22.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935
<?php
/**
* Services Step Controller.
*
* KnowledgeTree Community Edition
* Document Management Made Simple
* Copyright(C) 2008,2009 KnowledgeTree Inc.
* Portions copyright The Jam Warehouse Software(Pty) Limited
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
* California 94120-7775, or email info@knowledgetree.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
* must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
*
* @copyright 2008-2009, KnowledgeTree Inc.
* @license GNU General Public License version 3
* @author KnowledgeTree Team
* @package Installer
* @version Version 0.1
*/

class services extends Step 
{
	/**
	* List of errors encountered
	*
	* @author KnowledgeTree Team
	* @access protected
	* @var array
	*/
    protected $error = array();
    
	/**
	* Flag if step needs to be installed
	*
	* @author KnowledgeTree Team
	* @access protected
	* @var array
	*/
    protected $runInstall = true;
    
	/**
	* List of services to be installed
	*
	* @author KnowledgeTree Team
	* @access private
	* @var array
	*/
    private $services = array('Lucene', 'Scheduler', 'OpenOffice');
    
	/**
	* Path to java executable
	*
	* @author KnowledgeTree Team
	* @access protected
	* @var string
	*/
    protected $java;
    
	/**
	* Path to php executable
	*
	* @author KnowledgeTree Team
	* @access protected
	* @var string
	*/
    protected $php;
    
	/**
	* Path to open office executable
	*
	* @author KnowledgeTree Team
	* @access protected
	* @var string
	*/
	protected $soffice;

	/**
	* Reference to utility object
	*
	* @author KnowledgeTree Team
	* @access protected
	* @var string
	*/
    protected $util;

	/**
	* Minumum Java Version
	*
	* @author KnowledgeTree Team
	* @access protected
	* @var string
	*/
    private $javaVersion = '1.5';
//    private $javaVersion = '1.7';

	/**
	* Java Installed 
	*
	* @author KnowledgeTree Team
	* @access private
	* @var mixed
	*/
    private $javaCheck = 'cross';

    
    public $providedJava = false;
    
	/**
	* Flag if services are already Installed
	*
	* @author KnowledgeTree Team
	* @access private
	* @var mixed
	*/
    private $alreadyInstalled = false;
    
	/**
	* Flag if services are already Installed
	*
	* @author KnowledgeTree Team
	* @access private
	* @var mixed
	*/
    private $luceneInstalled = false;
    
	/**
	* Flag if services are already Installed
	*
	* @author KnowledgeTree Team
	* @access private
	* @var mixed
	*/
    private $schedulerInstalled = false;
    
	/**
	* PHP Installed 
	*
	* @author KnowledgeTree Team
	* @access private
	* @var mixed
	*/
    private $phpCheck = 'cross_orange';
    
	/**
	* Java Bridge Installed 
	*
	* @author KnowledgeTree Team
	* @access private
	* @var mixed
	*/
    private $javaExtCheck = 'cross_orange';
    
	/**
	* Service Installed 
	*
	* @author KnowledgeTree Team
	* @access private
	* @var array
	*/
    private $serviceCheck = 'tick';
    
	/**
	* Flag to store class information in session
	*
	* @author KnowledgeTree Team
	* @access public
	* @var boolean
	*/
    protected $storeInSession = true;
    
	/**
	* List of variables to be loaded to template
	*
	* @author KnowledgeTree Team
	* @access public
	* @var array
	*/
    protected $temp_variables;
    
	/**
	* Flag if step needs to run silently
	*
	* @author KnowledgeTree Team
	* @access public
	* @var array
	*/
    protected $silent = true;
    
	/**
	* Flag if bridge extension needs to be disabled
	*
	* @author KnowledgeTree Team
	* @access public
	* @var boolean
	*/
    private $disableExtension = false;
    
	/**
	* Flag, if java is specified and an error has been encountered
	*
	* @author KnowledgeTree Team
	* @access public
	* @var mixed
	*/
    private $javaExeError = '';
    
	/**
	* Holds path error, if java is specified
	*
	* @author KnowledgeTree Team
	* @access public
	* @var mixed
	*/
    private $javaExeMessage = '';
    
	/**
	* Holds path error, if php is specified
	*
	* @author KnowledgeTree Team
	* @access public
	* @var mixed
	*/
    private $phpExeError = '';
	/**
	* Constructs services object
	*
	* @author KnowledgeTree Team
	* @access public
	* @param none
 	*/
    public function __construct() {
    	$this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent);
    	$this->util = new InstallUtil();
    }
    
	/**
	* Main control of services setup
	*
	* @author KnowledgeTree Team
	* @param none
	* @access public
	* @return string
	*/
    public function doStep()
    {
    	if(!$this->inStep("services")) {
    		$this->doRun();
    		return 'landing';
    	}
        if($this->next()) {
	        // Check dependencies
	        $passed = $this->doRun();
	        $serv = $this->getDataFromSession("services");
//	        var_dump($conf);
//	        die;
            if($passed || $serv['providedJava'])
                return 'next';
            else
                return 'error';
        } else if($this->previous()) {
            return 'previous';
        }
        
        $passed = $this->doRun();
        return 'landing';
    }
    
	/**
	* Get service names
	*
	* @author KnowledgeTree Team
	* @param none
	* @access public
	* @return array
	*/
    public function getServices() {
    	return $this->services;
    }
    
	/**
	* Check if java executable was found
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return array
	*/
    private function setJava() {
		if($this->java != '') { // Java JRE Found
			$this->javaCheck = 'tick';
			$this->javaInstalled();
			$this->temp_variables['java']['location'] = $this->java;
		}
    }
    
    /**
	* Run step
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return boolean
	*/
    private function doRun() {
    	if($this->alreadyInstalled()) {
    		$this->alreadyInstalled = true;
    		$this->serviceCheck = 'tick';
    	} else {
	    	$this->php = $this->util->getPhp(); // Get java, if it exists
	    	$this->java = $this->util->getJava(); // Get java, if it exists
	    	$this->soffice = $this->util->getOpenOffice(); // Get java, if it exists
	    	$passedPhp = $this->phpChecks(); // Run Java Pre Checks
	    	$passedJava = $this->javaChecks(); // Run Java Pre Checks
	    	$passedOpenOffice = $this->openOfficeChecks(); // Run Java Pre Checks
	    	$errors = $this->getErrors(); // Get errors
			if(empty($errors) && $passedJava && $passedPhp && $passedOpenOffice) { // Install Service if there is no errors
				$this->installServices();
			} elseif ($passedPhp) { // Install Scheduler
				$this->installService('Scheduler');
			} elseif ($passedJava) { // Install Lucene
				$this->installService('Lucene');
			} elseif ($passedOpenOffice) { //Install OpenOffice
				$this->installService('OpenOffice');
			} else { // All Services not installed
				// TODO: What todo now?
			}
    	}
		$this->checkServiceStatus();
		$this->storeSilent(); // Store info needed for silent mode
		if(!empty($errors))
			return false;
		return true;
    }
    
	/**
	* A final check to see if services are still running,
	* incase they switched on and turned off.
	* 
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
	*/
    private function checkServiceStatus() {
    	$serverDetails = $this->getServices();
		foreach ($serverDetails as $serviceName) {
			$className = OS.$serviceName;
			$service = new $className();
			$status = $this->serviceStatus($service);
			if($status != 'STARTED') {
				$msg = $service->getName()." Could not be added as a Service";
				$this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg);
				$this->serviceCheck = 'cross_orange';
				$this->warnings[] = $msg;
			} else {
				if(WINDOWS_OS) {
					$this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); }
				else {
					$this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service");
				}
			}
		}
    }
    
	/**
	* Checks if all services have been started already, 
	* incase the user lands on service page multiple times
	* 
	* @author KnowledgeTree Team
	* @param none
	* @access public
	* @return boolean
	*/
    public function alreadyInstalled() {
    	$installed = true;
    	$serverDetails = $this->getServices();
		foreach ($serverDetails as $serviceName) {
			$className = OS.$serviceName;
			$service = new $className();
			$status = $this->serviceStatus($service);
			if(!$status) {
				return false;
			}
		}
		return true;
    }
    
    
    /**
	* Do some basic checks to help the user overcome java problems
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return boolean
	*/
    private function javaChecks() {
		$this->zendBridgeNotInstalled(); // Set bridge not installed
		$this->javaVersionInCorrect(); // Set version to incorrect
		$this->javaNotInstalled(); // Set java to not installed
		$this->setJava(); // Check if java has been auto detected
    	if($this->util->javaSpecified()) {
    		$this->disableExtension = true; // Disable the use of the php bridge extension
    		if($this->detSettings(true)) { // AutoDetect java settings
    			return true;
    		} else {
    			$this->specifyJava(); // Ask for settings
    		}
    	} else {
    		$auto = $this->useBridge(); // Use Bridge to get java settings
    		if($auto) {
				return $auto;
    		} else {
    			$auto = $this->useDetected(); // Check if auto detected java works
    			if($auto) {
    				$this->disableExtension = true; // Disable the use of the php bridge extension
    				return $auto;
    			} else {
					$this->specifyJava(); // Ask for settings
    			}
    		}
			return $auto;
    	}
    }
	
	/**
	* Attempt detection without logging errors
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return boolean
	*/
    private function useDetected() {
    	return $this->detSettings();
    }
    
    private function specifyJava() {
    	$this->javaExeError = true;
    }
    
    private function specifyPhp() {
    	$this->phpExeError = true;
    }
    
    private function phpChecks() {
    	// TODO: Better detection
    	return true;
    	$this->setPhp();
    	if($this->util->phpSpecified()) {
			return $this->detPhpSettings();
    	} else {
    		$this->specifyPhp();// Ask for settings
			return false;
    	}
    }
    
    private function openOfficeChecks() {
    	return true;
    }
    
    /**
	* Attempts to use user input and configure java settings
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return boolean
	*/
    private function detSettings($attempt = false) {
    	$javaExecutable = $this->util->javaSpecified();// Retrieve java bin
    	$cmd = "$javaExecutable -version > output/outJV 2>&1 echo $!";
    	$response = $this->util->pexec($cmd);
    	if(file_exists(OUTPUT_DIR.'outJV')) {
    		$tmp = file_get_contents(OUTPUT_DIR.'outJV');
    		preg_match('/"(.*)"/',$tmp, $matches);
    		if($matches) {
	    		if($matches[1] < $this->javaVersion) { // Check Version of java
					$this->javaVersionInCorrect();
					$this->javaCheck = 'cross';
					$this->error[] = "Requires Java 1.5+ to be installed";
					
					return false;
	    		} else {
					$this->javaVersionCorrect();
					$this->javaInstalled();
					$this->javaCheck = 'tick';
					$this->providedJava = true;
					
					return true;
	    		}
    		} else {
    			$this->javaVersionWarning();
    			$this->javaCheck = 'cross_orange';
    			if($attempt) {
	    			$this->javaExeMessage = "Incorrect java path specified";
	    			$this->javaExeError = true;
	    			$this->error[] = "Requires Java 1.5+ to be installed";
    			}
				
				
				return false;
    		}
    	}
    	
		$this->javaVersionInCorrect();
		$this->javaCheck = 'cross';
		$this->error[] = "Requires Java 1.5+ to be installed";
    	return false;
    }
    
    function detPhpSettings() {
    	// TODO: Better php handling
    	return true;
    	$phpExecutable = $this->util->phpSpecified();// Retrieve java bin
    	$cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!";
    	$response = $this->util->pexec($cmd);
    	if(file_exists(OUTPUT_DIR.'outPHP')) {
    		$tmp = file_get_contents(OUTPUT_DIR.'outPHP');
    		preg_match('/PHP/',$tmp, $matches);
    		if($matches) {
				$this->phpCheck = 'tick';
				
				return true;
    		} else {
    			$this->phpCheck = 'cross_orange';
    			$this->phpExeError = "PHP : Incorrect path specified";
				$this->error[] = "PHP executable required";
				
				return false;
    		}
    	}
    }
    /**
	* Attempts to use bridge and configure java settings
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return boolean
	*/
    private function useBridge() {
		$zendBridge = $this->zendBridge(); // Find Zend Bridge
		if($zendBridge) { // Bridge installed implies java exists
			$this->zendBridgeInstalled();
			if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional
				$this->javaExtCheck = 'tick'; // Set bridge to functional
		    	$this->javaInstalled(); // Set java to installed
	    		$javaSystem = new Java('java.lang.System');
		    	$version = $javaSystem->getProperty('java.version');
		    	$ver = substr($version, 0, 3);
		    	if($ver < $this->javaVersion) {
					$this->javaVersionInCorrect();
					$this->error[] = "Requires Java 1.5+ to be installed";
					return false;
		    	} else {
					$this->javaVersionCorrect(); // Set version to correct
					$this->javaCheck = 'tick';
					return true;
		    	}
			} else {
				$this->javaCheck = 'cross_orange';
				$this->javaVersionWarning();
				$this->zendBridgeWarning();
				$this->warnings[] = "Zend Java Bridge Not Functional";
				$this->javaExtCheck = 'cross_orange';
				return false;
			}
		} else {
			$this->warnings[] = "Zend Java Bridge Not Found";
			return false;
		}
    }
    
    /**
	* Check if Zend Bridge is enabled
	*
	* @author KnowledgeTree Team
	* @param none
	* @access public
	* @return boolean
	*/
    public function zendBridge() {
		$mods = get_loaded_extensions();
		if(in_array('Zend Java Bridge', $mods)) 
			return true;
		else 
			return false;
    }
    
    /**
	* Check if Zend Bridge is functional
	*
	* @author KnowledgeTree Team
	* @param none
	* @access public
	* @return boolean
	*/
    public function checkZendBridge() {
    	if($this->util->javaBridge()) { // Check if java bridge is functional
			return true;
    	} else {
			return false;
    	}    	
    }
    
    
    /**
	* Installs services
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return boolean
	*/
    private function installServices() {
		foreach ($this->getServices() as $serviceName) {
			$this->installService($serviceName);
		}
		
		return true;
    }

    /**
	* Installs services helper
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return boolean
	*/
    private function installService($serviceName) {
		$className = OS.$serviceName;
		$service = new $className();
		$status = $this->serviceHelper($service);
		if (!$status) {
			$this->serviceCheck = 'cross_orange';
		}
    }
    
   	/**
	* Installs services
	*
	* @author KnowledgeTree Team
	* @param object
	* @access private
	* @return string
	*/
	private function serviceHelper($service) {
		$service->load(); // Load Defaults
		$response = $service->install(); // Install service
		$statusCheck = OS."ServiceInstalled";
		return $this->$statusCheck($service);
	}
	
   	/**
	* Returns service status
	*
	* @author KnowledgeTree Team
	* @param object
	* @access private
	* @return string
	*/
	private function serviceStatus($service) {
		$statusCheck = OS."ServiceInstalled";
		return $this->$statusCheck($service);
	}
	
   	/**
	* Check if windows service installed
	*
	* @author KnowledgeTree Team
	* @param object
	* @access public
	* @return boolean
	*/
	public function windowsServiceInstalled($service) {
		$status = $service->status(); // Check if service has been installed
		if($status == '') { // Check service status
			return false;
		}
		return true;
	}
	
   	/**
	* Check if unix service installed
	*
	* @author KnowledgeTree Team
	* @param object
	* @access public
	* @return boolean
	*/
	public function unixServiceInstalled($service) {
		$status = $service->status(); // Check if service has been installed
		if($status != 'STARTED') { // Check service status
			return false;
		}
		return true;
	}
	
   	/**
	* Starts all services
	*
	* @author KnowledgeTree Team
	* @param object
	* @access public
	* @return mixed
	*/
	public function installStep() {
		foreach ($this->getServices() as $serviceName) {
			$className = OS.$serviceName;
			$service = new $className();
			$status = $this->serviceStart($service);
		}
		return true;
	}
	
   	/**
	* Starts service
	*
	* @author KnowledgeTree Team
	* @param object
	* @access private
	* @return string
	*/
	private function serviceStart($service) {
		if(OS == 'windows') {
			$service->load(); // Load Defaults
			$service->start(); // Start Service
			return $service->status(); // Get service status
		}
	}
	
	/**
	* Returns services errors
	*
	* @author KnowledgeTree Team
	* @access public
	* @params none
	* @return array
	*/
    public function getErrors() {
        return $this->error;
    }
    
	/**
	* Returns services warnings
	*
	* @author KnowledgeTree Team
	* @access public
	* @params none
	* @return array
	*/
    public function getWarnings() {
        return $this->warnings;
    }
    
	/**
	* Get the variables to be passed to the template
	*
	* @author KnowledgeTree Team
	* @access public
	* @return array
	*/
    public function getStepVars()
    {
        return $this->temp_variables;
    }
    
	/**
	* Store Java state as installed
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
	*/
    private function javaInstalled() {
		$this->temp_variables['java']['class'] = 'tick';
		$this->temp_variables['java']['found'] = "Java Runtime Installed";
    }
    
	/**
	* Store Java state as not installed
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
	*/
    private function javaNotInstalled() {
		$this->temp_variables['java']['class'] = 'cross';
		$this->temp_variables['java']['found'] = "Java runtime environment required";
    }
    
	/**
	* Store Java version state as correct
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
	*/
    private function javaVersionCorrect() {
		$this->temp_variables['version']['class'] = 'tick';
		$this->temp_variables['version']['found'] = "Java Version 1.5+ Installed";
    }
    
	/**
	* Store Java version state as warning
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
	*/
    private function javaVersionWarning() {
		$this->temp_variables['version']['class'] = 'cross_orange';
		$this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected";
    }
    
	/**
	* Store Java version as state incorrect
	*
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
	*/
    private function javaVersionInCorrect() {
		$this->temp_variables['version']['class'] = 'cross';
		$this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed";
    }
    
	/**
    * Store Zend Bridge state as installed
    *
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
    */
    private function zendBridgeInstalled() {
		$this->temp_variables['extensions']['class'] = 'tick';
		$this->temp_variables['extensions']['found'] = "Java Bridge Installed";
    }
    
	/**
    * Store Zend Bridge state as not installed
    * 
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
    */
    private function zendBridgeNotInstalled() {
		$this->temp_variables['extensions']['class'] = 'cross_orange';
		$this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed";
    }
    
   	/**
    * Store Zend Bridge state as warning
    *
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
    */
    private function zendBridgeWarning() {
		$this->temp_variables['extensions']['class'] = 'cross_orange';
		$this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional";
    }
    
   	/**
    * Set all silent mode varibles
    *
	* @author KnowledgeTree Team
	* @param none
	* @access private
	* @return void
    */
    private function storeSilent() {
    	$this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
    	$this->temp_variables['luceneInstalled'] = $this->luceneInstalled;
    	$this->temp_variables['schedulerInstalled'] = $this->schedulerInstalled;
		$this->temp_variables['javaExeError'] = $this->javaExeError;
		$this->temp_variables['javaExeMessage'] = $this->javaExeMessage;
		$this->temp_variables['javaCheck'] = $this->javaCheck;
		$this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
		// TODO : PHP detection
		$this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck;
		$this->temp_variables['phpExeError'] = '';//$this->phpExeError;
		$this->temp_variables['serviceCheck'] = $this->serviceCheck;
		$this->temp_variables['disableExtension'] = $this->disableExtension;
		// TODO: Java checks are gettign intense
		$this->temp_variables['providedJava'] = $this->providedJava;
    }

    private function setPhp() {
		if($this->php != '') { // PHP Found
			$this->phpCheck = 'tick';
		} elseif (PHP_DIR != '') { // Use System Defined Settings
			$this->php = PHP_DIR;
		} else {

		}
		$this->temp_variables['php']['location'] = $this->php;
    }
	
	public function getPhpDir() {
		return $this->php;
	}
}
?>