diff options
Diffstat (limited to 'engine')
| -rw-r--r-- | engine/lib/database.php | 21 | ||||
| -rw-r--r-- | engine/lib/elgglib.php | 2 | ||||
| -rw-r--r-- | engine/lib/install.php | 34 | 
3 files changed, 56 insertions, 1 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php index 9df5f991c..86044a375 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -408,6 +408,27 @@          		throw new DatabaseException(sprintf(elgg_echo('DatabaseException:ScriptNotFound'), $scriptlocation));
          	}
 +        } +         +        /** +         * This function, called by validate_platform(), will check whether the installed version of +         * MySQL meets the minimum required. +         * +         * TODO: If multiple dbs are supported check which db is supported and use the appropriate code to validate +         * the appropriate version. +         *  +         * @return bool +         */ +        function db_check_version() +        { +        	$version = mysql_get_server_info(); +        	 +        	$points = explode('.', $version); +        	 +        	if ($points[0] < 5) +        		return false; + +        	return true;          }
  	/**
 diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 1358b84fc..8da54f10d 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -195,7 +195,7 @@  		    } else {
  		    	$vars['page_owner'] = -1;
  		    }
 -		    if ($vars['page_owner'] != -1) {
 +		    if (($vars['page_owner'] != -1) && (is_installed())) {
  		        if (!isset($usercache[$vars['page_owner']])) {
  		    	       $vars['page_owner_user'] = get_entity($vars['page_owner']);
  		    	       $usercache[$vars['page_owner']] = $vars['page_owner_user'];
 diff --git a/engine/lib/install.php b/engine/lib/install.php index ca615c473..c0ed7ab91 100644 --- a/engine/lib/install.php +++ b/engine/lib/install.php @@ -11,6 +11,40 @@  	 * @copyright Curverider Ltd 2008
  	 * @link http://elgg.org/
  	 */
 + +		/** +		 * Check that the installed version of PHP meets the minimum requirements (currently 5.2 or greater). +		 *  +		 * @return bool +		 */ +		function php_check_version() +		{ +			if (version_compare(phpversion(), '5.2.0', '>=')) +				return true; +				 +			return false; +		} +	 +		/** +		 * Validate the platform Elgg is being installed on. +		 * +		 * @throws ConfigurationException if the validation fails. +		 * @return bool +		 */ +		function validate_platform() +		{ +			// Get database version +			if (!db_check_version()) +				throw new ConfigurationException(elgg_echo('ConfigurationException:BadDatabaseVersion')); +			 +			// Now check PHP +			if (!php_check_version()) +				throw new ConfigurationException(elgg_echo('ConfigurationException:BadPHPVersion')); +				 +			// TODO: Consider checking for installed modules etc +				 +			return true; +		}  	/**
  	 * Returns whether or not the database has been installed
  | 
