Elgg  Version 3.0
DatarootSettingMigrator.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Config;
4 
11 
15  public function migrate() {
16 
17  try {
18  $row = $this->db->getDataRow("
19  SELECT value FROM {$this->db->prefix}datalists
20  WHERE name = 'dataroot'
21  ");
22 
23  if (empty($row)) {
24  error_log("The DB table {$this->db->prefix}datalists did not have 'dataroot'.");
25  return;
26  }
27 
28  $value = $row->value;
29  $lines = [
30  "",
31  "/**",
32  " * The full file path for Elgg data storage. E.g. /path/to/elgg-data/",
33  " *",
34  " * @global string \$CONFIG->dataroot",
35  " */",
36  "\$CONFIG->dataroot = \"{$value}\";",
37  "",
38  ];
39  $bytes = implode(PHP_EOL, $lines);
40 
41  $this->append($bytes);
42 
43  return $value;
44  } catch (\DatabaseException $ex) {
45  error_log($ex->getMessage());
46  }
47  }
48 }
Migrates dataroot database value to settings.php.
Migrates DB values to settings.php.
append($bytes)
Write bytes to settings files.
$value
Definition: debugging.php:7