";
- }
- }
- }
-
- /**
- * @param string $funcName
- * @param $testDetails
- *
- * @return bool
- */
- public function requireFunction($funcName, $testDetails) {
- $this->testing($testDetails);
-
- if (!function_exists($funcName)) {
- $this->error($testDetails);
- return FALSE;
- }
- else {
- return TRUE;
- }
- }
-
- /**
- * @param $testDetails
- */
- public function checkXCache($testDetails) {
- if (function_exists('xcache_isset') &&
- ini_get('xcache.size') > 0
- ) {
- $this->testing($testDetails);
- $this->warning($testDetails);
- }
- }
-
- /**
- * @param array $testDetails
- * @return bool
- */
- public function requirePHPVersion($testDetails) {
-
- $this->testing($testDetails);
-
- $phpVersion = phpversion();
- $aboveMinVersion = version_compare($phpVersion, CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER) >= 0;
-
- if ($aboveMinVersion) {
- if (version_compare($phpVersion, CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER) < 0) {
- $testDetails[2] = ts('This webserver is running an outdated version of PHP (%1). It is strongly recommended to upgrade to PHP %2 or later, as older versions can present a security risk. The preferred version is %3.', [
- 1 => $phpVersion,
- 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER,
- 3 => preg_replace(';^(\d+\.\d+(?:\.[1-9]\d*)?).*$;', '\1', CRM_Upgrade_Incremental_General::RECOMMENDED_PHP_VER),
- ]);
- $this->warning($testDetails);
- }
- return TRUE;
- }
-
- if (empty($testDetails[2])) {
- $testDetails[2] = ts("You need PHP version %1 or later, only %2 is installed. Please upgrade your server, or ask your web-host to do so.", [1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER, 2 => $phpVersion]);
- }
-
- $this->error($testDetails);
- }
-
- /**
- * @param string $filename
- * @param $testDetails
- * @param bool $absolute
- */
- public function requireFile($filename, $testDetails, $absolute = FALSE) {
- $this->testing($testDetails);
- if (!$absolute) {
- $filename = $this->getBaseDir() . $filename;
- }
- if (!file_exists($filename)) {
- $testDetails[2] .= " (" . ts("file '%1' not found", [1 => $filename]) . ')';
- $this->error($testDetails);
- }
- }
-
- /**
- * @param $testDetails
- */
- public function requireNoPathSeparator($testDetails) {
- $this->testing($testDetails);
- if (substr_count($this->getBaseDir(), PATH_SEPARATOR)) {
- $this->error($testDetails);
- }
- }
-
- /**
- * @param string $filename
- * @param $testDetails
- */
- public function requireNoFile($filename, $testDetails) {
- $this->testing($testDetails);
- $filename = $this->getBaseDir() . $filename;
- if (file_exists($filename)) {
- $testDetails[2] .= " (" . ts("file '%1' found", [1 => $filename]) . ")";
- $this->error($testDetails);
- }
- }
-
- /**
- * @param string $filename
- * @param $testDetails
- */
- public function moveFileOutOfTheWay($filename, $testDetails) {
- $this->testing($testDetails);
- $filename = $this->getBaseDir() . $filename;
- if (file_exists($filename)) {
- if (file_exists("$filename.bak")) {
- rm("$filename.bak");
- }
- rename($filename, "$filename.bak");
- }
- }
-
- /**
- * @param string $filename
- * @param $testDetails
- * @param bool $absolute
- */
- public function requireWriteable($filename, $testDetails, $absolute = FALSE) {
- $this->testing($testDetails);
- if (!$absolute) {
- $filename = $this->getBaseDir() . $filename;
- }
-
- if (!is_writable($filename)) {
- $name = NULL;
- if (function_exists('posix_getpwuid')) {
- $user = posix_getpwuid(posix_geteuid());
- $name = '- ' . $user['name'] . ' -';
- }
-
- if (!isset($testDetails[2])) {
- $testDetails[2] = NULL;
- }
- $testDetails[2] .= ts("The user account used by your web-server %1 needs to be granted write access to the following directory in order to configure the CiviCRM settings file:", [1 => $name]) . "\n$filename";
- $this->error($testDetails);
- }
- }
-
- /**
- * @param string $moduleName
- * @param $testDetails
- */
- public function requireApacheModule($moduleName, $testDetails) {
- $this->testing($testDetails);
- if (!in_array($moduleName, apache_get_modules())) {
- $this->error($testDetails);
- }
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $testDetails
- */
- public function requireMysqlConnection($server, $username, $password, $testDetails) {
- $this->testing($testDetails);
- $this->conn = $this->connect($server, $username, $password);
-
- if ($this->conn) {
- return TRUE;
- }
- else {
- $testDetails[2] .= ": " . mysqli_connect_error();
- $this->error($testDetails);
- }
- }
-
- /**
- * @param $server
- * @param $testDetails
- */
- public function requireMySQLServer($server, $testDetails) {
- $this->testing($testDetails);
- $conn = $this->connect($server, NULL, NULL);
-
- if ($conn || mysqli_connect_errno() < 2000) {
- return TRUE;
- }
- else {
- $testDetails[2] .= ": " . mysqli_connect_error();
- $this->error($testDetails);
- }
- }
-
- /**
- * @param $version
- * @param $testDetails
- */
- public function requireMySQLVersion($version, $testDetails) {
- $this->testing($testDetails);
-
- if (!mysqli_get_server_info($this->conn)) {
- $testDetails[2] = ts('Cannot determine the version of MySQL installed. Please ensure at least version %1 is installed.', [1 => $version]);
- $this->warning($testDetails);
- }
- else {
- list($majorRequested, $minorRequested) = explode('.', $version);
- list($majorHas, $minorHas) = explode('.', mysqli_get_server_info($this->conn));
-
- if (($majorHas > $majorRequested) || ($majorHas == $majorRequested && $minorHas >= $minorRequested)) {
- return TRUE;
- }
- else {
- $versionDetails = mysqli_query($this->conn, 'SELECT version() as version')->fetch_assoc();
- if (version_compare($versionDetails['version'], $version) == -1) {
- $testDetails[2] .= "{$majorHas}.{$minorHas}.";
- $this->error($testDetails);
- }
- else {
- return TRUE;
- }
- }
- }
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $database
- * @param $testDetails
- */
- public function requireMySQLInnoDB($server, $username, $password, $database, $testDetails) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
- if (!$conn) {
- $testDetails[2] .= ' ' . ts("Could not determine if MySQL has InnoDB support. Assuming no.");
- $this->error($testDetails);
- return;
- }
-
- $innodb_support = FALSE;
- $result = mysqli_query($conn, "SHOW ENGINES");
- while ($values = mysqli_fetch_array($result)) {
- if ($values['Engine'] == 'InnoDB') {
- if (strtolower($values['Support']) == 'yes' ||
- strtolower($values['Support']) == 'default'
- ) {
- $innodb_support = TRUE;
- }
- }
- }
- if ($innodb_support) {
- $testDetails[3] = ts('MySQL server does have InnoDB support');
- }
- else {
- $testDetails[2] .= ' ' . ts('Could not determine if MySQL has InnoDB support. Assuming no');
- }
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $database
- * @param $testDetails
- */
- public function requireMySQLTempTables($server, $username, $password, $database, $testDetails) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
- if (!$conn) {
- $testDetails[2] = ts('Could not login to the database.');
- $this->error($testDetails);
- return;
- }
-
- if (!@mysqli_select_db($conn, $database)) {
- $testDetails[2] = ts('Could not select the database.');
- $this->error($testDetails);
- return;
- }
-
- $tempTableName = CRM_Utils_SQL_TempTable::build()->setCategory('install')->getName();
- $result = mysqli_query($conn, 'CREATE TEMPORARY TABLE ' . $tempTableName . ' (test text)');
- if (!$result) {
- $testDetails[2] = ts('Could not create a temp table.');
- $this->error($testDetails);
- }
- $result = mysqli_query($conn, 'DROP TEMPORARY TABLE ' . $tempTableName);
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $database
- * @param $testDetails
- */
- public function requireMySQLTrigger($server, $username, $password, $database, $testDetails) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
- if (!$conn) {
- $testDetails[2] = ts('Could not login to the database.');
- $this->error($testDetails);
- return;
- }
-
- if (!@mysqli_select_db($conn, $database)) {
- $testDetails[2] = ts('Could not select the database.');
- $this->error($testDetails);
- return;
- }
-
- $result = mysqli_query($conn, 'CREATE TABLE civicrm_install_temp_table_test (test text)');
- if (!$result) {
- $testDetails[2] = ts('Could not create a table in the database.');
- $this->error($testDetails);
- }
-
- $result = mysqli_query($conn, 'CREATE TRIGGER civicrm_install_temp_table_test_trigger BEFORE INSERT ON civicrm_install_temp_table_test FOR EACH ROW BEGIN END');
- if (!$result) {
- mysqli_query($conn, 'DROP TABLE civicrm_install_temp_table_test');
- $testDetails[2] = ts('Could not create a database trigger.');
- $this->error($testDetails);
- }
-
- mysqli_query($conn, 'DROP TRIGGER civicrm_install_temp_table_test_trigger');
- mysqli_query($conn, 'DROP TABLE civicrm_install_temp_table_test');
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $database
- * @param $testDetails
- */
- public function requireMySQLLockTables($server, $username, $password, $database, $testDetails) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
- if (!$conn) {
- $testDetails[2] = ts('Could not connect to the database server.');
- $this->error($testDetails);
- return;
- }
-
- if (!@mysqli_select_db($conn, $database)) {
- $testDetails[2] = ts('Could not select the database.');
- $this->error($testDetails);
- return;
- }
-
- $tempTableName = CRM_Utils_SQL_TempTable::build()->setCategory('install')->getName();
- $result = mysqli_query($conn, 'CREATE TEMPORARY TABLE ' . $tempTableName . ' (test text)');
- if (!$result) {
- $testDetails[2] = ts('Could not create a table in the database.');
- $this->error($testDetails);
- return;
- }
-
- $result = mysqli_query($conn, 'LOCK TABLES ' . $tempTableName . ' WRITE');
- if (!$result) {
- $testDetails[2] = ts('Could not obtain a write lock for the database table.');
- $this->error($testDetails);
- $result = mysqli_query($conn, 'DROP TEMPORARY TABLE ' . $tempTableName);
- return;
- }
-
- $result = mysqli_query($conn, 'UNLOCK TABLES');
- if (!$result) {
- $testDetails[2] = ts('Could not release the lock for the database table.');
- $this->error($testDetails);
- $result = mysqli_query($conn, 'DROP TEMPORARY TABLE ' . $tempTableName);
- return;
- }
-
- $result = mysqli_query($conn, 'DROP TEMPORARY TABLE ' . $tempTableName);
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $testDetails
- */
- public function requireMySQLAutoIncrementIncrementOne($server, $username, $password, $testDetails) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
- if (!$conn) {
- $testDetails[2] = ts('Could not connect to the database server.');
- $this->error($testDetails);
- return;
- }
-
- $result = mysqli_query($conn, "SHOW variables like 'auto_increment_increment'");
- if (!$result) {
- $testDetails[2] = ts('Could not query database server variables.');
- $this->error($testDetails);
- return;
- }
- else {
- $values = mysqli_fetch_row($result);
- if ($values[1] == 1) {
- $testDetails[3] = ts('MySQL server auto_increment_increment is 1');
- }
- else {
- $this->error($testDetails);
- }
- }
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $database
- * @param $minValueKB
- * @param $testDetails
- */
- public function requireMySQLThreadStack($server, $username, $password, $database, $minValueKB, $testDetails) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
- if (!$conn) {
- $testDetails[2] = ts('Could not connect to the database server.');
- $this->error($testDetails);
- return;
- }
-
- if (!@mysqli_select_db($conn, $database)) {
- $testDetails[2] = ts('Could not select the database.');
- $this->error($testDetails);
- return;
- }
-
- // bytes => kb
- $result = mysqli_query($conn, "SHOW VARIABLES LIKE 'thread_stack'");
- if (!$result) {
- $testDetails[2] = ts('Could not get information about the thread_stack of the database.');
- $this->error($testDetails);
- }
- else {
- $values = mysqli_fetch_row($result);
- if ($values[1] < (1024 * $minValueKB)) {
- $testDetails[2] = ts('MySQL "thread_stack" is %1 kb', [1 => ($values[1] / 1024)]);
- $this->error($testDetails);
- }
- }
- }
-
- /**
- * @param $server
- * @param $username
- * @param $password
- * @param $database
- * @param $testDetails
- */
- public function requireNoExistingData(
- $server,
- $username,
- $password,
- $database,
- $testDetails
- ) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
-
- @mysqli_select_db($conn, $database);
- $contactRecords = mysqli_query($conn, "SELECT count(*) as contactscount FROM civicrm_contact");
- if ($contactRecords) {
- $contactRecords = mysqli_fetch_object($contactRecords);
- if ($contactRecords->contactscount > 0) {
- $this->error($testDetails);
- return;
- }
- }
-
- $testDetails[3] = ts('CiviCRM data from previous installation does not exist in %1.', [1 => $database]);
- $this->testing($testDetails);
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $database
- * @param $testDetails
- * @param bool $onlyRequire
- */
- public function requireDatabaseOrCreatePermissions(
- $server,
- $username,
- $password,
- $database,
- $testDetails,
- $onlyRequire = FALSE
- ) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
-
- $okay = NULL;
- if (@mysqli_select_db($conn, $database)) {
- $okay = "Database '$database' exists";
- }
- elseif ($onlyRequire) {
- $testDetails[2] = ts("The database: '%1' does not exist.", [1 => $database]);
- $this->error($testDetails);
- return;
- }
- else {
- $query = sprintf("CREATE DATABASE %s", mysqli_real_escape_string($conn, $database));
- if (@mysqli_query($conn, $query)) {
- $okay = ts("Able to create a new database.");
- }
- else {
- $testDetails[2] .= " (" . ts("user '%1' doesn't have CREATE DATABASE permissions.", [1 => $username]) . ")";
- $this->error($testDetails);
- return;
- }
- }
-
- if ($okay) {
- $testDetails[3] = $okay;
- $this->testing($testDetails);
- }
- }
-
- /**
- * @param $varNames
- * @param $errorMessage
- */
- public function requireServerVariables($varNames, $errorMessage) {
- //$this->testing($testDetails);
- foreach ($varNames as $varName) {
- if (!$_SERVER[$varName]) {
- $missing[] = '$_SERVER[' . $varName . ']';
- }
- }
- if (!isset($missing)) {
- return TRUE;
- }
- else {
- $testDetails[2] = " (" . ts('the following PHP variables are missing: %1', [1 => implode(", ", $missing)]) . ")";
- $this->error($testDetails);
- }
- }
-
- /**
- * @param $server
- * @param string $username
- * @param $password
- * @param $database
- * @param $testDetails
- */
- public function requireMysqlUtf8mb4($server, $username, $password, $database, $testDetails) {
- $this->testing($testDetails);
- $conn = $this->connect($server, $username, $password);
- if (!$conn) {
- $testDetails[2] = ts('Could not connect to the database server.');
- $this->error($testDetails);
- return;
- }
-
- if (!@mysqli_select_db($conn, $database)) {
- $testDetails[2] = ts('Could not select the database.');
- $this->error($testDetails);
- return;
- }
-
- $result = mysqli_query($conn, 'CREATE TABLE civicrm_utf8mb4_test (id VARCHAR(255), PRIMARY KEY(id(255))) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC ENGINE=INNODB');
- if (!$result) {
- $testDetails[2] = ts('It is recommended, though not yet required, to configure your MySQL server for utf8mb4 support. You will need the following MySQL server configuration: innodb_large_prefix=true innodb_file_format=barracuda innodb_file_per_table=true');
- $this->warning($testDetails);
- return;
- }
- $result = mysqli_query($conn, 'DROP TABLE civicrm_utf8mb4_test');
-
- // Ensure that the MySQL driver supports utf8mb4 encoding.
- $version = mysqli_get_client_info();
- if (strpos($version, 'mysqlnd') !== FALSE) {
- // The mysqlnd driver supports utf8mb4 starting at version 5.0.9.
- $version = preg_replace('/^\D+([\d.]+).*/', '$1', $version);
- if (version_compare($version, '5.0.9', '<')) {
- $testDetails[2] = 'It is recommended, though not yet required, to upgrade your PHP MySQL driver (mysqlnd) to >= 5.0.9 for utf8mb4 support.';
- $this->warning($testDetails);
- return;
- }
- }
- else {
- // The libmysqlclient driver supports utf8mb4 starting at version 5.5.3.
- if (version_compare($version, '5.5.3', '<')) {
- $testDetails[2] = 'It is recommended, though not yet required, to upgrade your PHP MySQL driver (libmysqlclient) to >= 5.5.3 for utf8mb4 support.';
- $this->warning($testDetails);
- return;
- }
- }
- }
-
- /**
- * @param $testDetails
- *
- * @return bool
- */
- public function isRunningApache($testDetails) {
- $this->testing($testDetails);
- if (function_exists('apache_get_modules') || stristr($_SERVER['SERVER_SIGNATURE'], 'Apache')) {
- return TRUE;
- }
-
- $this->warning($testDetails);
- return FALSE;
- }
-
- /**
- * @return string
- */
- public function getBaseDir() {
- return dirname($_SERVER['SCRIPT_FILENAME']) . CIVICRM_DIRECTORY_SEPARATOR;
- }
-
- /**
- * @param $testDetails
- */
- public function testing($testDetails) {
- if (!$testDetails) {
- return;
- }
-
- $section = $testDetails[0];
- $test = $testDetails[1];
-
- $message = ts("OK");
- if (isset($testDetails[3])) {
- $message .= " ($testDetails[3])";
- }
-
- $this->tests[$section][$test] = ["good", $message];
- }
-
- /**
- * @param $testDetails
- */
- public function error($testDetails) {
- $section = $testDetails[0];
- $test = $testDetails[1];
-
- $this->tests[$section][$test] = ["error", $testDetails[2]];
- $this->errors[] = $testDetails;
- }
-
- /**
- * @param $testDetails
- */
- public function warning($testDetails) {
- $section = $testDetails[0];
- $test = $testDetails[1];
-
- $this->tests[$section][$test] = ["warning", $testDetails[2]];
- $this->warnings[] = $testDetails;
- }
-
- /**
- * @return int
- */
- public function hasErrors() {
- return !empty($this->errors);
- }
-
- /**
- * @return int
- */
- public function hasWarnings() {
- return !empty($this->warnings);
- }
-
-}
-
-/**
- * Class Installer
- */
-class Installer extends InstallRequirements {
-
- /**
- * @param $server
- * @param $username
- * @param $password
- * @param $database
- */
- public function createDatabaseIfNotExists($server, $username, $password, $database) {
- $conn = $this->connect($server, $username, $password);
-
- if (@mysqli_select_db($conn, $database)) {
- // skip if database already present
- return;
- }
- $query = sprintf("CREATE DATABASE %s", mysqli_real_escape_string($conn, $database));
- if (@mysqli_query($conn, $query)) {
- }
- else {
- $errorTitle = ts("Oops! Could not create database %1", [1 => $database]);
- $errorMsg = ts("We encountered an error when attempting to create the database. Please check your MySQL server permissions and the database name and try again.");
- errorDisplayPage($errorTitle, $errorMsg);
- }
- }
-
- /**
- * @param $config
- *
- * @return mixed
- */
- public function install($config) {
- global $installDirPath;
-
- // create database if does not exists
- $this->createDatabaseIfNotExists($config['mysql']['server'],
- $config['mysql']['username'],
- $config['mysql']['password'],
- $config['mysql']['database']
- );
-
- global $installDirPath;
-
- // Build database
- require_once $installDirPath . 'civicrm.php';
- civicrm_main($config);
-
- if (!$this->errors) {
- global $installType, $installURLPath;
-
- $registerSiteURL = "https://civicrm.org/register-site";
- $commonOutputMessage
- = "
" . ts("Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to fill out the site registration form. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).", [1 => "href='$registerSiteURL' target='_blank'"]) . "
"
- . "
" . ts("We have integrated KCFinder with CKEditor and TinyMCE. This allows a user to upload images. All uploaded images are public.") . "
" . ts("Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", [1 => "target='_blank' href='{$drupalPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'"]) . "
";
- $output .= "
" . ts("Use the Configuration Checklist to review and configure settings for your new site", [1 => "target='_blank' href='$drupalURL'"]) . "
";
- $output .= $commonOutputMessage;
-
- // automatically enable CiviCRM module once it is installed successfully.
- // so we need to Bootstrap Drupal, so that we can call drupal hooks.
- global $cmsPath, $crmPath;
-
- // relative / abosolute paths are not working for drupal, hence using chdir()
- chdir($cmsPath);
-
- // Force the re-initialisation of the config singleton on the next call
- // since so far, we had used the Config object without loading the DB.
- $c = CRM_Core_Config::singleton(FALSE);
- $c->free();
-
- include_once "./includes/bootstrap.inc";
- include_once "./includes/unicode.inc";
-
- drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
- // prevent session information from being saved.
- drupal_save_session(FALSE);
-
- // Force the current user to anonymous.
- $original_user = $GLOBALS['user'];
- $GLOBALS['user'] = drupal_anonymous_user();
-
- // explicitly setting error reporting, since we cannot handle drupal related notices
- error_reporting(1);
-
- // rebuild modules, so that civicrm is added
- system_rebuild_module_data();
-
- // now enable civicrm module.
- module_enable(['civicrm', 'civicrmtheme']);
-
- // SystemInstallEvent will be called from here with the first call of CRM_Core_Config,
- // which calls Core_BAO_ConfigSetting::applyLocale(), who will default to calling
- // Civi::settings()->get('lcMessages');
- // Therefore, we need to pass the seedLanguage before that.
- global $civicrm_setting;
- $civicrm_setting['domain']['lcMessages'] = $config['seedLanguage'];
-
- // clear block, page, theme, and hook caches
- drupal_flush_all_caches();
-
- //add basic drupal permissions
- civicrm_install_set_drupal_perms();
-
- // restore the user.
- $GLOBALS['user'] = $original_user;
- drupal_save_session(TRUE);
-
- $output .= '
" . ts("Backdrop user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", [1 => "target='_blank' href='{$backdropPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'"]) . "
";
- $output .= "
" . ts("Use the Configuration Checklist to review and configure settings for your new site", [1 => "target='_blank' href='$backdropURL'"]) . "
";
- $output .= $commonOutputMessage;
-
- // automatically enable CiviCRM module once it is installed successfully.
- // so we need to Bootstrap Drupal, so that we can call drupal hooks.
- global $cmsPath, $crmPath;
-
- // relative / abosolute paths are not working for drupal, hence using chdir()
- chdir($cmsPath);
-
- // Force the re-initialisation of the config singleton on the next call
- // since so far, we had used the Config object without loading the DB.
- $c = CRM_Core_Config::singleton(FALSE);
- $c->free();
-
- include_once "./core/includes/bootstrap.inc";
- include_once "./core/includes/unicode.inc";
- include_once "./core/includes/config.inc";
-
- backdrop_bootstrap(BACKDROP_BOOTSTRAP_FULL);
-
- // prevent session information from being saved.
- backdrop_save_session(FALSE);
-
- // Force the current user to anonymous.
- $original_user = $GLOBALS['user'];
- $GLOBALS['user'] = backdrop_anonymous_user();
-
- // explicitly setting error reporting, since we cannot handle drupal related notices
- error_reporting(1);
-
- // rebuild modules, so that civicrm is added
- system_rebuild_module_data();
-
- // now enable civicrm module.
- module_enable(['civicrm', 'civicrmtheme']);
-
- // clear block, page, theme, and hook caches
- backdrop_flush_all_caches();
-
- //add basic backdrop permissions
- civicrm_install_set_backdrop_perms();
-
- // restore the user.
- $GLOBALS['user'] = $original_user;
- backdrop_save_session(TRUE);
-
- //change the default language to one chosen
- if (isset($config['seedLanguage']) && $config['seedLanguage'] != 'en_US') {
- civicrm_api3('Setting', 'create', [
- 'domain_id' => 'current_domain',
- 'lcMessages' => $config['seedLanguage'],
- ]);
- }
-
- $output .= '
" . ts("Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", [1 => "target='_blank' href='{$drupalPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'"]) . "
";
- $output .= "
" . ts("Use the Configuration Checklist to review and configure settings for your new site", [1 => "target='_blank' href='$drupalURL'"]) . "
";
- $output .= $commonOutputMessage;
-
- // explicitly setting error reporting, since we cannot handle drupal related notices
- error_reporting(1);
-
- // automatically enable CiviCRM module once it is installed successfully.
- // so we need to Bootstrap Drupal, so that we can call drupal hooks.
- global $cmsPath, $crmPath;
-
- // relative / abosolute paths are not working for drupal, hence using chdir()
- chdir($cmsPath);
-
- // Force the re-initialisation of the config singleton on the next call
- // since so far, we had used the Config object without loading the DB.
- $c = CRM_Core_Config::singleton(FALSE);
- $c->free();
-
- include_once "./includes/bootstrap.inc";
- drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
- // rebuild modules, so that civicrm is added
- module_rebuild_cache();
-
- // now enable civicrm module.
- module_enable(['civicrm']);
-
- // clear block, page, theme, and hook caches
- drupal_flush_all_caches();
-
- //add basic drupal permissions
- db_query('UPDATE {permission} SET perm = CONCAT( perm, \', access CiviMail subscribe/unsubscribe pages, access all custom data, access uploaded files, make online contributions, profile create, profile edit, profile view, register for events, view event info\') WHERE rid IN (1, 2)');
-
- echo $output;
- }
- elseif ($installType == 'wordpress') {
- echo '
' . ts('CiviCRM Installed') . '
';
- echo '
' . ts("CiviCRM has been successfully installed") . '
" . ts("WordPress user permissions have been automatically set - giving Anonymous and Subscribers access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", [1 => "target='_blank' href='{$wpPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'"]) . "
";
- $output .= "
" . ts("Use the Configuration Checklist to review and configure settings for your new site", [1 => "target='_blank' href='$cmsURL'"]) . "