) {
$this->requireMySQLServer($databaseConfig['server'],
array(
- "MySQL $dbName Configuration",
- "Does the server exist",
- "Can't find the a MySQL server on '$databaseConfig[server]'",
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts("Does the server exist?"),
+ ts("Can't find the a MySQL server on '%1'.", array(1 => $databaseConfig['server'])),
$databaseConfig['server'],
)
);
$databaseConfig['username'],
$databaseConfig['password'],
array(
- "MySQL $dbName Configuration",
- "Are the access credentials correct",
- "That username/password doesn't work",
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts("Are the access credentials correct?"),
+ ts("That username/password doesn't work"),
)
)
) {
@$this->requireMySQLVersion("5.1",
array(
- "MySQL $dbName Configuration",
- "MySQL version at least 5.1",
- "MySQL version 5.1 or higher is required, you only have ",
- "MySQL " . mysql_get_server_info(),
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts("MySQL version at least %1", array(1 => '5.1')),
+ ts("MySQL version %1 or higher is required, you are running MySQL %2.", array(1 => '5.1', 2 => mysql_get_server_info())),
+ ts("MySQL %1", array(1 => mysql_get_server_info())),
)
);
$this->requireMySQLAutoIncrementIncrementOne($databaseConfig['server'],
$databaseConfig['username'],
$databaseConfig['password'],
array(
- "MySQL $dbName Configuration",
- "Is auto_increment_increment set to 1",
- "An auto_increment_increment value greater than 1 is not currently supported. Please see issue CRM-7923 for further details and potential workaround.",
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts("Is auto_increment_increment set to 1"),
+ ts("An auto_increment_increment value greater than 1 is not currently supported. Please see issue CRM-7923 for further details and potential workaround."),
)
);
$this->requireMySQLThreadStack($databaseConfig['server'],
$databaseConfig['database'],
self::MINIMUM_THREAD_STACK,
array(
- "MySQL $dbName Configuration",
- "Does MySQL thread_stack meet minimum (" . self::MINIMUM_THREAD_STACK . "k)",
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts("Does MySQL thread_stack meet minimum (%1k)", array(1 => self::MINIMUM_THREAD_STACK)),
"",
// "The MySQL thread_stack does not meet minimum " . CRM_Upgrade_Form::MINIMUM_THREAD_STACK . "k. Please update thread_stack in my.cnf.",
)
$databaseConfig['password'],
$databaseConfig['database'],
array(
- "MySQL $dbName Configuration",
- "Can I access/create the database",
- "I can't create new databases and the database '$databaseConfig[database]' doesn't exist",
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts("Can I access/create the database?"),
+ ts("I can't create new databases and the database '%1' doesn't exist.", array(1 => $databaseConfig[database])),
),
$onlyRequire
);
$databaseConfig['password'],
$databaseConfig['database'],
array(
- "MySQL $dbName Configuration",
- "Can I access/create InnoDB tables in the database",
- "Unable to create InnoDB tables. MySQL InnoDB support is required for CiviCRM but is either not available or not enabled in this MySQL database server.",
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts("Can I access/create InnoDB tables in the database?"),
+ ts("Unable to create InnoDB tables. MySQL InnoDB support is required for CiviCRM but is either not available or not enabled in this MySQL database server."),
)
);
$this->requireMySQLTempTables($databaseConfig['server'],
$databaseConfig['password'],
$databaseConfig['database'],
array(
- "MySQL $dbName Configuration",
- 'Can I create temporary tables in the database',
- 'Unable to create temporary tables. This MySQL user is missing the CREATE TEMPORARY TABLES privilege.',
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts('Can I create temporary tables in the database?'),
+ ts('Unable to create temporary tables. This MySQL user is missing the CREATE TEMPORARY TABLES privilege.'),
)
);
$this->requireMySQLLockTables($databaseConfig['server'],
$databaseConfig['password'],
$databaseConfig['database'],
array(
- "MySQL $dbName Configuration",
- 'Can I create lock tables in the database',
- 'Unable to lock tables. This MySQL user is missing the LOCK TABLES privilege.',
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts('Can I create lock tables in the database?'),
+ ts('Unable to lock tables. This MySQL user is missing the LOCK TABLES privilege.'),
)
);
$this->requireMySQLTrigger($databaseConfig['server'],
$databaseConfig['password'],
$databaseConfig['database'],
array(
- "MySQL $dbName Configuration",
- 'Can I create triggers in the database',
- 'Unable to create triggers. This MySQL user is missing the CREATE TRIGGERS privilege.',
+ ts("MySQL %1 Configuration", array(1 => $dbName)),
+ ts('Can I create triggers in the database?'),
+ ts('Unable to create triggers. This MySQL user is missing the CREATE TRIGGERS privilege.'),
)
);
}
$this->errors = NULL;
$this->requirePHPVersion('5.3.3', array(
- "PHP Configuration",
- "PHP5 installed",
+ ts("PHP Configuration"),
+ ts("PHP5 installed"),
NULL,
- "PHP version " . phpversion(),
+ ts("PHP version %1", array(1 => phpversion())),
));
// Check that we can identify the root folder successfully
$this->requireFile($crmPath . CIVICRM_DIRECTORY_SEPARATOR . 'README.txt',
array(
- "File permissions",
- "Does the webserver know where files are stored?",
- "The webserver isn't letting me identify where files are stored.",
+ ts("File permissions"),
+ ts("Does the webserver know where files are stored?"),
+ ts("The webserver isn't letting me identify where files are stored."),
$this->getBaseDir(),
),
TRUE
// CRM-6485: make sure the path does not contain PATH_SEPARATOR, as we don’t know how to escape it
$this->requireNoPathSeparator(
array(
- 'File permissions',
- 'does the CiviCRM path contain PATH_SEPARATOR?',
- 'the ' . $this->getBaseDir() . ' path contains PATH_SEPARATOR (the ' . PATH_SEPARATOR . ' character)',
+ ts("File permissions"),
+ ts('Does the CiviCRM path contain PATH_SEPARATOR?'),
+ ts('The path %1 contains PATH_SEPARATOR (the %2 character).', array(1 => $this->getBaseDir(), 2 => PATH_SEPARATOR)),
$this->getBaseDir(),
)
);
foreach ($requiredDirectories as $dir) {
$this->requireFile($crmPath . CIVICRM_DIRECTORY_SEPARATOR . $dir,
array(
- "File permissions",
- "$dir folder exists",
- "There is no $dir folder",
+ ts("File permissions"),
+ ts("Folder '%1' exists?", array(1 => $dir)),
+ ts("There is no '%1' folder.", array(1 => $dir)),
), TRUE
);
}
foreach ($writableDirectories as $dir) {
$dirName = CIVICRM_WINDOWS ? $dir : CIVICRM_DIRECTORY_SEPARATOR . $dir;
- $this->requireWriteable($dirName,
- array("File permissions", "Is the $dir folder writeable?", NULL),
- TRUE
+ $testDetails = array(
+ ts("File permissions"),
+ ts("Is the %1 folder writeable?", array(1 => $dir)),
+ NULL,
);
+ $this->requireWriteable($dirName, $testDetails, TRUE);
}
//check for Config.IDS.ini, file may exist in re-install
}
if ($webserver == '') {
- $webserver = "I can't tell what webserver you are running";
+ $webserver = ts("I can't tell what webserver you are running");
}
// Check for $_SERVER configuration
$this->requireServerVariables(array('SCRIPT_NAME', 'HTTP_HOST', 'SCRIPT_FILENAME'), array(
- "Webserver config",
- "Recognised webserver",
- "You seem to be using an unsupported webserver. The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set.",
+ ts("Webserver config"),
+ ts("Recognised webserver"),
+ ts("You seem to be using an unsupported webserver. The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set."),
));
// Check for MySQL support
- $this->requireFunction('mysql_connect',
- array("PHP Configuration", "MySQL support", "MySQL support not included in PHP.")
- );
+ $this->requireFunction('mysql_connect', array(
+ ts("PHP Configuration"),
+ ts("MySQL support"),
+ ts("MySQL support not included in PHP."),
+ ));
// Check for JSON support
- $this->requireFunction('json_encode',
- array("PHP Configuration", "JSON support", "JSON support not included in PHP.")
- );
+ $this->requireFunction('json_encode', array(
+ ts("PHP Configuration"),
+ ts("JSON support"),
+ ts("JSON support not included in PHP."),
+ ));
// Check for xcache_isset and emit warning if exists
$this->checkXCache(array(
- "PHP Configuration",
- "XCache compatibility",
- "XCache is installed and there are known compatibility issues between XCache and CiviCRM. Consider using an alternative PHP caching mechanism or disable PHP caching altogether.",
+ ts("PHP Configuration"),
+ ts("XCache compatibility"),
+ ts("XCache is installed and there are known compatibility issues between XCache and CiviCRM. Consider using an alternative PHP caching mechanism or disable PHP caching altogether."),
));
// Check memory allocation
$this->requireMemory(32 * 1024 * 1024,
64 * 1024 * 1024,
array(
- "PHP Configuration",
- "Memory allocated (PHP config option 'memory_limit')",
- "CiviCRM needs a minimum of 32M allocated to PHP, but recommends 64M.",
+ ts("PHP Configuration"),
+ ts("Memory allocated (PHP config option 'memory_limit')"),
+ ts("CiviCRM needs a minimum of %1 MB allocated to PHP, but recommends %2 MB.", array(1 => 32, 2 => 64)),
ini_get("memory_limit"),
)
);
$mem = $this->getPHPMemory();
if ($mem < $min && $mem > 0) {
- $testDetails[2] .= " You only have " . ini_get("memory_limit") . " allocated";
+ $testDetails[2] .= " " . ts("You only have %1 allocated", array(1 => ini_get("memory_limit")));
$this->error($testDetails);
}
elseif ($mem < $recommended && $mem > 0) {
- $testDetails[2] .= " You only have " . ini_get("memory_limit") . " allocated";
+ $testDetails[2] .= " " . ts("You only have %1 allocated", array(1 => ini_get("memory_limit")));
$this->warning($testDetails);
}
elseif ($mem == 0) {
- $testDetails[2] .= " We can't determine how much memory you have allocated. Install only if you're sure you've allocated at least 20 MB.";
+ $testDetails[2] .= " " . ts("We can't determine how much memory you have allocated. Install only if you're sure you've allocated at least %1 MB.", array(1 => 32));
$this->warning($testDetails);
}
}
public function listErrors() {
if ($this->errors) {
- echo "<p>The following problems are preventing me from installing CiviCRM:</p>";
+ echo "<p>" . ts("The following problems are preventing me from installing CiviCRM:") . "</p>";
foreach ($this->errors as $error) {
echo "<li>" . htmlentities($error) . "</li>";
}
if (!$testDetails[2]) {
if (!$aboveMinVersion) {
- $testDetails[2] = "You need PHP version $minVersion or later, only {$phpVersion} is installed. Please upgrade your server, or ask your web-host to do so.";
+ $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.", array(1 => $minVersion, 2 => $phpVersion));
}
else {
- $testDetails[2] = "PHP version {$phpVersion} is not supported. PHP version earlier than $maxVersion is required. You might want to downgrade your server, or ask your web-host to do so.";
+ $testDetails[2] = ts("PHP version %1 is not supported. PHP version earlier than %2 is required. You might want to downgrade your server, or ask your web-host to do so.", array(1 => $maxVersion, 2 => $phpVersion));
}
}
$filename = $this->getBaseDir() . $filename;
}
if (!file_exists($filename)) {
- $testDetails[2] .= " (file '$filename' not found)";
+ $testDetails[2] .= " (" . ts("file '%1' not found", array(1 => $filename)) . ')';
$this->error($testDetails);
}
}
$this->testing($testDetails);
$filename = $this->getBaseDir() . $filename;
if (file_exists($filename)) {
- $testDetails[2] .= " (file '$filename' found)";
+ $testDetails[2] .= " (" . ts("file '%1' found", array(1 => $filename)) . ")";
$this->error($testDetails);
}
}
if (!isset($testDetails[2])) {
$testDetails[2] = NULL;
}
- $testDetails[2] .= "The user account used by your web-server $name needs to be granted write access to the following directory in order to configure the CiviCRM settings file:\n$filename";
+ $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:", array(1 => $name)) . "\n$filename";
$this->error($testDetails);
}
}
$this->testing($testDetails);
if (!mysql_get_server_info()) {
- $testDetails[2] = 'Cannot determine the version of MySQL installed. Please ensure at least version 4.1 is installed.';
+ $testDetails[2] = ts('Cannot determine the version of MySQL installed. Please ensure at least version %1 is installed.', array(1 => $version));
$this->warning($testDetails);
}
else {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
- $testDetails[2] .= ' Could not determine if mysql has innodb support. Assuming no';
+ $testDetails[2] .= ' ' . ts("Could not determine if MySQL has InnoDB support. Assuming no.");
$this->error($testDetails);
return;
}
}
}
if ($innodb_support) {
- $testDetails[3] = 'MySQL server does have innodb support';
+ $testDetails[3] = ts('MySQL server does have InnoDB support');
}
else {
- $testDetails[2] .= ' Could not determine if mysql has innodb support. Assuming no';
+ $testDetails[2] .= ' ' . ts('Could not determine if MySQL has InnoDB support. Assuming no');
}
}
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
- $testDetails[2] = 'Could not login to the database.';
+ $testDetails[2] = ts('Could not login to the database.');
$this->error($testDetails);
return;
}
if (!@mysql_select_db($database, $conn)) {
- $testDetails[2] = 'Could not select the database.';
+ $testDetails[2] = ts('Could not select the database.');
$this->error($testDetails);
return;
}
$result = mysql_query('CREATE TEMPORARY TABLE civicrm_install_temp_table_test (test text)', $conn);
if (!$result) {
- $testDetails[2] = 'Could not create a temp table.';
+ $testDetails[2] = ts('Could not create a temp table.');
$this->error($testDetails);
}
$result = mysql_query('DROP TEMPORARY TABLE civicrm_install_temp_table_test');
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
- $testDetails[2] = 'Could not login to the database.';
+ $testDetails[2] = ts('Could not login to the database.');
$this->error($testDetails);
return;
}
if (!@mysql_select_db($database, $conn)) {
- $testDetails[2] = 'Could not select the database.';
+ $testDetails[2] = ts('Could not select the database.');
$this->error($testDetails);
return;
}
$result = mysql_query('CREATE TABLE civicrm_install_temp_table_test (test text)', $conn);
if (!$result) {
- $testDetails[2] = 'Could not create a table.';
+ $testDetails[2] = ts('Could not create a table in the database.');
$this->error($testDetails);
}
$result = mysql_query('CREATE TRIGGER civicrm_install_temp_table_test_trigger BEFORE INSERT ON civicrm_install_temp_table_test FOR EACH ROW BEGIN END');
if (!$result) {
mysql_query('DROP TABLE civicrm_install_temp_table_test');
- $testDetails[2] = 'Could not create a trigger.';
+ $testDetails[2] = ts('Could not create a database trigger.');
$this->error($testDetails);
}
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
- $testDetails[2] = 'Could not login to the database.';
+ $testDetails[2] = ts('Could not connect to the database server.');
$this->error($testDetails);
return;
}
if (!@mysql_select_db($database, $conn)) {
- $testDetails[2] = 'Could not select the database.';
+ $testDetails[2] = ts('Could not select the database.');
$this->error($testDetails);
return;
}
$result = mysql_query('CREATE TEMPORARY TABLE civicrm_install_temp_table_test (test text)', $conn);
if (!$result) {
- $testDetails[2] = 'Could not create a table.';
+ $testDetails[2] = ts('Could not create a table in the database.');
$this->error($testDetails);
return;
}
$result = mysql_query('LOCK TABLES civicrm_install_temp_table_test WRITE', $conn);
if (!$result) {
- $testDetails[2] = 'Could not obtain a write lock for the table.';
+ $testDetails[2] = ts('Could not obtain a write lock for the database table.');
$this->error($testDetails);
$result = mysql_query('DROP TEMPORARY TABLE civicrm_install_temp_table_test');
return;
$result = mysql_query('UNLOCK TABLES', $conn);
if (!$result) {
- $testDetails[2] = 'Could not release the lock for the table.';
+ $testDetails[2] = ts('Could not release the lock for the database table.');
$this->error($testDetails);
$result = mysql_query('DROP TEMPORARY TABLE civicrm_install_temp_table_test');
return;
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
- $testDetails[2] = 'Could not connect to the database server.';
+ $testDetails[2] = ts('Could not connect to the database server.');
$this->error($testDetails);
return;
}
$result = mysql_query("SHOW variables like 'auto_increment_increment'", $conn);
if (!$result) {
- $testDetails[2] = 'Could not query database server variables.';
+ $testDetails[2] = ts('Could not query database server variables.');
$this->error($testDetails);
return;
}
else {
$values = mysql_fetch_row($result);
if ($values[1] == 1) {
- $testDetails[3] = 'MySQL server auto_increment_increment is 1';
+ $testDetails[3] = ts('MySQL server auto_increment_increment is 1');
}
else {
$this->error($testDetails);
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
- $testDetails[2] = 'Could not login to the database.';
+ $testDetails[2] = ts('Could not connect to the database server.');
$this->error($testDetails);
return;
}
if (!@mysql_select_db($database, $conn)) {
- $testDetails[2] = 'Could not select the database.';
+ $testDetails[2] = ts('Could not select the database.');
$this->error($testDetails);
return;
}
$result = mysql_query("SHOW VARIABLES LIKE 'thread_stack'", $conn); // bytes => kb
if (!$result) {
- $testDetails[2] = 'Could not query thread_stack.';
+ $testDetails[2] = ts('Could not get information about the thread_stack of the database.');
$this->error($testDetails);
}
else {
$values = mysql_fetch_row($result);
if ($values[1] < (1024 * $minValueKB)) {
- $testDetails[2] = 'MySQL "thread_stack" is ' . ($values[1] / 1024) . 'k';
+ $testDetails[2] = ts('MySQL "thread_stack" is %1 kb', array(1 => ($values[1] / 1024)));
$this->error($testDetails);
}
}
$okay = "Database '$database' exists";
}
elseif ($onlyRequire) {
- $testDetails[2] = "The database: '$database' does not exist";
+ $testDetails[2] = ts("The database: '%1' does not exist.", array(1 => $database));
$this->error($testDetails);
return;
}
else {
if (@mysql_query("CREATE DATABASE $database")) {
- $okay = "Able to create a new database";
+ $okay = ts("Able to create a new database.");
}
else {
- $testDetails[2] .= " (user '$username' doesn't have CREATE DATABASE permissions.)";
+ $testDetails[2] .= " (" . ts("user '%1' doesn't have CREATE DATABASE permissions.", array(1 => $username)) . ")";
$this->error($testDetails);
return;
}
return TRUE;
}
else {
- $testDetails[2] = " (the following PHP variables are missing: " . implode(", ", $missing) . ")";
+ $testDetails[2] = " (" . ts('the following PHP variables are missing: %1', array(1 => implode(", ", $missing))) . ")";
$this->error($testDetails);
}
}
$section = $testDetails[0];
$test = $testDetails[1];
- $message = "OK";
+ $message = ts("OK");
if (isset($testDetails[3])) {
$message .= " ($testDetails[3])";
}
$output .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
$output .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
$output .= '<head>';
- $output .= '<title>CiviCRM Installed</title>';
+ $output .= '<title>' . ts('CiviCRM Installed') . '</title>';
$output .= '<link rel="stylesheet" type="text/css" href="template.css" />';
$output .= '</head>';
$output .= '<body>';
- $output .= '<div style="padding: 1em;"><p class="good">CiviCRM has been successfully installed</p>';
+ $output .= '<div style="padding: 1em;"><p class="good">' . ts('CiviCRM has been successfully installed') . '</p>';
$output .= '<ul>';
$docLinkConfig = CRM_Utils_System::docURL2('Configuring a New Site', FALSE, 'here', NULL, NULL, "wiki");
if (!function_exists('ts')) {
// 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);