mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Pass the database object to the schema object
This commit is contained in:
@@ -130,7 +130,7 @@
|
||||
|
||||
//load an array of the database schema and compare it with the active database
|
||||
if (!empty($action["upgrade_schema"]) && permission_exists("upgrade_schema")) {
|
||||
$obj = new schema();
|
||||
$obj = new schema(['database' => $database]);
|
||||
if (isset($action["data_types"]) && $action["data_types"] == 'true') {
|
||||
$obj->data_types = true;
|
||||
}
|
||||
|
||||
@@ -172,6 +172,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
//initiliaze the schema object
|
||||
$schema = new schema(['database' => $database]);
|
||||
|
||||
//use upgrade language file
|
||||
$language = new text;
|
||||
$text = $language->get(null, 'core/upgrade');
|
||||
@@ -230,11 +233,10 @@
|
||||
}
|
||||
|
||||
//get the database schema put it into an array then compare and update the database as needed.
|
||||
$obj = new schema;
|
||||
if (isset($argv[2]) && $argv[2] == 'data_types') {
|
||||
$obj->data_types = true;
|
||||
$schema->data_types = true;
|
||||
}
|
||||
$response = $obj->schema($format ?? '');
|
||||
$response = $schema->schema($format ?? '');
|
||||
if ($display_type === 'text') {
|
||||
foreach(explode("\n", $response) as $row) {
|
||||
echo " ".trim($row)."\n";
|
||||
@@ -250,9 +252,8 @@
|
||||
}
|
||||
|
||||
//get the database schema put it into an array then compare and update the database as needed.
|
||||
$obj = new schema;
|
||||
$obj->data_types = true;
|
||||
$response = $obj->schema($format ?? '');
|
||||
$schema->data_types = true;
|
||||
$response = $schema->schema($format ?? '');
|
||||
if ($display_type === 'text') {
|
||||
foreach(explode("\n", $response) as $row) {
|
||||
echo " ".trim($row)."\n";
|
||||
@@ -323,7 +324,6 @@
|
||||
|
||||
// upgrade application defaults
|
||||
$domain = new domains;
|
||||
$domain->display_type = $display_type;
|
||||
$domain->upgrade();
|
||||
}
|
||||
|
||||
@@ -439,8 +439,7 @@
|
||||
}
|
||||
|
||||
//Update the table and field structure.
|
||||
$obj = new schema;
|
||||
$response = $obj->schema("text");
|
||||
$response = $schema->schema("text");
|
||||
if ($display_type === 'text') {
|
||||
foreach(explode("\n", $response) as $row) {
|
||||
echo " ".trim($row)."\n";
|
||||
|
||||
@@ -316,7 +316,6 @@ function do_upgrade_code_submodules() {
|
||||
*/
|
||||
function do_upgrade_domains() {
|
||||
$domain = new domains;
|
||||
$domain->display_type = 'text';
|
||||
$domain->upgrade();
|
||||
}
|
||||
|
||||
@@ -325,7 +324,7 @@ function do_upgrade_domains() {
|
||||
*/
|
||||
function do_upgrade_schema(bool $data_types = false) {
|
||||
//get the database schema put it into an array then compare and update the database as needed.
|
||||
$obj = new schema;
|
||||
$obj = new schema();
|
||||
$obj->data_types = $data_types;
|
||||
echo $obj->schema('text');
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
$text = $language->get();
|
||||
|
||||
//get the database schema put it into an array then compare and update the database as needed.
|
||||
$obj = new schema;
|
||||
$obj = new schema(['database' => $database]);
|
||||
if (isset($argv[1]) && $argv[1] == 'data_types') {
|
||||
$obj->data_types = true;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
public $data_types;
|
||||
|
||||
//class constructor
|
||||
public function __construct($setting_array) {
|
||||
public function __construct($setting_array = []) {
|
||||
|
||||
//includes files
|
||||
require dirname(__DIR__, 2) . "/resources/require.php";
|
||||
@@ -879,8 +879,8 @@
|
||||
}
|
||||
|
||||
//example use
|
||||
//$obj = new schema;
|
||||
//$obj->db_type = $db_type;
|
||||
//$obj->schema();
|
||||
//$schema = new schema();
|
||||
//$schema->db_type = $db_type;
|
||||
//$schema->schema();
|
||||
//$result_array = $schema->obj['sql'];
|
||||
//print_r($result_array);
|
||||
|
||||
Reference in New Issue
Block a user