Skip to content

Commit

Permalink
5.0
Browse files Browse the repository at this point in the history
改造PHP扩展管理方式基本结束
  • Loading branch information
midoks committed Nov 12, 2023
1 parent f6038ee commit 1eb4f64
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 16 deletions.
8 changes: 4 additions & 4 deletions mdserver/mdserver.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -574,7 +574,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
Expand All @@ -590,7 +590,7 @@
INFOPLIST_FILE = mdserver/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 4.0.2;
MARKETING_VERSION = 5.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.midoks.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand All @@ -606,7 +606,7 @@
INFOPLIST_FILE = mdserver/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 4.0.2;
MARKETING_VERSION = 5.0;
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.midoks.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Binary file not shown.
82 changes: 71 additions & 11 deletions mdserver/mdserver/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -1163,13 +1163,14 @@ -(void)cmdDir:(id)sender

#pragma mark - 初始化PHP版本列表 -

-(NSMenu*)getPhpExtendsMenu:(NSString *) v
-(NSMenu*)getPhpExtendsMenu:(NSString *) v extlib:(NSMutableDictionary *)extlib
{
// NSLog(@"---log %@", v);
NSFileManager *fm = [NSFileManager defaultManager];
NSMenu *extListMenu = [[NSMenu alloc] initWithTitle:v];

NSString *rootDir = [NSCommon getRootDir];
NSString *extDir = [NSString stringWithFormat:@"%@bin/reinstall/php%@", rootDir, v];
NSString *extDir = [NSString stringWithFormat:@"%@bin/reinstall/extensions", rootDir];
NSArray *extList = [fm contentsOfDirectoryAtPath:extDir error:nil];

NSString *content = @"";
Expand Down Expand Up @@ -1211,6 +1212,18 @@ -(NSMenu*)getPhpExtendsMenu:(NSString *) v
}];

for (NSString *ee in __extList) {
//判断是否在支持的列表中 start
if (![[extlib allKeys] containsObject:ee]) {
continue;
}

NSArray *lib_version = [extlib objectForKey:ee];

if (![lib_version containsObject:v]) {
continue;
}
// NSLog(@"ext:%@:%@:%@", v,ee,lib_version);
//判断是否在支持的列表中 end

NSMenu *extMenu = [[NSMenu alloc] initWithTitle:v];
[extMenu addItemWithTitle:@"Install" action:@selector(phpExtInstall:) keyEquivalent:@""];
Expand Down Expand Up @@ -1245,7 +1258,7 @@ -(void)phpExtInstall:(id)sender
NSMenuItem *ppMenu=[pMenu parentItem];
NSMenuItem *pppMenu=[ppMenu parentItem];

NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/php%@/%@/install.sh", rootDir, pppMenu.title,pMenu.title];
NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/extensions/%@/install.sh", rootDir,pMenu.title];

if (![NSCommon fileIsExists:installSh]){
[self userCenter:[NSString stringWithFormat:@"PHP%@-%@扩展install脚本不存在!", pppMenu.title,pMenu.title]];
Expand Down Expand Up @@ -1279,7 +1292,7 @@ -(void)phpExtUninstall:(id)sender
NSMenuItem *ppMenu=[pMenu parentItem];
NSMenuItem *pppMenu=[ppMenu parentItem];

NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/php%@/%@/uninstall.sh", rootDir, pppMenu.title,pMenu.title];
NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/extensions/%@/uninstall.sh", rootDir,pMenu.title];

if (![NSCommon fileIsExists:installSh]){
[self userCenter:[NSString stringWithFormat:@"PHP%@-%@扩展uninstall脚本不存在!", pppMenu.title,pMenu.title]];
Expand Down Expand Up @@ -1311,7 +1324,7 @@ -(void)phpExtReload:(id)sender
NSMenuItem *ppMenu=[pMenu parentItem];
NSMenuItem *pppMenu=[ppMenu parentItem];

NSString *reloadSh = [NSString stringWithFormat:@"%@bin/reinstall/php%@/%@/reload.sh", rootDir, pppMenu.title,pMenu.title];
NSString *reloadSh = [NSString stringWithFormat:@"%@bin/reinstall/extensions/%@/reload.sh", rootDir,pMenu.title];

if (![NSCommon fileIsExists:reloadSh]){
[self userCenter:[NSString stringWithFormat:@"PHP%@-%@扩展reload脚本不存在!", pppMenu.title,pMenu.title]];
Expand All @@ -1338,11 +1351,11 @@ -(void)phpExtDir:(id)sender

NSMenuItem *cMenu = (NSMenuItem*)sender;
NSMenuItem *pMenu=[cMenu parentItem];
NSMenuItem *ppMenu=[pMenu parentItem];
NSMenuItem *pppMenu=[ppMenu parentItem];
// NSMenuItem *ppMenu=[pMenu parentItem];
// NSMenuItem *pppMenu=[ppMenu parentItem];

[NSCommon delayedRun:0 callback:^{
NSString *str = [NSString stringWithFormat:@"%@bin/reinstall/php%@/%@",rootDir,pppMenu.title,pMenu.title];
NSString *str = [NSString stringWithFormat:@"%@bin/reinstall/extensions/%@",rootDir,pMenu.title];
BOOL isDir = YES;
if ([fm fileExistsAtPath:str isDirectory:&isDir]){
[[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:str, nil]] waitUntilExit];
Expand Down Expand Up @@ -1460,7 +1473,7 @@ -(BOOL)findEnv:(NSString *)title{
return NO;
}

-(NSMenu*)getPhpVerMenu:(NSString *)title
-(NSMenu*)getPhpVerMenu:(NSString *)title extlib:(NSMutableDictionary *)extlib
{
NSMenu *vMenu = [[NSMenu alloc] initWithTitle:title];

Expand All @@ -1477,7 +1490,8 @@ -(NSMenu*)getPhpVerMenu:(NSString *)title
[vMenu addItemWithTitle:@"Dir" action:@selector(phpDir:) keyEquivalent:@""];
[vMenu addItemWithTitle:@"Extends Dir" action:@selector(phpExtendsDir:) keyEquivalent:@""];

NSMenu *extMenu = [self getPhpExtendsMenu:title];
// NSLog(@"init %@", @"ddd");
NSMenu *extMenu = [self getPhpExtendsMenu:title extlib:extlib];
NSMenuItem *extItem = [[NSMenuItem alloc] initWithTitle:@"Extends"
action:NULL
keyEquivalent:@""];
Expand All @@ -1486,6 +1500,50 @@ -(NSMenu*)getPhpVerMenu:(NSString *)title
return vMenu;
}

#pragma mark - 读取PHP依赖关系 -
-(NSMutableDictionary *)readPhpExtLib {
NSString *rootDir = [NSCommon getRootDir];
NSString *extensionsLibFile = [NSString stringWithFormat:@"%@bin/reinstall/extensions/lib.md", rootDir];
NSMutableDictionary *result = [[NSMutableDictionary alloc] init];
NSFileManager *fm = [NSFileManager defaultManager];

if (![fm fileExistsAtPath:extensionsLibFile]){
return result;
}

NSString *content = [NSString stringWithContentsOfFile:extensionsLibFile encoding:NSUTF8StringEncoding error:nil];
content = [content stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSArray *list = [content componentsSeparatedByString:@"\n"];


for (int i=0; i<list.count; i++) {
NSString *dep = [list[i] stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];

NSArray *dep_list = [dep componentsSeparatedByString:@"|"];
if (dep_list.count < 2){
continue;
}
NSMutableArray *dep_version = [[NSMutableArray alloc] init];

NSString *libname = [dep_list[0] stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];

NSString *version =[dep_list[1] stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSArray *dep_version_t = [version componentsSeparatedByString:@","];

for (int i=0; i<dep_version_t.count; i++) {
NSString *version_t = [dep_version_t[i] stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[dep_version addObject:version_t];
}
[result setObject:dep_version forKey:libname];
}
return result;
}

-(void)initPhpList
{
[phpVer.submenu removeAllItems];
Expand Down Expand Up @@ -1522,8 +1580,10 @@ -(void)initPhpList
return NO;
}];


NSMutableDictionary *extlib = [self readPhpExtLib];
for (NSString *f in _phpVlist) {
NSMenu *vMenu = [self getPhpVerMenu:f];
NSMenu *vMenu = [self getPhpVerMenu:f extlib:extlib];

NSMenuItem *vItem = [[NSMenuItem alloc] initWithTitle:f
action:@selector(phpStatusSet:)
Expand Down
2 changes: 1 addition & 1 deletion mdserver/mdserver/Model/HostNameModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ -(id)init
_hostname = @"localhost";
_port = @"8888";
_path = @"";
_php = @"55";
_php = @"56";
}
return self;
}
Expand Down

0 comments on commit 1eb4f64

Please sign in to comment.