Skip to content

Commit 4604870

Browse files
committed
Merge branch 'develop' into fix/postfix-configuration
Signed-off-by: Riddhesh Sanghvi <[email protected]>
2 parents be63463 + a655120 commit 4604870

16 files changed

+887
-191
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"src/helper/SimpleDnsCloudflareSolver.php",
2323
"src/helper/Site_Self_Signed.php",
2424
"src/helper/Site_Letsencrypt.php",
25-
"src/helper/Shutdown_Handler.php"
25+
"src/helper/Shutdown_Handler.php",
26+
"src/clone/Cloner.php",
27+
"src/clone/clone-utils.php"
2628
]
2729
},
2830
"extra": {

migrations/db/20180910124650_site-command_create_table_site_migration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public function up() {
4848
db_root_password VARCHAR,
4949
db_host VARCHAR,
5050
db_port VARCHAR,
51-
subnet_ip VARCHAR,
5251
app_sub_type VARCHAR,
5352
app_admin_url VARCHAR,
5453
app_admin_email VARCHAR,

migrations/db/20210719150420_site-command_add_column_subnet_ip_migration.php

Lines changed: 0 additions & 133 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
namespace EE\Migration;
3+
4+
use EE;
5+
6+
class AddDaemonJson extends Base {
7+
8+
public function __construct() {
9+
10+
parent::__construct();
11+
if ( $this->is_first_execution ) {
12+
$this->skip_this_migration = true;
13+
}
14+
}
15+
16+
/**
17+
* Execute create table query for site and sitemeta table.
18+
*
19+
* @throws EE\ExitException
20+
*/
21+
public function up() {
22+
23+
if ( php_uname('s') === 'Linux' ) {
24+
if ( file_exists( '/etc/docker/daemon.json' ) ) {
25+
$existin_config = file_get_contents( '/etc/docker/daemon.json' );
26+
$existin_config = json_decode( $existin_config, true );
27+
} else {
28+
$existin_config = [];
29+
}
30+
31+
$existin_config['default-address-pools'] = json_decode( '[{"base":"10.0.0.0/8","size":24}]', true );
32+
file_put_contents( '/etc/docker/daemon.json', json_encode( $existin_config ) );
33+
34+
EE::launch( 'command -v systemctl && systemctl restart docker || service docker restart' );
35+
}
36+
}
37+
38+
/**
39+
* Execute drop table query for site and sitemeta table.
40+
*
41+
* @throws EE\ExitException
42+
*/
43+
public function down() {
44+
45+
}
46+
}

migrations/db/20210728160511_site-command_add_default_subnet_ip_migration.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public function up() {
4444
ensure_global_network_initialized();
4545

4646
foreach ( $sites as $site ) {
47-
$site->subnet_ip = EE\Site\Utils\get_available_subnet();
4847
$site->save();
4948

5049
$site_type = $site->site_type === 'html' ? new EE\Site\Type\HTML() :
@@ -55,10 +54,12 @@ public function up() {
5554
$site_data = (array) $site_type->site_data;
5655
$site_data = reset($site_data );
5756
$site_type->site_data = $site_data;
58-
$site_type->dump_docker_compose_yml();
57+
$no_https = $site_data['site_ssl'] ? false : true;
58+
$site_type->dump_docker_compose_yml([ 'nohttps' => $no_https ]);
5959

6060
if ( $site->site_enabled ) {
61-
$site_type->refresh( [ $site->site_url ], [] );
61+
$site_type->disable( [ $site->site_url ], [] );
62+
$site_type->enable( [ $site->site_url ], [] );
6263
}
6364
}
6465
}
@@ -70,15 +71,5 @@ public function up() {
7071
*/
7172
public function down() {
7273

73-
/**
74-
* Reset Subnet IP column in table.
75-
*/
76-
$query = 'UPDATE sites set subnet_ip=\'\';';
77-
78-
try {
79-
self::$pdo->exec( $query );
80-
} catch ( PDOException $exception ) {
81-
EE::error( 'Encountered Error while dropping table: ' . $exception->getMessage(), false );
82-
}
8374
}
8475
}

0 commit comments

Comments
 (0)