Skip to content

Commit 18221d2

Browse files
committed
优化两个小问题
1. 修复[auto_prepend_filem],[auto_append_file]没有起效 2.nginx自定义配置
1 parent bf80d92 commit 18221d2

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

mdserver/mdserver/AppDelegate.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ - (IBAction)SelfDebug:(id)sender {
483483
}
484484
}
485485

486-
#pragma mark - 启动按钮 -
486+
487487
-(NSString *)stringReplace:(NSString *)c yes:(BOOL)yes
488488
{
489489
NSString *str = [NSCommon getRootDir];
@@ -510,6 +510,9 @@ -(void)replacePHP:(BOOL)yes
510510
NSString *str = [NSCommon getRootDir];
511511
NSString *php_ini = [NSString stringWithFormat:@"%@bin/php/etc/php.ini", str];
512512
[self replaceConfig:php_ini yes:yes];
513+
514+
NSString *php_fpm = [NSString stringWithFormat:@"%@bin/php/etc/php-fpm.conf", str];
515+
[self replaceConfig:php_fpm yes:yes];
513516
}
514517

515518
-(void)replaceNginx:(BOOL)yes
@@ -570,7 +573,7 @@ - (void)startWebService
570573
NSString *str = [NSCommon getRootDir];
571574
NSString *title = pStartTitle.stringValue;
572575

573-
NSLog(@"start:开始启动");
576+
//NSLog(@"start:开始启动");
574577
if ([title isEqual:@"start"]) {
575578

576579
NSString *isflog = [NSCommon getCommonConfig:@"isStartAfterFlushLog"];
@@ -597,7 +600,7 @@ - (void)startWebService
597600

598601
- (void)stopWebService
599602
{
600-
NSLog(@"start:开始停止");
603+
//NSLog(@"start:开始停止");
601604
NSString *str = [NSCommon getRootDir];
602605
NSString *_str = [NSCommon getAppDir];
603606
NSString *title = pStartTitle.stringValue;
@@ -697,7 +700,7 @@ -(void)selfStart
697700
}];
698701
}
699702

700-
#pragma mark 按钮启动
703+
#pragma mark - 按钮启动 -
701704
- (IBAction)start:(id)sender {
702705
[self AuthorizeCreate];
703706
[self selfStart];
@@ -837,7 +840,7 @@ -(BOOL)checkMemcachedStatus
837840
path = [NSString stringWithFormat:@"%@bin/memcached/mem.pid", path];
838841
BOOL isStart = [fm fileExistsAtPath:path];
839842

840-
NSLog(@"isStart:%hhd", isStart);
843+
//NSLog(@"isStart:%hhd", isStart);
841844
if(isStart){
842845
_mMemcachedTool.enabled = TRUE;
843846
_mMemcachedButton.state = 1;

mdserver/mdserver/NSCommon.m

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,26 @@ +(BOOL)saveNginxConfig{
143143
[list addObject:[listContent objectForKey:k]];
144144
}
145145

146+
NSString *rootDir = [NSCommon getRootDir];
147+
NSString *vhost = [NSString stringWithFormat:@"%@bin/nginx/conf/vhost", rootDir];
148+
NSFileManager *fm = [NSFileManager defaultManager];
149+
150+
146151
for (NSMutableDictionary *i in list) {
147152
if ([[i objectForKey:@"path"] isNotEqualTo:@""] && [[i objectForKey:@"hostname"] isNotEqualTo:@"localhost"]) {
148-
[NSCommon setConfigWithServerName:[i objectForKey:@"hostname"]
149-
port:[i objectForKey:@"port"]
150-
path:[i objectForKey:@"path"]];
153+
154+
//Check if there is a custom configuration
155+
NSString *serverName = [[i objectForKey:@"hostname"] stringByReplacingOccurrencesOfString:@"." withString:@"_"];
156+
NSString *own_host = [NSString stringWithFormat:@"%@%@", @"own_", serverName];
157+
NSString *own_conf = [NSString stringWithFormat:@"%@/%@.conf", vhost, own_host];
158+
159+
//NSLog(@"%@",own_conf);
160+
if (![fm fileExistsAtPath:own_conf]){
161+
[NSCommon setConfigWithServerName:[i objectForKey:@"hostname"]
162+
port:[i objectForKey:@"port"]
163+
path:[i objectForKey:@"path"]];
164+
}
165+
151166
}
152167
}
153168
return YES;

0 commit comments

Comments
 (0)