/**
	 * Call to check for updates as part of the health checking system in Core.
	 * 
	 * @return array
	 */
	public static function _HealthCheckHook(){
		// SERVER_ADMIN_EMAIL
		
		$checks      = [];
		$updateSites = UpdateSiteModel::Find();
		$updates     = UpdaterHelper::GetUpdates();
		
		// Scan through the update sites and ensure that they are available and set.
		if(!sizeof($updateSites)){
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_UPDATER_NO_UPDATE_SITES'),
				t('MESSAGE_WARNING_UPDATER_NO_UPDATE_SITES'),
				'/updater'
			);
		}
		else{
			foreach($updateSites as $site){
				/** @var UpdateSiteModel $site */
				if($site->isValid()){
					$checks[] = \Core\HealthCheckResult::ConstructGood(
						t('STRING_SUCCESS_UPDATER_SITE_S_OK', $site->get('url')),
						t('MESSAGE_SUCCESS_UPDATER_SITE_S_OK', $site->get('url'))
					);
				}
				else{
					$checks[] = \Core\HealthCheckResult::ConstructError(
						t('STRING_ERROR_UPDATER_SITE_S_OK', $site->get('url')),
						t('MESSAGE_ERROR_UPDATER_SITE_S_OK', $site->get('url')),
						'/updater'
					);
				}
			}
		}
		
		if(isset($updates['core'])){
			// This should always be set, but who knows...
			if($updates['core']['status'] == 'update'){
				$checks[] = \Core\HealthCheckResult::ConstructWarn(
					t('STRING_WARNING_UPDATER_CORE_OUTDATED'),
					t('MESSAGE_WARNING_UPDATER_CORE_OUTDATED_S_AVAILABLE', $updates['core']['version']),
					'/updater'
				);
			}
			elseif($updates['core']['status'] == 'installed'){
				$checks[] = \Core\HealthCheckResult::ConstructGood(
					t('STRING_SUCCESS_UPDATER_CORE_OUTDATED'),
					t('MESSAGE_SUCCESS_UPDATER_CORE_OUTDATED_S_AVAILABLE', $updates['core']['version'])
				);
			}
		}
		
		foreach($updates['components'] as $dat){
			if($dat['status'] == 'update'){
				$checks[] = \Core\HealthCheckResult::ConstructWarn(
					t('STRING_WARNING_UPDATER_COMPONENT_S_OUTDATED', $dat['title']),
					t('MESSAGE_WARNING_UPDATER_COMPONENT_S_OUTDATED_S_AVAILABLE', $dat['title'], $dat['version']),
					'/updater'
				);
			}
			elseif($dat['status'] == 'installed'){
				$checks[] = \Core\HealthCheckResult::ConstructGood(
					t('STRING_SUCCESS_UPDATER_COMPONENT_S_OUTDATED', $dat['title']),
					t('MESSAGE_SUCCESS_UPDATER_COMPONENT_S_OUTDATED_S_AVAILABLE', $dat['title'], $dat['version'])
				);
			}
		}

		foreach($updates['themes'] as $dat){
			if($dat['status'] == 'update'){
				$checks[] = \Core\HealthCheckResult::ConstructWarn(
					t('STRING_WARNING_UPDATER_THEME_S_OUTDATED', $dat['title']),
					t('MESSAGE_WARNING_UPDATER_THEME_S_OUTDATED_S_AVAILABLE', $dat['title'], $dat['version']),
					'/updater'
				);
			}
			elseif($dat['status'] == 'installed'){
				$checks[] = \Core\HealthCheckResult::ConstructGood(
					t('STRING_SUCCESS_UPDATER_THEME_S_OUTDATED', $dat['title']),
					t('MESSAGE_SUCCESS_UPDATER_THEME_S_OUTDATED_S_AVAILABLE', $dat['title'], $dat['version'])
				);
			}
		}
		
		return $checks;
	}
	/**
	 * Call to check some of the core requirements on Core, such as file permissions and the like.
	 *
	 * @return array
	 */
	public static function _HealthCheckHook(){

		$checks      = [];

		if(version_compare(phpversion(), '5.5.0', '<')){
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_PHP_S_TOO_OLD', phpversion()),
				t('MESSAGE_WARNING_PHP_S_TOO_OLD', phpversion()),
				''
			);
		}
		else{
			$checks[] = \Core\HealthCheckResult::ConstructGood(
				t('STRING_CHECK_PHP_S_OK', phpversion()),
				t('MESSAGE_SUCCESS_PHP_S_OK', phpversion())
			);
		}

		$dir = ROOT_PDIR . 'logs/';
		if(is_dir($dir) && is_writable($dir)){
			// Yay, everything is good here!
			$checks[] = \Core\HealthCheckResult::ConstructGood(
				t('STRING_CHECK_LOG_DIRECTORY_S_OK', $dir),
				t('MESSAGE_SUCCESS_LOG_DIRECTORY_S_OK', $dir)
			);
		}
		elseif(is_dir($dir)){
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_LOG_DIRECTORY_S_NOT_WRITABLE', $dir),
				t('MESSAGE_WARNING_LOG_DIRECTORY_S_NOT_WRITABLE', $dir),
				''
			);
		}
		else{
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_LOG_DIRECTORY_S_DOES_NOT_EXIST', $dir),
				t('MESSAGE_WARNING_LOG_DIRECTORY_S_DOES_NOT_EXIST', $dir),
				''
			);
		}

		$dir = ROOT_PDIR;
		if(is_dir($dir) && is_writable($dir)){
			// Yay, everything is good here!
			$checks[] = \Core\HealthCheckResult::ConstructGood(
				t('STRING_CHECK_ROOT_DIRECTORY_S_OK', $dir),
				t('MESSAGE_SUCCESS_ROOT_DIRECTORY_S_OK', $dir)
			);
		}
		elseif(is_dir($dir)){
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_ROOT_DIRECTORY_S_NOT_WRITABLE', $dir),
				t('MESSAGE_WARNING_ROOT_DIRECTORY_S_NOT_WRITABLE', $dir),
				''
			);
		}
		else{
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_ROOT_DIRECTORY_S_DOES_NOT_EXIST', $dir),
				t('MESSAGE_WARNING_ROOT_DIRECTORY_S_DOES_NOT_EXIST', $dir),
				''
			);
		}

		$dir = \Core\Filestore\Factory::Directory('public/');
		if($dir->exists() && $dir->isWritable()){
			// Yay, everything is good here!
			$checks[] = \Core\HealthCheckResult::ConstructGood(
				t('STRING_CHECK_PUBLIC_DIRECTORY_S_OK', $dir->getPath()),
				t('MESSAGE_SUCCESS_PUBLIC_DIRECTORY_S_OK', $dir->getPath())
			);
		}
		elseif($dir->exists()){
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_PUBLIC_DIRECTORY_S_NOT_WRITABLE', $dir->getPath()),
				t('MESSAGE_WARNING_PUBLIC_DIRECTORY_S_NOT_WRITABLE', $dir->getPath()),
				''
			);
		}
		else{
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_PUBLIC_DIRECTORY_S_DOES_NOT_EXIST', $dir->getPath()),
				t('MESSAGE_WARNING_PUBLIC_DIRECTORY_S_DOES_NOT_EXIST', $dir->getPath()),
				''
			);
		}

		$dir = \Core\Filestore\Factory::Directory('assets/');
		if($dir->exists() && $dir->isWritable()){
			// Yay, everything is good here!
			$checks[] = \Core\HealthCheckResult::ConstructGood(
				t('STRING_CHECK_ASSET_DIRECTORY_S_OK', $dir->getPath()),
				t('MESSAGE_SUCCESS_ASSET_DIRECTORY_S_OK', $dir->getPath())
			);
		}
		elseif($dir->exists()){
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_ASSET_DIRECTORY_S_NOT_WRITABLE', $dir->getPath()),
				t('MESSAGE_WARNING_ASSET_DIRECTORY_S_NOT_WRITABLE', $dir->getPath()),
				''
			);
		}
		else{
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_ASSET_DIRECTORY_S_DOES_NOT_EXIST', $dir->getPath()),
				t('MESSAGE_WARNING_ASSET_DIRECTORY_S_DOES_NOT_EXIST', $dir->getPath()),
				''
			);
		}
		
		if(defined('SERVER_ID') && strlen(SERVER_ID) == 32){
			$checks[] = \Core\HealthCheckResult::ConstructGood(
				t('STRING_CHECK_SERVER_ID_IS_S', wordwrap(SERVER_ID, 4, '-', true)),
				t('MESSAGE_SUCCESS_CHECK_SERVER_ID_IS_S', wordwrap(SERVER_ID, 4, '-', true))
			);
		}
		else{
			$checks[] = \Core\HealthCheckResult::ConstructWarn(
				t('STRING_CHECK_SERVER_ID_NOT_VALID'),
				t('MESSAGE_ERROR_CHECK_SERVER_ID_NOT_VALID'),
				'/admin/serverid'
			);
		}
		
		foreach(Core::GetComponents() as $c){
			/** @var Component_2_1 $c */
			
			$rc = $c->runRequirementChecks();
			
			foreach($rc as $result){
				$m = $c->getName() . ': ' . $result['result']['message'];
				if($result['result']['passed']){
					if($result['result']['available'] !== true){
						$m .= ' (' . $result['result']['available'] . ')';
					}
					$checks[] = \Core\HealthCheckResult::ConstructGood($m, '');
				}
				else{
					$checks[] = \Core\HealthCheckResult::ConstructWarn($m, '', '');
				}
			}
		}
		

		return $checks;
	}