Full Code of midoks/mdserver-mac for AI

master 3376968a4c6e cached
78 files
354.0 KB
96.8k tokens
3 symbols
1 requests
Download .txt
Showing preview only (383K chars total). Download the full file or copy to clipboard to get everything.
Repository: midoks/mdserver-mac
Branch: master
Commit: 3376968a4c6e
Files: 78
Total size: 354.0 KB

Directory structure:
gitextract_myctrjsf/

├── .gitignore
├── FQ.md
├── LICENSE.md
├── README.md
├── README_2x.md
├── README_3x.md
├── README_4x.md
├── _config.yml
├── build/
│   ├── build.plist
│   ├── build.sh
│   └── build2.sh
├── host/
│   ├── host/
│   │   ├── NSCommon.h
│   │   ├── NSCommon.m
│   │   └── main.m
│   └── host.xcodeproj/
│       ├── project.pbxproj
│       ├── project.xcworkspace/
│       │   ├── contents.xcworkspacedata
│       │   ├── xcshareddata/
│       │   │   └── IDEWorkspaceChecks.plist
│       │   └── xcuserdata/
│       │       └── midoks.xcuserdatad/
│       │           └── UserInterfaceState.xcuserstate
│       └── xcuserdata/
│           └── midoks.xcuserdatad/
│               └── xcschemes/
│                   ├── host.xcscheme
│                   └── xcschememanagement.plist
├── mdserver/
│   ├── mdserver/
│   │   ├── AppDelegate.h
│   │   ├── AppDelegate.m
│   │   ├── Base.lproj/
│   │   │   ├── Credits.rtf
│   │   │   ├── MainMenu.xib
│   │   │   └── mdserver Help/
│   │   │       └── index.html
│   │   ├── Controller/
│   │   │   ├── GeneralController.h
│   │   │   ├── GeneralController.m
│   │   │   ├── HostNameController.h
│   │   │   ├── HostNameController.m
│   │   │   ├── ModMySQLPwdController.h
│   │   │   ├── ModMySQLPwdController.m
│   │   │   ├── MySQLController.h
│   │   │   └── MySQLController.m
│   │   ├── Images.xcassets/
│   │   │   ├── AppIcon.appiconset/
│   │   │   │   └── Contents.json
│   │   │   └── Contents.json
│   │   ├── Info.plist
│   │   ├── MainAlipay.xib
│   │   ├── MainWeibo.xib
│   │   ├── ModMySQLPwd.xib
│   │   ├── Model/
│   │   │   ├── HostNameModel.h
│   │   │   └── HostNameModel.m
│   │   ├── NSCommon.h
│   │   ├── NSCommon.m
│   │   ├── NSTextField+Copypast.h
│   │   ├── NSTextField+Copypast.m
│   │   ├── Resources/
│   │   │   ├── Icon.icns
│   │   │   ├── Sequel Pro.icns
│   │   │   ├── addhost
│   │   │   ├── header_back_left.tif
│   │   │   ├── install_helper.sh
│   │   │   ├── mIcon.icns
│   │   │   ├── modMysqlPwd.sh
│   │   │   ├── my.cnf
│   │   │   ├── removehost
│   │   │   ├── script.sh
│   │   │   ├── ss
│   │   │   └── st
│   │   ├── common.plist
│   │   ├── en.lproj/
│   │   │   └── Credits.rtf
│   │   ├── main.m
│   │   └── server.plist
│   ├── mdserver.xcodeproj/
│   │   ├── project.pbxproj
│   │   ├── project.xcworkspace/
│   │   │   ├── contents.xcworkspacedata
│   │   │   └── xcshareddata/
│   │   │       └── IDEWorkspaceChecks.plist
│   │   └── xcuserdata/
│   │       └── midoks.xcuserdatad/
│   │           ├── xcdebugger/
│   │           │   └── Breakpoints_v2.xcbkptlist
│   │           └── xcschemes/
│   │               ├── mdserver.xcscheme
│   │               └── xcschememanagement.plist
│   └── mdserverTests/
│       ├── Info.plist
│       └── mdserverTests.m
└── ss/
    ├── ss/
    │   ├── NSCommon.h
    │   ├── NSCommon.m
    │   └── main.m
    └── ss.xcodeproj/
        ├── project.pbxproj
        ├── project.xcworkspace/
        │   ├── contents.xcworkspacedata
        │   ├── xcshareddata/
        │   │   └── IDEWorkspaceChecks.plist
        │   └── xcuserdata/
        │       └── midoks.xcuserdatad/
        │           └── UserInterfaceState.xcuserstate
        └── xcuserdata/
            └── midoks.xcuserdatad/
                └── xcschemes/
                    ├── ss.xcscheme
                    └── xcschememanagement.plist

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================

mdserver/mdserver.xcodeproj/project.xcworkspace/xcuserdata/midoks.xcuserdatad/UserInterfaceState.xcuserstate
*.DS_Store
.DS_Store
build/release
build/release.xcarchive
build/debug
build/debug.xcarchive
build/debug/mdserver.app/Contents/Resources/ss


================================================
FILE: FQ.md
================================================
### mdserver(mac版) FQ
```
mysql 
用户名 root 密码 root
mongoldb
redis
都是默认端口

如果你想自己调试,可以看我的记录:

目录:re2c-0.13.5

cd re2c-0.13.5
./configure && make && make install

安装brew工具
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1

brew install openssl
brew install pkg-config
brew install ImageMagick
brew install gettext
brew install icu4c
brew install Graphviz   —-生成xhprof分析时有关
brew install libtool


在安装php imagick扩展遇到很多问题
最终的解决方法:
brew install Imagemagick
sudo brew link imagemagick
在(http://www.imagemagick.org/script/binary-releases.php#macosx)
上下载二进制文件放在cmd目录下
最终编译成功


xhprof使用 在test下
在停止时会对session和xhprof内容清空

wget http://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-3.2.7.tgz

#程序调试
http://localhost:8888/tz.php?mdd=ok
当$GET[‘mdd’]=ok时,会使用xhprof进行分析[php55支持,php70,php71 md_xhprof]
```

================================================
FILE: LICENSE.md
================================================
The MIT License (MIT)

Copyright (c) 2016 midoks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
## mdserver(mac版) 5.0

Mac上高度可定制的PHP开发环境,集成必要的扩展,方便使用。
(pkg安装方式),安装方便,是你Mac上的PHP开发利器。


- 支持80端口。
- OpenResty(1.21.4.3)支持Lua开发。
- Redis(7.2.2),MongoDB(5.0.0),Memcached(1.6.22)。
- MySQL多版本兼容。
- **php-fpm以sock文件方式管理。多php进程共存,快速切换开发。**
- **高效控制PHP扩展安装、启动、停止、卸载。**
- **完美再现安装过程,利于学习。**
- 安装完全脚本化,易于管理。
- 减小文件大小,利于下载。
- 支持PHP版本菜单[Command]下直接进入命令行,并自动设置当前PHP变量。
- 支持CMD菜单下应用的安装、启动、停止、卸载。

## PHP|MYSQL

- ***PHP版本集成***

```
php[55,56,71,72,73,74,80,81,82,83]
[redis,memecached,mongo,memcached,yaf,swoole,xhprof,...]
```

- ***MYSQL版本集成***

```
MySQL[50,51,55,56,57,80]
```

### ***phpMyAdmin***

- 已经设置通过配置读取。
- mysql的用户和密码(root)。
- 默认只有mysql80,其他要通过脚本安装(点击安装),菜单上。

```
默认mysql80 , 端口:3306 | http://localhost:8888/phpMyAdmin/3306
默认mysql57 , 端口:3357 | http://localhost:8888/phpMyAdmin/3357
默认mysql56 , 端口:3356 | http://localhost:8888/phpMyAdmin/3356
默认mysql51 , 端口:3351 | http://localhost:8888/phpMyAdmin/3351

```

### 下载链接

- 5.0[500+MB] - [官方下载](https://github.com/midoks/mdserver-mac/releases/download/5.0/mdserver5.0.arm64.mpkg.zip)

```
下载版本中,mysql80集成。其他皆需要现在执行Install,再执行。
为了全版本兼容,可同时开始开启。端口默认如下,也可以自定义。
MySQL51 - port:3351
MySQL55 - port:3355
MySQL56 - port:3356
MySQL57 - port:3357
MySQL80 - port:3306
```

### 相关项目

- 最新的安装脚本[mdserver-mac-reinstall](https://github.com/midoks/mdserver-mac-reinstall)对应目录->[/Applications/mdserver/bin/reinstall]

### 重要操作说明

```
菜单[CMD]->brew->install(解决大部分的依赖问题)
菜单[CMD]->php-ext-init->install(解决大部分的依赖问题)

```

### 安装失败

- 安装失败是获取权限脚本没有执行成功,执行下面命令即可:

```
sudo sh /Applications/mdserver/install.sh
```

### 版本版本

- 5.0

```
* mac m2编译(arm64)架构。
* 重新调整php扩展管理方式,减少维护成本。
* 加入PHP83版本。
* 调整了phpmysqladmin访问方式。
```

### 文件目录说明
- host(修改hosts命令)
- mdserver(主功能)
- Screenshot(截图)

### 命令操作说明

- 依赖库(举例)

```
cd /Applications/mdserver/bin/reinstall/cmd/base && bash cmd_pcre.sh
cd /Applications/mdserver/bin/reinstall/cmd/base && bash cmd_zlib.sh
cd /Applications/mdserver/bin/reinstall/cmd/base && bash cmd_gettext.sh
cd /Applications/mdserver/bin/reinstall/cmd/base && bash cmd_openssl.sh
```

- PHP扩展(举例)

```
cd /Applications/mdserver/bin/reinstall/extensions/mbstring && bash install.sh 55
cd /Applications/mdserver/bin/reinstall/extensions/openssl && bash install.sh 71
```

依次类推,方便遇到问题,自己好调试。


### 一般不要动
- 存放超级命令,修改host相关 | /Library/Application\ Support/mdserver 
- 保持host配置相关 | ~/Library/Application\ Support/com.midoks.mdserver/server.plist


### 最新版本截图

[![菜单](/Screenshot/Screenshot_menu.png)](/Screenshot/Screenshot_menu.png)
[![界面](/Screenshot/Screenshot_3.png)](/Screenshot/Screenshot_3.png)



### 联系我
- email:midoks@163.com

### Stargazers over time

[![Stargazers over time](https://starchart.cc/midoks/mdserver-mac.svg)](https://starchart.cc/midoks/mdserver-mac)

### License

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmidoks%2Fmdserver-mac.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmidoks%2Fmdserver-mac?ref=badge_shield)

================================================
FILE: README_2x.md
================================================
### mdserver(mac版) 2.4.2.0
mac上高度可定制的PHP开发环境,集成必要的扩展,方便使用。
(pkg安装方式),安装方便,是你Mac上的PHP开发利器。
- 加入redis,mongo,yaf,swoole组件。
- 支持80端口。
- 加入memcached支持。
- PHP版本切换功能。
- MySQL5.6。
- openresty支持lua开发
- ~~Neo4j([图数据](http://baike.baidu.com/item/Neo4j))~~2.3.4

```
php55
[redis,memecached,mongo,yaf,swoole,xhprof]

php71
[redis,memecached,yaf,swoole,md_xhprof]

php72
[redis,memecached,yaf,swoole,md_xhprof]
```

### 文件说明
- host(修改hosts命令)
- mdserver(主功能)
- Screenshot(截图)

### 相关链接

- 2.4.2.0安装地址:[2.4.2.0](https://pan.baidu.com/s/1i5pJ9kh)
- 2.4.1.1安装地址:[2.4.1.1](https://pan.baidu.com/s/1nuEmcjv)
- 2.4.1.0安装地址:[2.4.1.0](https://pan.baidu.com/s/1o8oFqWy)
- 2.4.0安装地址:[2.4.0](https://pan.baidu.com/s/1kUGpz3D)
- 2.3.4安装地址:[2.3.4](https://pan.baidu.com/s/1jHS0d06)
- 2.3.3安装地址:[2.3.3](https://pan.baidu.com/s/1slq8jil)
- 2.3.0安装地址:[2.3.0](https://pan.baidu.com/s/1eRXpp4m)
- 2.2.4安装地址:[2.2.4](https://pan.baidu.com/s/1cFwq42)
- 2.1.2安装地址:[2.1.2](https://pan.baidu.com/s/1boCUDVx)
- 2.1.0安装地址:[2.1.0](http://pan.baidu.com/s/1o7YmzTC)
- 2.0pkg安装地址:[2.0.0](http://pan.baidu.com/s/1kV52okB)
- pkg安装地址:[1.0.0](http://pan.baidu.com/s/1eSHgmAI)
- 使用教程:[mdserver](http://midoks.cachecha.com/2015/02/24/mdserver-mac.html)

### 最新版本截图
[![Screenshot.png](/Screenshot/Screenshot.png)](/Screenshot/Screenshot.png)

### 联系我
- Email:midoks@163.com

================================================
FILE: README_3x.md
================================================
## mdserver(mac版) 3.3.2.1

Mac上高度可定制的PHP开发环境,集成必要的扩展,方便使用。
(pkg安装方式),安装方便,是你Mac上的PHP开发利器。

- **PHP8 Alpha**
- 支持80端口。
- OpenResty(1.15.8.3)支持Lua开发。
- Redis(6.0.0)。
- MongoDB(4.2.6)。
- Memcached(1.6.5)。
- 配置MySQL5.7。
- **php-fpm以sock文件方式管理。多php进程共存,快速切换开发。**
- **高效控制PHP扩展安装、启动、停止、卸载。**
- **完美再现安装过程,利于学习**
- 安装完全脚本化,易于管理。
- 减小文件大小,利于下载。
- 支持PHP版本菜单[Command]下直接进入命令行,并自动设置当前PHP变量。
- 支持CMD菜单下应用的安装、启动、停止、卸载。



```
php[55,56,71,72,73,74,80]
[redis,memecached,mongo,memcached,yaf,swoole,xhprof,...]
```

### 下载链接

- 3.3.2.1
    * [官方下载](https://github.com/midoks/mdserver-mac/releases/download/3.3.2.1/mdserver3.3.2.1.mpkg.zip)
    * [天翼云盘-下载速度快](https://cloud.189.cn/t/qANzUbEfM3ma)


### 相关项目

- 最新的安装脚本[mdserver-mac-reinstall](https://github.com/midoks/mdserver-mac-reinstall)对应目录->[/Applications/mdserver/bin/reinstall]

### 重要操作说明

```
菜单[CMD]->php-ext-init->install(解决大部分的依赖问题)
```

### 安装失败
- 安装失败是获取权限脚本没有执行成功,执行下面命令即可:
```
sudo sh /Applications/mdserver/install.sh
```

### 软件版本说明[可能不一致]
- 一个为软件界面开发版本。
- 一个为打包版本。

### 版本版本

- 3.3.2.1

```
* 对reinstall部分脚本优化。
* 菜单[CMD]->php-ext-init->install脚本优化。
* OpenResty更新到1.15.8.3版本。
* PHP8Alpha版本添加。
* 优化HOSTS功能,可以配置文件。
```

### 文件说明
- host(修改hosts命令)
- mdserver(主功能)
- Screenshot(截图)


### 最新版本截图
[![最新版本截图](/Screenshot/Screenshot_3.png)](/Screenshot/Screenshot_3.png)


### 联系我
- e-mail:midoks@163.com
- https://t.me/midoks

### Stargazers over time

[![Stargazers over time](https://starchart.cc/midoks/mdserver-mac.svg)](https://starchart.cc/midoks/mdserver-mac)

### License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmidoks%2Fmdserver-mac.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmidoks%2Fmdserver-mac?ref=badge_large)

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmidoks%2Fmdserver-mac.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmidoks%2Fmdserver-mac?ref=badge_shield)

================================================
FILE: README_4x.md
================================================
## mdserver(mac版) 4.0.2.0

Mac上高度可定制的PHP开发环境,集成必要的扩展,方便使用。
(pkg安装方式),安装方便,是你Mac上的PHP开发利器。


- 支持80端口。
- OpenResty(1.15.8.3)支持Lua开发。
- Redis(7.0.4),MongoDB(5.0.0),Memcached(1.6.17)。
- **php-fpm以sock文件方式管理。多php进程共存,快速切换开发。**
- **高效控制PHP扩展安装、启动、停止、卸载。**
- **完美再现安装过程,利于学习。**
- 安装完全脚本化,易于管理。
- 减小文件大小,利于下载。
- 支持PHP版本菜单[Command]下直接进入命令行,并自动设置当前PHP变量。
- 支持CMD菜单下应用的安装、启动、停止、卸载。

## PHP|MYSQL

- ***PHP版本集成***

```
php[55,56,71,72,73,74,80,81,82]
[redis,memecached,mongo,memcached,yaf,swoole,xhprof,...]
```

- ***MYSQL版本集成***

```
MySQL[50,51,55,56,57,80]
```

### ***phpMyAdmin***

根据选中php版本,自动识别打开版本。需要试用mysql默认以外的版本,需要修改phpMyAdmin相应配置问题。

```
version 4.1.9 , 能登入mysql{50-57}, 需要php<70 , 默认mysql56 , 端口:3356 | http://localhost:8888/phpMyAdmin/
version 5.1.1 , 能登入mysql{55-80}, 需要php>70 , 默认mysql80 , 端口:3306 | http://localhost:8888/phpMyAdmin7/
```

### 下载链接

- 4.0.2.0[500+MB] - [官方下载](https://github.com/midoks/mdserver-mac/releases/download/4.0.2.0/mdserver4.0.2.0.mpkg.zip)

```
下载版本中,mysql80集成。其他皆需要现在执行Install,再执行。
为了全版本兼容,可同时开始开启。端口默认如下,也可以自定义。
MySQL51 - port:3351
MySQL55 - port:3355
MySQL56 - port:3356
MySQL57 - port:3357
MySQL80 - port:3306
```

### 相关项目

- 最新的安装脚本[mdserver-mac-reinstall](https://github.com/midoks/mdserver-mac-reinstall)对应目录->[/Applications/mdserver/bin/reinstall]

### 重要操作说明

```
菜单[CMD]->php-ext-init->install(解决大部分的依赖问题)
```

### 安装失败
- 安装失败是获取权限脚本没有执行成功,执行下面命令即可:
```
sudo sh /Applications/mdserver/install.sh
```

### 版本版本

- 4.0.2.0

```
* 修复Sequel Pro打开问题。
* 加入PHP82版本。
* 更新memcached,redis。
```

### 文件说明
- host(修改hosts命令)
- mdserver(主功能)
- Screenshot(截图)


### 最新版本截图

[![菜单](/Screenshot/Screenshot_menu.png)](/Screenshot/Screenshot_menu.png)
[![界面](/Screenshot/Screenshot_3.png)](/Screenshot/Screenshot_3.png)



### 联系我
- email:midoks@163.com

### Stargazers over time

[![Stargazers over time](https://starchart.cc/midoks/mdserver-mac.svg)](https://starchart.cc/midoks/mdserver-mac)

### License

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmidoks%2Fmdserver-mac.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmidoks%2Fmdserver-mac?ref=badge_shield)

================================================
FILE: _config.yml
================================================
theme: jekyll-theme-slate

================================================
FILE: build/build.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
<plist version="1.0">  
<dict>  
    <key>compileBitcode</key>  
    <false/>  
    <key>method</key>  
    <string>mac-application</string>
</dict>  
</plist>  


================================================
FILE: build/build.sh
================================================
#!/bin/bash
# 打包

BUILD_DIR=$(cd "$(dirname "$0")"; pwd)
ROOT_DIR=$(dirname "$BUILD_DIR")

APP_NAME="mdserver"
APP_VER=$(sed -n '/MARKETING_VERSION/{s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;}' $ROOT_DIR/mdserver/mdserver.xcodeproj/project.pbxproj)
APP_RELEASE=${BUILD_DIR}/release
APP_DEBUG=${BUILD_DIR}/debug

DMG_FINAL="${APP_NAME}.dmg"




function build(){
	mkdir -p $APP_RELEASE
	mkdir -p $APP_DEBUG

	echo "build mdserver."${APP_VER}

	echo "Building archive... please wait a minute"
    xcodebuild -project $ROOT_DIR/mdserver/mdserver.xcodeproj -config Release -scheme mdserver -archivePath ${APP_RELEASE} archive

    echo "Exporting archive..."
    xcodebuild -archivePath ${BUILD_DIR}/release.xcarchive -exportArchive -exportPath ${APP_RELEASE} -exportOptionsPlist $BUILD_DIR/build.plist

    echo "Building archive... please wait a minute"
    xcodebuild -project $ROOT_DIR/mdserver/mdserver.xcodeproj -config Debug -scheme mdserver -archivePath ${APP_DEBUG} archive

    echo "Exporting archive..."
    xcodebuild -archivePath ${BUILD_DIR}/release.xcarchive -exportArchive -exportPath ${APP_DEBUG} -exportOptionsPlist $BUILD_DIR/build.plist

}


echo $ROOT_DIR

build

echo 'done'


================================================
FILE: build/build2.sh
================================================
#!/bin/bash
# 打包
cd mdserver && xcodebuild -project mdserver.xcodeproj -scheme mdserver -configuration Debug build 
cd ../host && xcodebuild -project host.xcodeproj -scheme host -configuration Debug build 
cd ../ss && xcodebuild -project ss.xcodeproj -scheme ss -configuration Debug build 

================================================
FILE: host/host/NSCommon.h
================================================
//
//  NSCommon.h
//  host
//
//  Created by midoks on 15/2/11.
//  Copyright (c) 2015年 midoks. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#include <mach-o/dyld.h>

@interface NSCommon : NSObject


#pragma mark 获取运行根目录
+ (NSString *)getRootDir;


+(NSString *)getHostFileNeedContent;
+(NSString *)setHostFileNotNeedContent:(NSString *)content;
@end


================================================
FILE: host/host/NSCommon.m
================================================
//
//  NSCommon.m
//  host
//
//  Created by midoks on 15/2/11.
//  Copyright (c) 2015年 midoks. All rights reserved.
//

#import "NSCommon.h"


@implementation NSCommon

#pragma mark 获取上一级目录
+(NSString *)getDirName:(NSString *)dirname
{
    NSArray *i = [dirname componentsSeparatedByString:@"/"];
    NSMutableArray *ii = [[NSMutableArray alloc] initWithArray:i];
    [ii removeLastObject];
    NSString *r = [ii componentsJoinedByString:@"/"];
    return r;
}

#pragma mark 获取运行根目录
+ (NSString *)getRootDir
{
    char path[1024];
    unsigned size = 1024;
    
    _NSGetExecutablePath(path, &size);
    path[size] = '\0';
    
    NSString *str = [NSString stringWithFormat:@"%s", path];
    str = [self getDirName:str];
    str = [NSString stringWithFormat:@"%@", str];
    return str;
}

#pragma mark - 创建目录
+(void)createDirIfNoExist:(NSURL *)url{
    NSFileManager *fm = [NSFileManager defaultManager];
    NSString *path = [url path];
    if (![fm fileExistsAtPath:path]){
        [fm createDirectoryAtURL:url withIntermediateDirectories:YES attributes:nil error:nil];
    }
}


#pragma mark - 获取App支持的目录,不存在就自动创建
+(NSURL *)appSupportDirURL {
    NSFileManager *fm = [NSFileManager defaultManager];
    NSArray<NSURL *> *asPath = [fm URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask];
    NSString *bundleID = @"com.midoks.mdserver";
    NSURL * appAsUrl = [asPath.firstObject URLByAppendingPathComponent:bundleID];
    
    [self createDirIfNoExist:appAsUrl];
    return appAsUrl;
}


#pragma mark - Host文件操作 -
+(NSString *)getHostFileNeedContent{
    NSURL *dirUrl = [NSCommon appSupportDirURL];
    NSURL *pathplist = [dirUrl URLByAppendingPathComponent:@"server.plist"];
    
    NSMutableArray *list = [[NSMutableArray alloc] init];
    
//    NSString *pathplist = [[NSBundle mainBundle] pathForResource:@"server" ofType:@"plist"];
    NSMutableDictionary *listContent = [[NSMutableDictionary alloc] initWithContentsOfFile:[pathplist path]];
    
    for (NSMutableDictionary *k in listContent) {
        [list addObject:[listContent objectForKey:k]];
    }
    
    NSString *ret = @"";
    for (NSMutableDictionary *i in list) {
        if ([[i objectForKey:@"path"] isNotEqualTo:@""] && [[i objectForKey:@"hostname"] isNotEqualTo:@"localhost"]) {
            ret = [NSString stringWithFormat:@"\n%@\n127.0.0.1\t\t%@\t%@",
                   ret,
                   [i objectForKey:@"hostname"],
                   @"#MDserver Hosts Don`t Remove and Change"];
        }
    }
    
    NSString *content = [NSString stringWithContentsOfFile:@"/etc/hosts" encoding:NSUTF8StringEncoding error:nil];
    ret = [NSString stringWithFormat:@"%@\n%@", content, ret];
    return ret;
}

#pragma mark - 删除 -
+(NSString *)setHostFileNotNeedContent:(NSString *)content
{
    NSString *regexString = @".*#MDserver Hosts Don`t Remove and Change";
    NSError *error;
    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regexString
                                                                           options:NSRegularExpressionAnchorsMatchLines
                                                                             error:&error];
    NSString *ok = [regex stringByReplacingMatchesInString:content
                                                   options:NSMatchingReportProgress
                                                     range:NSMakeRange(0, content.length)
                                              withTemplate:@""];
    content = [ok stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    return content;
}

@end


================================================
FILE: host/host/main.m
================================================
//
//  main.m
//  host
//
//  Created by midoks on 15/2/11.
//  Copyright (c) 2015年 midoks. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NSCommon.h"



int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        //NSLog(@"Hello, World!");
        
        //#1 写入需要的内容
        NSString *content = [NSCommon getHostFileNeedContent];
        return [content writeToFile:@"/etc/hosts" atomically:YES encoding:NSUTF8StringEncoding error:nil];
        
        //#2 删除不需要的内容
//        NSString *content = [NSString stringWithContentsOfFile:@"/etc/hosts" encoding:NSUTF8StringEncoding error:nil];
//        content = [NSCommon setHostFileNotNeedContent:content];
//        return [content writeToFile:@"/etc/hosts" atomically:YES encoding:NSUTF8StringEncoding error:nil];
    }
    return 0;
}


================================================
FILE: host/host.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
		820F1E891A8B88AD00CBC093 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 820F1E881A8B88AD00CBC093 /* main.m */; };
		820F1E911A8B89B100CBC093 /* NSCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 820F1E901A8B89B100CBC093 /* NSCommon.m */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
		820F1E831A8B88AD00CBC093 /* CopyFiles */ = {
			isa = PBXCopyFilesBuildPhase;
			buildActionMask = 2147483647;
			dstPath = /usr/share/man/man1/;
			dstSubfolderSpec = 0;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 1;
		};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
		820F1E851A8B88AD00CBC093 /* host */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = host; sourceTree = BUILT_PRODUCTS_DIR; };
		820F1E881A8B88AD00CBC093 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
		820F1E8F1A8B89B100CBC093 /* NSCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCommon.h; sourceTree = "<group>"; };
		820F1E901A8B89B100CBC093 /* NSCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCommon.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		820F1E821A8B88AD00CBC093 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		820F1E7C1A8B88AD00CBC093 = {
			isa = PBXGroup;
			children = (
				820F1E871A8B88AD00CBC093 /* host */,
				820F1E861A8B88AD00CBC093 /* Products */,
			);
			sourceTree = "<group>";
		};
		820F1E861A8B88AD00CBC093 /* Products */ = {
			isa = PBXGroup;
			children = (
				820F1E851A8B88AD00CBC093 /* host */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		820F1E871A8B88AD00CBC093 /* host */ = {
			isa = PBXGroup;
			children = (
				820F1E881A8B88AD00CBC093 /* main.m */,
				820F1E8F1A8B89B100CBC093 /* NSCommon.h */,
				820F1E901A8B89B100CBC093 /* NSCommon.m */,
			);
			path = host;
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
		820F1E841A8B88AD00CBC093 /* host */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 820F1E8C1A8B88AD00CBC093 /* Build configuration list for PBXNativeTarget "host" */;
			buildPhases = (
				820F1E811A8B88AD00CBC093 /* Sources */,
				820F1E821A8B88AD00CBC093 /* Frameworks */,
				820F1E831A8B88AD00CBC093 /* CopyFiles */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = host;
			productName = host;
			productReference = 820F1E851A8B88AD00CBC093 /* host */;
			productType = "com.apple.product-type.tool";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		820F1E7D1A8B88AD00CBC093 /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastUpgradeCheck = 0610;
				ORGANIZATIONNAME = midoks;
				TargetAttributes = {
					820F1E841A8B88AD00CBC093 = {
						CreatedOnToolsVersion = 6.1.1;
					};
				};
			};
			buildConfigurationList = 820F1E801A8B88AD00CBC093 /* Build configuration list for PBXProject "host" */;
			compatibilityVersion = "Xcode 3.2";
			developmentRegion = English;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
			);
			mainGroup = 820F1E7C1A8B88AD00CBC093;
			productRefGroup = 820F1E861A8B88AD00CBC093 /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				820F1E841A8B88AD00CBC093 /* host */,
			);
		};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
		820F1E811A8B88AD00CBC093 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				820F1E891A8B88AD00CBC093 /* main.m in Sources */,
				820F1E911A8B89B100CBC093 /* NSCommon.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
		820F1E8A1A8B88AD00CBC093 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				COPY_PHASE_STRIP = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				MACOSX_DEPLOYMENT_TARGET = 10.13;
				MTL_ENABLE_DEBUG_INFO = YES;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = macosx;
			};
			name = Debug;
		};
		820F1E8B1A8B88AD00CBC093 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				COPY_PHASE_STRIP = YES;
				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				MACOSX_DEPLOYMENT_TARGET = 10.13;
				MTL_ENABLE_DEBUG_INFO = NO;
				SDKROOT = macosx;
			};
			name = Release;
		};
		820F1E8D1A8B88AD00CBC093 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Debug;
		};
		820F1E8E1A8B88AD00CBC093 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		820F1E801A8B88AD00CBC093 /* Build configuration list for PBXProject "host" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				820F1E8A1A8B88AD00CBC093 /* Debug */,
				820F1E8B1A8B88AD00CBC093 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		820F1E8C1A8B88AD00CBC093 /* Build configuration list for PBXNativeTarget "host" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				820F1E8D1A8B88AD00CBC093 /* Debug */,
				820F1E8E1A8B88AD00CBC093 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
		};
/* End XCConfigurationList section */
	};
	rootObject = 820F1E7D1A8B88AD00CBC093 /* Project object */;
}


================================================
FILE: host/host.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:host.xcodeproj">
   </FileRef>
</Workspace>


================================================
FILE: host/host.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>IDEDidComputeMac32BitWarning</key>
	<true/>
</dict>
</plist>


================================================
FILE: host/host.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/host.xcscheme
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
   LastUpgradeVersion = "0610"
   version = "1.3">
   <BuildAction
      parallelizeBuildables = "YES"
      buildImplicitDependencies = "YES">
      <BuildActionEntries>
         <BuildActionEntry
            buildForTesting = "YES"
            buildForRunning = "YES"
            buildForProfiling = "YES"
            buildForArchiving = "YES"
            buildForAnalyzing = "YES">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "820F1E841A8B88AD00CBC093"
               BuildableName = "host"
               BlueprintName = "host"
               ReferencedContainer = "container:host.xcodeproj">
            </BuildableReference>
         </BuildActionEntry>
      </BuildActionEntries>
   </BuildAction>
   <TestAction
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      shouldUseLaunchSchemeArgsEnv = "YES"
      buildConfiguration = "Debug">
      <Testables>
      </Testables>
      <MacroExpansion>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "820F1E841A8B88AD00CBC093"
            BuildableName = "host"
            BlueprintName = "host"
            ReferencedContainer = "container:host.xcodeproj">
         </BuildableReference>
      </MacroExpansion>
   </TestAction>
   <LaunchAction
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      launchStyle = "0"
      useCustomWorkingDirectory = "NO"
      buildConfiguration = "Debug"
      ignoresPersistentStateOnLaunch = "NO"
      debugDocumentVersioning = "YES"
      allowLocationSimulation = "YES">
      <BuildableProductRunnable>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "820F1E841A8B88AD00CBC093"
            BuildableName = "host"
            BlueprintName = "host"
            ReferencedContainer = "container:host.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>
      <AdditionalOptions>
      </AdditionalOptions>
   </LaunchAction>
   <ProfileAction
      shouldUseLaunchSchemeArgsEnv = "YES"
      savedToolIdentifier = ""
      useCustomWorkingDirectory = "NO"
      buildConfiguration = "Release"
      debugDocumentVersioning = "YES">
      <BuildableProductRunnable>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "820F1E841A8B88AD00CBC093"
            BuildableName = "host"
            BlueprintName = "host"
            ReferencedContainer = "container:host.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>
   </ProfileAction>
   <AnalyzeAction
      buildConfiguration = "Debug">
   </AnalyzeAction>
   <ArchiveAction
      buildConfiguration = "Release"
      revealArchiveInOrganizer = "YES">
   </ArchiveAction>
</Scheme>


================================================
FILE: host/host.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/xcschememanagement.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>SchemeUserState</key>
	<dict>
		<key>host.xcscheme</key>
		<dict>
			<key>orderHint</key>
			<integer>0</integer>
		</dict>
	</dict>
	<key>SuppressBuildableAutocreation</key>
	<dict>
		<key>820F1E841A8B88AD00CBC093</key>
		<dict>
			<key>primary</key>
			<true/>
		</dict>
	</dict>
</dict>
</plist>


================================================
FILE: mdserver/mdserver/AppDelegate.h
================================================
//
//  AppDelegate.h
//  mdserver
//
//  Created by midoks on 15/1/22.
//  Copyright (c) 2015年 midoks. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "NSCommon.h"

@interface AppDelegate : NSObject <NSApplicationDelegate, NSWindowDelegate>{

    NSStatusItem        *statusBarItem;
    IBOutlet NSMenu     *statusBarItemMenu;
    IBOutlet NSMenuItem *phpVer;
    IBOutlet NSMenuItem *mysqlVer;
    IBOutlet NSMenuItem *cmd;
//    NSMutableArray <NSMenuItem *> *phpList;

//基本属性
    IBOutlet NSProgressIndicator *pProgress;
    IBOutlet NSButton *pNginxStatus;
    IBOutlet NSButton *pPHPStatus;
    
    IBOutlet NSButton *pStart;
    IBOutlet NSTextField *pStartTitle;
    IBOutlet NSButton *pReStart;
    

//权限测试
    AuthorizationRef        _authRef;
}

#pragma mark - 帮助中心 -
- (IBAction)showAbout:(id)sender;
- (IBAction)showMain:(id)sender;
- (IBAction)showDonateAlipay:(id)sender;
- (IBAction)showWeibo:(id)sender;


#pragma mark  - 启动或暂停 -
- (IBAction)start:(id)sender;
- (IBAction)goWeb:(id)sender;


#pragma mark - General通用设置 -

#pragma mark - redis和mongodb相关 -
- (IBAction)redisStart:(id)sender;
- (IBAction)goRedisWeb:(id)sender;
- (IBAction)mongoStart:(id)sender;
- (IBAction)goMongoWeb:(id)sender;
- (IBAction)MySQLStart:(id)sender;
- (IBAction)goMySQL:(id)sender;
//- (IBAction)goNeo4j:(id)sender;

-(void)userCenter:(NSString *)content;
@end



================================================
FILE: mdserver/mdserver/AppDelegate.m
================================================
//
//  AppDelegate.m
//  mdserver
//
//  Created by midoks on 15/1/22.
//  Copyright (c) 2015年 midoks. All rights reserved.
//

#import "AppDelegate.h"
#import <ServiceManagement/ServiceManagement.h>
#import <Security/Authorization.h>
#import <UserNotifications/UserNotifications.h>
#include <mach-o/dyld.h>

#define PHP_C_VER_KEY @"php_version"
#define PHP_S_VER_KEY @"php_S_version"
#define MYSQL_C_VER_KEY @"mysql_version"

#define kMDHelper @"/Library/Application Support/mdserver/addhost"

@interface AppDelegate ()

@property IBOutlet NSWindow *window;
@property (nonatomic, strong) NSString *StartServerStatus;

@property (nonatomic, strong) IBOutlet NSButton *mMongoTool;
@property (nonatomic, strong) IBOutlet NSButton *mRedisTool;
@property (nonatomic, strong) IBOutlet NSButton *mMemcachedTool;
@property (nonatomic, strong) IBOutlet NSButton *mMySQLTool;

@property (nonatomic, strong) IBOutlet NSButton *mMongoButton;
@property (nonatomic, strong) IBOutlet NSButton *mRedisButton;
@property (nonatomic, strong) IBOutlet NSButton *mMemcachedButton;
@property (nonatomic, strong) IBOutlet NSButton *mMySQLButton;

//@property (nonatomic, strong) IBOutlet NSSubmenuWindowLevel *phpSwitch;

@end

@implementation AppDelegate


#pragma mark - 公用方法 -
-(void)alert:(NSString *)content
{
    NSAlert *alert = [[NSAlert alloc] init];
    [alert setMessageText:@"提示"];
    [alert setInformativeText:content];
    [alert setAlertStyle:NSAlertStyleInformational];
    [alert runModal];
}

-(void)userCenter:(NSString *)content
{
    if (@available(macOS 10.14, *)) {
        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
        UNAuthorizationOptions options = (UNAuthorizationOptionAlert | UNAuthorizationOptionSound);
        [center requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error) {
            UNMutableNotificationContent *c = [[UNMutableNotificationContent alloc] init];
            c.title = @"通知中心";
            c.body = content ?: @"";
            UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:0.1 repeats:NO];
            UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"mdserver.local" content:c trigger:trigger];
            [center addNotificationRequest:request withCompletionHandler:nil];
        }];
    } else {
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101400
        NSUserNotification *notification = [[NSUserNotification alloc] init];
        notification.title = @"通知中心";
        notification.informativeText = content;
        [[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification];
#endif
    }
}

#pragma mark 延迟执行
- (void)delayedRun:(float)t callback:(void(^)(void)) callback
{
    double delayInSeconds = t;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        callback();
    });
}

#pragma mark 如果你希望调用系统命令
- (void)runSystemCommand:(NSString *)cmd
{
    NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/bin/sh"
                                            arguments:@[@"-c", cmd]];
    [task waitUntilExit];
}

#pragma mark 打开文件
-(void)openFile:(NSString *)file
{
    NSTask *task = [[NSTask alloc] init];
    task.launchPath = @"/usr/bin/open";
    task.arguments = @[file];
    [task launch];
}

#pragma mark 获取cmd执行权限
-(void)AuthorizeCmd:(NSString *)cmdPath
{
    cmdPath = [NSString stringWithFormat:@"do shell script \"%@ > /tmp/me\" with administrator privileges", cmdPath];
    NSDictionary *error = [NSDictionary new];
    NSString *script = cmdPath;
    NSAppleScript *appleScript = [[NSAppleScript new] initWithSource:script];
    if ([appleScript executeAndReturnError:&error]) {
        //NSLog(@"success!");
    } else {
        NSLog(@"failure!:%@", error);
    }
}

#pragma mark 获取cmd执行特权
#define ADMIN_PRIVILEGE     "system.privilege.admin"
#pragma mark 给执行文件授权
-(BOOL)AuthorizeCreate
{
    NSString *app_dir = [NSCommon getAppDir];
//    NSString *addhost = [NSString stringWithFormat:@"%@Contents/Resources/addhost", app_dir];
//    NSString *removehost = [NSString stringWithFormat:@"%@Contents/Resources/removehost", app_dir];
    NSString *ss = [NSString stringWithFormat:@"%@Contents/Resources/ss", app_dir];
    NSString *root_dir = [NSCommon getRootDir];
    
    NSString *startNginx = [NSString stringWithFormat:@"%@bin/startNginx.sh", root_dir];
    NSString *stopNginx = [NSString stringWithFormat:@"%@bin/stopNginx.sh", root_dir];
    NSString *redis = [NSString stringWithFormat:@"%@bin/redis.sh", root_dir];
    NSArray *list = @[
//采用新的授权方式
//                     addhost, removehost,
                     ss, startNginx, stopNginx, redis
    ];
    
    if (self->_authRef) {
        //NSLog(@"ok");
        return true;
    }else{
        UInt32 count = (UInt32)[list count];
        AuthorizationItem authItem[count];
        AuthorizationRights authRights;
        AuthorizationFlags flags  = kAuthorizationFlagDefaults|
        kAuthorizationFlagInteractionAllowed |
        kAuthorizationFlagPreAuthorize |
        kAuthorizationFlagExtendRights |
        kAuthorizationFlagPartialRights |
        kAuthorizationFlagPreAuthorize;
        
        authRights.count = (UInt32)count;
        //NSLog(@"count:%d", count);
        for (int i = 0;i<count; ++i ) {
            NSString *testFile = list[i];
            authItem[i].flags = 0;
            authItem[i].name = kAuthorizationRightExecute;
            authItem[i].valueLength = [testFile length];
            authItem[i].value = (void *)[testFile cStringUsingEncoding:NSASCIIStringEncoding];
            //NSLog(@"run: %d",i);
        }
        authRights.items = authItem;
        OSStatus status = AuthorizationCreate(&authRights, kAuthorizationEmptyEnvironment, flags, &self->_authRef);
        if(status != errAuthorizationSuccess){
            NSLog(@"AuthorizationCreate failed!");
        }else{
            NSLog(@"AuthorizationCreate ok!");
            return true;
        }
    }
    
    [self userCenter:@"授权失败!"];
    return false;
}



//虽然要被分离,但是我觉得最好用。
-(void)AuthorizeExeCmd:(NSString *)file
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
    
    char *args[] = {NULL};
    OSStatus  status_exe = AuthorizationExecuteWithPrivileges(self->_authRef, (void *)[file cStringUsingEncoding:NSASCIIStringEncoding], kAuthorizationFlagDefaults, args, nil);
    if (status_exe != 0)//errAuthorizationSuccess
    {
        NSLog(@"AuthorizationExecuteWithPrivileges failed!:%d:%@", status_exe,file);
        return;
    }
#pragma clang diagnostic pop
}


#pragma mark 获取进程
-(void)getProcess
{
    NSTask *task = [[NSTask alloc] init];
    task.launchPath = @"/bin/ps";
    task.arguments = @[@"-ef", @"", @"grep php"];
    
    NSPipe *pipe = [NSPipe pipe];
    task.standardOutput = pipe;
    
    NSFileHandle *file = pipe.fileHandleForReading;
    [task launch];
    
    NSData *data = [file readDataToEndOfFile];
    NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    NSLog(@"Process list:\n%@", string);
    NSLog(@"Task: %@", task);
}


#pragma mark  - 小图标功能 -
- (IBAction)showAbout:(id)sender {
    [NSApp activateIgnoringOtherApps:YES];
    [NSApp orderFrontStandardAboutPanel:sender];
}

#pragma mark  - 显示界面 -
- (IBAction)showMain:(id)sender {
    [NSApp activateIgnoringOtherApps:YES];
    [self.window makeKeyAndOrderFront:sender];
}

- (IBAction)showDonateAlipay:(id)sender{
    NSWindowController *alipay =[[NSWindowController alloc] initWithWindowNibName:@"MainAlipay"];
    [alipay loadWindow];
    
    [alipay.window makeMainWindow];
    [NSApp activateIgnoringOtherApps:YES];
    [alipay.window makeKeyAndOrderFront:sender];
    [alipay.window orderFront:sender];
    [alipay.window center];
}

- (IBAction)showWeibo:(id)sender{
    NSWindowController *weibo =[[NSWindowController alloc] initWithWindowNibName:@"MainWeibo"];
    
    [weibo loadWindow];
    [weibo.window makeMainWindow];
    [weibo.window makeKeyAndOrderFront:sender];
    [weibo.window center];
}

-(NSString *)stringReplace:(NSString *)c yes:(BOOL)yes
{
    NSString *str = [NSCommon getRootDir];
    if (yes == YES) {
        return [c stringByReplacingOccurrencesOfString:@"MD:/" withString:str];
    }else{
        return [c stringByReplacingOccurrencesOfString:str withString:@"MD:/"];
    }
}

-(void)replaceConfig:(NSString *)path yes:(BOOL)yes
{
    NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
    if (yes == YES) {
        content = [self stringReplace:content yes:yes];
    }else{
        content = [self stringReplace:content yes:NO];
    }
    [content writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil];
}

-(void)replacePHP:(BOOL)yes
{
    NSString *php_version = [NSCommon getCommonConfig:PHP_C_VER_KEY];
    
    NSString *rootDir = [NSCommon getRootDir];
    NSString *php_ini = [NSString stringWithFormat:@"%@bin/php/%@/etc/php.ini", rootDir, php_version];
    [self replaceConfig:php_ini yes:yes];
    
    NSString *php_fpm = [NSString stringWithFormat:@"%@bin/php/%@/etc/php-fpm.conf", rootDir, php_version];
    [self replaceConfig:php_fpm yes:yes];
}

-(void)replaceOpenresty:(BOOL)yes
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSString *nginx_conf    = [NSString stringWithFormat:@"%@bin/openresty/nginx/conf/nginx.conf", rootDir];
    [self replaceConfig:nginx_conf yes:yes];
    
    NSString *nginx_conf_tpl    = [NSString stringWithFormat:@"%@bin/openresty/nginx/conf/nginx.tpl.conf", rootDir];
    [self replaceConfig:nginx_conf_tpl yes:yes];
    
    //vhost下配置
    NSString *resty_vhost = [NSString stringWithFormat:@"%@bin/openresty/nginx/conf/vhost", rootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    NSArray *dirList = [fm contentsOfDirectoryAtPath:resty_vhost error:nil];
    for (NSString *f in dirList) {
        if([f hasSuffix:@"conf"]){
            NSString *conf = [NSString stringWithFormat:@"%@/%@", resty_vhost, f];
            [self replaceConfig:conf yes:yes];
        }
    }
}


//替换my.cnf
-(void)startCnfReplaceString
{
    NSFileManager *fm = [NSFileManager defaultManager];
    
    NSString *str            = [NSCommon getRootDir];
    NSString *my_rcnf        = [NSString stringWithFormat:@"%@bin/tmp/my.cnf", str];
    
    NSString *my_content = @"";
    if ([fm fileExistsAtPath:my_rcnf]){
        my_content = [NSString stringWithContentsOfFile:my_rcnf encoding:NSUTF8StringEncoding error:nil];
    } else {
        NSString *my_cnf        = [[NSBundle mainBundle] pathForResource:@"my" ofType:@"cnf"];
        my_content = [NSString stringWithContentsOfFile:my_cnf encoding:NSUTF8StringEncoding error:nil];
    }
    
    //端口替换
    NSString *mysqlPort = [NSCommon getCommonConfig:@"MysqlPort"];
    if (!mysqlPort) {
        mysqlPort = @"3306";
    }
    my_content = [my_content stringByReplacingOccurrencesOfString:@"{SQL_PORT}"  withString:mysqlPort];
    [my_content writeToFile:my_rcnf atomically:YES encoding:NSUTF8StringEncoding error:nil];
}

//启动配置文件替换
-(void)startConfReplaceString
{
    [self replacePHP:YES];//php.ini替换
    [self replaceOpenresty:YES];//openresty替换
    [self startCnfReplaceString];
    
    [NSCommon saveNginxConfig];
}

//停止配置文件替换
-(void)stopConfReplaceString
{
    [self replacePHP:NO];//php.ini替换
    [self replaceOpenresty:NO];//openresty替换
    
    [NSCommon setRemoveAllConfig];
}


#pragma mark - 启动服务 -
- (void)startWebService
{
//    NSString *appDir  = [NSCommon getAppDir];
    NSString *rootDir   = [NSCommon getRootDir];
    NSString *supportDir = [NSCommon getSupportDir];
    NSString *title = pStartTitle.stringValue;
    
    if ([title isEqual:@"start"]) {
        
        [NSCommon delayedRun:0 callback:^{
            NSString *isflog = [NSCommon getCommonConfig:@"isStartAfterFlushLog"];
            if ([isflog isEqualTo:@"1"]) {
                [self startFlushLogContent];
            }
            
            NSString *addhost = [NSString stringWithFormat:@"cd %@ && ./addhost", supportDir];
//采用新的授权的方式
//          [self AuthorizeExeCmd:addhost];
            
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", addhost, nil]] waitUntilExit];
            [self startConfReplaceString];
            sleep(0.1);
            
            NSString *nginx = [NSString stringWithFormat:@"cd %@ && ./script.sh start", supportDir];
//            [self AuthorizeExeCmd:nginx];
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", nginx, nil]] waitUntilExit];
            
            NSString *php_version = [NSCommon getCommonConfig:PHP_C_VER_KEY];
            NSString *php = [NSString stringWithFormat:@"%@bin/php/status.sh %@ start", rootDir, php_version];
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", php, nil]] waitUntilExit];
            
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"%@bin/php/status.sh %@ start", rootDir, [NSCommon getCommonConfig:PHP_S_VER_KEY]], nil]] waitUntilExit];
            
            
            NSArray* list = [NSCommon getAllPhpVer];
            for (NSString* php_ver in list) {
                if ([php_ver isEqualTo:[NSCommon getCommonConfig:PHP_C_VER_KEY]]
                    || [php_ver isEqualTo:[NSCommon getCommonConfig:PHP_S_VER_KEY]] ){
                }else{
                    [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"%@bin/php/status.sh %@ start", rootDir, php_ver], nil]] waitUntilExit];
                }
            }
            [self userCenter:@"启动成功"];
        }];

    }
}

#pragma mark - 停止服务 -
- (void)stopWebService
{
    NSString *rootDir = [NSCommon getRootDir];
//    NSString *appDir = [NSCommon getAppDir];
    NSString *supportDir = [NSCommon getSupportDir];
    NSString *title = pStartTitle.stringValue;
    
    if([title isEqual:@"stop"]){
        
        [NSCommon delayedRun:0 callback:^{
            
            NSString *nginx = [NSString stringWithFormat:@"cd %@ && ./script.sh stop", supportDir];
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", nginx, nil]] waitUntilExit];
//            [self AuthorizeExeCmd:nginx];
            
            NSString *php_version = [NSCommon getCommonConfig:PHP_C_VER_KEY];
            NSString *php = [NSString stringWithFormat:@"%@bin/php/status.sh %@ stop", rootDir, php_version];
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", php, nil]] waitUntilExit];
            
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"%@bin/php/status.sh %@ stop", rootDir, [NSCommon getCommonConfig:PHP_S_VER_KEY]], nil]] waitUntilExit];
            
            NSString *removehost = [NSString stringWithFormat:@"cd %@ && ./removehost", supportDir];
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", removehost, nil]] waitUntilExit];
//采用新的授权的方式
//            [self AuthorizeExeCmd:removehost];
            
            [self stopConfReplaceString];
            [self userCenter:@"停止成功"];
        }];
    
    }
}

#pragma mark - 重置服务 -
//-(IBAction)reloadSVC:(id)sender
//{
//    if ([self AuthorizeCreate]){
//        NSString *rootDir = [NSCommon getRootDir];
//        NSString *reloadSVC = [NSString stringWithFormat:@"%@bin/reloadSVC.sh", rootDir];
//        [self AuthorizeExeCmd:reloadSVC];
//    }
//}

#pragma mark 启动时清空内容
-(void)startFlushLogContent
{
    NSString *rootDir = [NSCommon getRootDir];
    rootDir = [NSString stringWithFormat:@"%@bin/flush.sh", rootDir];
    [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", rootDir, nil]] waitUntilExit];
}

#pragma mark 打开本软件自动启动
-(void)selfStart
{
    if ([_StartServerStatus isEqual:@"starting"]) {
        [NSCommon alert:@"正在启动或停止中,勿再点击!!!"];
        return;
    }
    _StartServerStatus = @"starting";
    NSString *title = pStartTitle.stringValue;
    
    [pProgress setHidden:NO];
    [pProgress startAnimation:nil];
    
    if ([title isEqual:@"start"]) {
        [self startWebService];
    }else if([title isEqual:@"stop"]){
        [self stopWebService];
    }
    
    [self delayedRun:3.0f callback:^{
        self->_StartServerStatus = @"ended";
        [self checkWebStatus];
        [self->pProgress setHidden:YES];
        [self->pProgress stopAnimation:nil];
    }];
}

#pragma mark - 一次性授权方式 -
- (void)installHelp {
    NSFileManager *fm = [NSFileManager defaultManager];
    if (![fm fileExistsAtPath:kMDHelper]) {
        NSString *helperPath = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"install_helper.sh"];
        NSLog(@"run install script: %@", helperPath);
        NSDictionary *error;
        NSString *script = [NSString stringWithFormat:@"do shell script \"/bin/bash \\\"%@\\\"\" with administrator privileges", helperPath];
        NSAppleScript *appleScript = [[NSAppleScript new] initWithSource:script];
        if ([appleScript executeAndReturnError:&error]) {
            NSLog(@"installation success");
        } else {
            NSLog(@"installation failure: %@", error);
        }
    }
}

#pragma mark - 按钮启动 -
- (IBAction)start:(id)sender {
//    if ([self AuthorizeCreate]){
    [self selfStart];
//    }
}

#pragma mark - 重新启动 -
-(void)selfReStart
{
    if ([_StartServerStatus isEqual:@"starting"]) {
        [NSCommon alert:@"正在启动或停止中,勿再点击!!!"];
        return;
    }
    _StartServerStatus = @"starting";
    NSString *title = pStartTitle.stringValue;
    
    [pProgress setHidden:NO];
    [pProgress startAnimation:nil];
    
    if ([title isEqual:@"start"]) {
        
        _StartServerStatus = @"ended";
        [pProgress setHidden:YES];
        [pProgress stopAnimation:nil];
        [self checkWebStatus];
        [self alert:@"启动后,才能重启!!!"];
        
    }else if([title isEqual:@"stop"]){
        
        NSString *supportDir = [NSCommon getSupportDir];
        
        NSString *removehost = [NSString stringWithFormat:@"cd %@ && ./removehost", supportDir];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", removehost, nil]] waitUntilExit];
        NSString *addhost = [NSString stringWithFormat:@"cd %@ && ./addhost", supportDir];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", addhost, nil]] waitUntilExit];
        
        [self stopConfReplaceString];
        [self startConfReplaceString];
        
        //NSLog(@"rootDir:%@",rootDir);
        NSString *reload = [NSString stringWithFormat:@"cd %@ && ./script.sh reload", supportDir];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", reload, nil]] waitUntilExit];
    }
    
    [self delayedRun:1.0f callback:^{
        self->_StartServerStatus = @"ended";
        [self checkWebStatus];
        [self->pProgress setHidden:YES];
        [self->pProgress stopAnimation:nil];
    }];
}

#pragma mark - 重启启动 -
- (IBAction)reStart:(id)sender {
    [self selfReStart];
}


#pragma mark 跳到开发地址
- (IBAction)goWeb:(id)sender {
    NSString *title = [pStartTitle stringValue];
    if ([title isEqual:@"stop"]) {
        [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://localhost:8888/"]];
    }else{
        [self alert:@"web服务未启动"];
    }
}

#pragma mark - redis和mongodb相关功能 && Memcached && MySQL -

-(IBAction)goRedisWeb:(id)sender
{
    NSString *title = [pStartTitle stringValue];
    if ([title isEqual:@"stop"]) {
        [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://localhost:8888/phpRedisAdmin/"]];
    }else{
        [self alert:@"web服务未启动"];
    }
    
}

-(IBAction)goMongoWeb:(id)sender
{
    NSString *title = [pStartTitle stringValue];
    if ([title isEqual:@"stop"]) {
        
        // 放弃治疗,推荐使用官方管理管理
        NSFileManager *fm = [NSFileManager defaultManager];
        NSString *root = [NSCommon getRootDir];
        NSString *webDir = [NSString stringWithFormat:@"%@htdocs/mongoadmin", root];
        
        if ([fm fileExistsAtPath:webDir]){
            [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://localhost:8888/mongoadmin/"]];
        } else{
            [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://www.mongodb.com/try/download/compass"]];
        }
    }else{
        [self alert:@"web服务未启动"];
    }
    
}

-(IBAction)goMemcached:(id)sender
{
    NSString *title = [pStartTitle stringValue];
    if ([title isEqual:@"stop"]) {
        [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://localhost:8888/memadmin/"]];
    }else{
        [self alert:@"web服务未启动"];
    }
}

-(IBAction)goMySQL:(id)sender
{
    NSString *title = [pStartTitle stringValue];
    if ([title isEqual:@"stop"]) {
//        NSString *phpVer = [NSCommon getCommonConfig:@"selectPhpVer"];
        [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://localhost:8888/phpMyAdmin/"]];
    }else{
        [self alert:@"web服务未启动"];
    }
}

#pragma mark - goNeo4j -
//- (IBAction)goNeo4j:(id)sender {
//    NSString *str           = [NSCommon getRootDir];
//    str = [NSString stringWithFormat:@"file://%@bin/Neo4j.app", str];
//    [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:str, nil]] waitUntilExit];
//}

-(IBAction)redisStart:(id)sender
{
    NSString *str   = [NSCommon getRootDir];
    //NSLog(@"%@",str);
    //str = @"/Applications/mdserver/";
    if( _mRedisButton.state == 1 ){
        str = [NSString stringWithFormat:@"%@bin/redis.sh start", str];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", str, nil]] waitUntilExit];
    } else {
        str = [NSString stringWithFormat:@"%@bin/redis.sh stop", str];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", str, nil]] waitUntilExit];
    }
    [self checkRedisStatus];
}


-(IBAction)mongoStart:(id)sender
{
    NSString *rootDir   = [NSCommon getRootDir];
    if( _mMongoButton.state == 1 ){
        rootDir = [NSString stringWithFormat:@"%@bin/mongodb.sh start", rootDir];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", rootDir, nil]] waitUntilExit];
    } else {
        rootDir = [NSString stringWithFormat:@"%@bin/mongodb.sh stop", rootDir];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", rootDir, nil]] waitUntilExit];
    }
    [self checkMongoStatus];
}

-(IBAction)memcachedStart:(id)sender
{
    NSString *str   = [NSCommon getRootDir];
    if( _mMemcachedButton.state == 1 ){
        str = [NSString stringWithFormat:@"%@bin/memcached.sh start", str];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", str, nil]] waitUntilExit];
    } else {
        str = [NSString stringWithFormat:@"%@bin/memcached.sh stop", str];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", str, nil]] waitUntilExit];
    }
    [self checkMemcachedStatus];
    
}

-(IBAction)MySQLStart:(id)sender
{
//    NSString *rootDir   = [NSCommon getRootDir];
//    if (_mMySQLButton.state == 1) {
//        NSString *mysql = [NSString stringWithFormat:@"%@bin/mysql/mysql80/start.sh", rootDir];
//        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", mysql, nil]] waitUntilExit];
//    } else {
//        NSString *mysql = [NSString stringWithFormat:@"%@bin/mysql/mysql80/stop.sh", rootDir];
//        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", mysql, nil]] waitUntilExit];
//    }
    
    NSString *myVer = [NSCommon getCommonConfig:MYSQL_C_VER_KEY];
    [self mysqlTrigger:myVer];
    sleep(3);

    
    [self checkMySQLOnStatus];
}

-(BOOL)checkRedisStatus
{
    NSString *path = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager defaultManager];
    path = [NSString stringWithFormat:@"%@bin/redis/data/redis.pid", path];
    BOOL isStart = [fm fileExistsAtPath:path];
    
    if(isStart){
        _mRedisTool.enabled = TRUE;
        _mRedisButton.state = 1;
    } else {
        _mRedisTool.enabled = FALSE;
        _mRedisButton.state = 0;
    }
    return isStart;
}

-(BOOL)checkMongoStatus
{
    NSString *path = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager defaultManager];
    path = [NSString stringWithFormat:@"%@bin/mongodb/logs/mongodb.pid", path];
    BOOL isStart = [fm fileExistsAtPath:path];
    
    if(isStart){
        _mMongoTool.enabled = TRUE;
        _mMongoButton.state = 1;
    } else {
        _mMongoTool.enabled = FALSE;
        _mMongoButton.state = 0;
    }
    return isStart;
}

-(BOOL)checkMemcachedStatus
{
    NSString *path = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager defaultManager];
    path = [NSString stringWithFormat:@"%@bin/memcached/mem.pid", path];
    BOOL isStart = [fm fileExistsAtPath:path];
    
    //NSLog(@"isStart:%hhd", isStart);
    if(isStart){
        _mMemcachedTool.enabled = TRUE;
        _mMemcachedButton.state = 1;
    } else {
        _mMemcachedTool.enabled = FALSE;
        _mMemcachedButton.state = 0;
    }
    return isStart;
}

#pragma mark 检查MySQL是否启动
-(BOOL)checkMySQLOnStatus
{
    NSString *myVer = [NSCommon getCommonConfig:MYSQL_C_VER_KEY];
    BOOL isStart =[self checkMysqlStatus:myVer];

    if (isStart){
        _mMySQLTool.enabled = TRUE;
        _mMySQLButton.state = 1;
    } else {
        _mMySQLTool.enabled = FALSE;
        _mMySQLButton.state = 0;
    }
 
    return isStart;
}

#pragma mark - 程序入口 -

#pragma mark 检查PHP-FPM是否启动
-(BOOL)checkWebPHP:(NSString *)ver
{
    NSFileManager *fm = [NSFileManager defaultManager];
    NSString *path = [NSString stringWithFormat:@"/tmp/php%@-cgi.sock", ver];
    return [fm fileExistsAtPath:path];
}

-(BOOL) rmPHPSockFile:(NSString *)ver
{
    NSFileManager *fm = [NSFileManager defaultManager];
    NSString *path = [NSString stringWithFormat:@"/tmp/php%@-cgi.sock", ver];
    if ([fm fileExistsAtPath:path]){
        return [fm removeItemAtPath:path error:nil];
    }
    return NO;
}

#pragma mark 检查Nginx是否启动
-(BOOL)checkWebNginx
{
    NSString *path = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager defaultManager];
    path = [NSString stringWithFormat:@"%@bin/tmp/nginx.pid", path];
    return [fm fileExistsAtPath:path];
}

#pragma mark 启动状态
-(void)checkWebStatus
{
    BOOL n = [self checkWebNginx];
    
    if (n) {
        [pStartTitle setStringValue:@"stop"];
        [pStart setImage:[NSImage imageNamed:@"stop"]];
        [NSCommon setCommonConfig:@"WebServerStatus" value:@"started"];
    }else{
        [pStartTitle setStringValue:@"start"];
        [pStart setImage:[NSImage imageNamed:@"start"]];
        [NSCommon setCommonConfig:@"WebServerStatus" value:@"stoped"];
    }
    
    if (n) {
        pNginxStatus.state = 1;
        
        NSString *php_version = [NSCommon getCommonConfig:PHP_C_VER_KEY];
        BOOL p = [self checkWebPHP:php_version];
        if (p) {
            pPHPStatus.state = 1;
        }else{
            pPHPStatus.state = 0;
        }
        
    }else{
        pPHPStatus.state = 0;
        pNginxStatus.state = 0;
    }
}

#pragma mark 检查CMD是否启动进程
-(BOOL)checkCmdStatus:(NSString *)name
{
    NSFileManager *fm = [NSFileManager defaultManager];
    NSString *rootDir = [NSCommon getRootDir];
    NSString *cmdFile = [NSString stringWithFormat:@"%@bin/tmp/cmd/%@.lock", rootDir, name];
    return [fm fileExistsAtPath:cmdFile];
}

#pragma mark 设置界面UI
-(void)setBarStatus
{
    statusBarItem = [[NSStatusBar systemStatusBar] statusItemWithLength:23.0];
    if (statusBarItem.button != nil) {
        statusBarItem.button.image = [NSImage imageNamed:@"mIcon"];
        statusBarItem.button.alternateImage = [NSImage imageNamed:@"mIcon"];
        statusBarItem.button.toolTip = @"mdserver is NOT Running";
        [statusBarItem.button.cell setHighlightsBy:(NSPushInCellMask | NSChangeBackgroundCellMask)];
    }
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101400
    else {
        statusBarItem.image = [NSImage imageNamed:@"mIcon"];
        statusBarItem.alternateImage = [NSImage imageNamed:@"mIcon"];
        statusBarItem.toolTip = @"mdserver is NOT Running";
    }
#endif
    statusBarItem.menu = statusBarItemMenu;
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101400
    [statusBarItem setHighlightMode:YES];
#endif
}

#pragma mark - 初始化CMD列表 -
-(NSMenu*)getCmdMenu:(NSString *)title
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenu *menu = [[NSMenu alloc] initWithTitle:title];
    
    
    [menu addItemWithTitle:@"Install" action:@selector(cmdInstall:) keyEquivalent:@""];
    [menu addItemWithTitle:@"UnInstall" action:@selector(cmdUninstall:) keyEquivalent:@""];
    
    
    NSString *reloadSh = [NSString stringWithFormat:@"%@bin/reinstall/cmd/%@/reload.sh", rootDir, title];
    BOOL isDir = YES;
    if([fm fileExistsAtPath:reloadSh isDirectory:&isDir]){
        [menu addItemWithTitle:@"Reload" action:@selector(cmdReload:) keyEquivalent:@""];
    }
    
    [menu addItemWithTitle:@"Dir" action:@selector(cmdDir:) keyEquivalent:@""];
    return menu;
}

#pragma mark - 递归生产菜单 -
-(BOOL)checkMenuDir:(NSString *)name transmit:(NSString *)transmit path:(NSString *)path menu:(NSMenu *)menu
{
    NSString *dirPath = [NSString stringWithFormat:@"%@/dir", path];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    if (![fm fileExistsAtPath:dirPath]){
        return TRUE;
    }
    
    NSArray *cmdList = [fm contentsOfDirectoryAtPath:dirPath error:nil];
    NSMutableArray *_cmdList = [[NSMutableArray alloc] init];
    
    for (NSString *f in cmdList) {
        NSString *path =[NSString stringWithFormat:@"%@/%@", dirPath,f];
        BOOL isDir = YES;
        [fm fileExistsAtPath:path isDirectory:&isDir];
        if (!isDir){
            continue;
        }
        [_cmdList addObject:f];
    }
    
    [_cmdList sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        return [obj1 localizedStandardCompare:obj2];
    }];
    
    
    NSMenu *menuList = [[NSMenu alloc] initWithTitle:name];
    for (NSString *f in _cmdList) {
        
        NSString *path =[NSString stringWithFormat:@"%@/%@", dirPath,f];
        BOOL isDir = YES;
        [fm fileExistsAtPath:path isDirectory:&isDir];
        if (!isDir){
            continue;
        }
        NSString *titlePath = @"";
        if ([transmit isEqualToString:@""]){
            titlePath = [NSString stringWithFormat:@"%@/dir/%@",name,f];
        } else {
            titlePath =[NSString stringWithFormat:@"%@/dir/%@",transmit,f];
        }
        
        if (![self checkMenuDir:f transmit:titlePath path:path menu:menuList])
        {
            continue;
        }
        
        NSMenu *vMenu = [self getCmdMenu:titlePath];
        NSMenuItem *vItem = [[NSMenuItem alloc] initWithTitle:f
                                                       action:@selector(cmdStatusSet:)
                                                keyEquivalent:@""];
        NSString *titleLog = [titlePath stringByReplacingOccurrencesOfString:@"/" withString:@"_"];
        if ( [self checkCmdStatus:titleLog] ){
            vItem.state = 1;
        }
        [menuList addItem:vItem];
        [menuList setSubmenu:vMenu forItem:vItem];
    }
    
    NSMenuItem *listItem = [[NSMenuItem alloc] initWithTitle:name
                                                      action:NULL
                                               keyEquivalent:@""];
    [menu addItem:listItem];
    [menu setSubmenu:menuList forItem:listItem];
    
    return FALSE;
}

-(void)initCmdList
{
    NSMenu *newMenu = [cmd submenu];
    for (NSInteger i = newMenu.numberOfItems - 1; i >= 0; i--) {
        [newMenu removeItemAtIndex:i];
    }
    
    NSFileManager *fm = [NSFileManager  defaultManager];
    NSString *rootDir           = [NSCommon getRootDir];
    
    NSString *cmdDir = [NSString stringWithFormat:@"%@bin/reinstall/cmd", rootDir];
    NSArray *cmdList = [fm contentsOfDirectoryAtPath:cmdDir error:nil];
    
    NSMutableArray *_cmdList = [[NSMutableArray alloc] init];
    for (NSString *f in cmdList) {
        NSString *path =[NSString stringWithFormat:@"%@/%@", cmdDir,f];
        BOOL isDir = YES;
        [fm fileExistsAtPath:path isDirectory:&isDir];
        if (!isDir){
            continue;
        }
        [_cmdList addObject:f];
    }
    
    [_cmdList sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        return [obj1 localizedStandardCompare:obj2];
    }];
    
    for (NSString *f in _cmdList) {
        
        NSString *path =[NSString stringWithFormat:@"%@/%@", cmdDir,f];
        BOOL isDir = YES;
        [fm fileExistsAtPath:path isDirectory:&isDir];
        if (!isDir){
            continue;
        }
        if (![self checkMenuDir:f transmit:@"" path:path menu:newMenu])
        {
            continue;
        }
        
        NSMenu *vMenu = [self getCmdMenu:f];
        NSMenuItem *vItem = [[NSMenuItem alloc] initWithTitle:f
                                                       action:@selector(cmdStatusSet:)
                                                keyEquivalent:@""];
        if ( [self checkCmdStatus:f] ){
            vItem.state = 1;
        }
        [newMenu addItem:vItem];
        [newMenu setSubmenu:vMenu forItem:vItem];
    }
    
    [newMenu addItem:[NSMenuItem separatorItem]];
    NSMenuItem *refresh = [[NSMenuItem alloc] initWithTitle:@"refresh"
                                                     action:@selector(cmdRefresh:)
                                              keyEquivalent:@""];
    refresh.state = 1;
    [newMenu addItem:refresh];
    // Submenu already attached via XIB; avoid reassigning to prevent inconsistencies
}

-(void)cmdRefresh:(id)sender
{
    [self initCmdList];
}

-(void)cmdInstall:(id)sender
{
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSString *title = [self getMenuCmdPath:cMenu];
    [self cmdInAndUnin:@"install" version:title];
}

-(void)cmdUninstall:(id)sender
{
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSString *title = [self getMenuCmdPath:cMenu];
    [self cmdInAndUnin:@"uninstall" version:title];
}

-(void)cmdInAndUnin:(NSString *)sh version:(NSString *)version
{
    NSString *versionLog = [version stringByReplacingOccurrencesOfString:@"/" withString:@"_"];
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/cmd/%@/%@.sh", rootDir, version, sh];
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    if ([NSCommon fileIsExists:logDir]){
        [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    }
    
    NSString *log = [NSString stringWithFormat:@"%@bin/logs/reinstall/cmd_%@_%@.log", rootDir, versionLog,sh];
    NSString *cmd = [NSString stringWithFormat:@"%@ 1>> %@ 2>&1", installSh,log];
    [NSCommon delayedRun:0 callback:^{
        [self openFile:log];
    }];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
}

-(void)cmdStatusSet:(id)sender
{
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSString *title =  [self getMenuMainCmdPath:cMenu];
    NSString *tlog = [title stringByReplacingOccurrencesOfString:@"/" withString:@"_"];
    NSString *rootDir = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSString *lock = [NSString stringWithFormat:@"%@bin/tmp/cmd/%@.lock", rootDir, tlog];
    
    NSString *name = @"start";
    if ([NSCommon fileIsExists:lock]){
        name = @"stop";
    }
    
    NSString *doSh = [NSString stringWithFormat:@"%@bin/reinstall/cmd/%@/%@.sh", rootDir, title,name];
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    if ([NSCommon fileIsExists:logDir]){
        [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    }
    
    NSString *log = [NSString stringWithFormat:@"%@bin/logs/reinstall/cmd_%@_%@.log", rootDir, tlog, name];
    if (![fm fileExistsAtPath:log]){
        [@"" writeToFile:log atomically:YES encoding:NSUTF8StringEncoding error:nil];
    }
    
    NSString *cmd = [NSString stringWithFormat:@"%@ 1>> %@ 2>&1", doSh,log];
    if ([NSCommon fileIsExists:doSh]){
        [NSCommon delayedRun:0 callback:^{
            [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
            [self userCenter:[NSString stringWithFormat:@"执行[%@服务%@脚本]成功!", title,name]];
        }];
        
        if ([NSCommon fileIsExists:lock]){
            [fm removeItemAtPath:lock error:NULL];
        } else {
            [fm createFileAtPath:lock contents:NULL attributes:NULL];
        }
    }
    
    [NSCommon delayedRun:1 callback:^{
        [self openFile:log];
    }];
    
    [self initCmdList];
}


-(void)cmdReload:(id)sender
{
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSString *rootDir = [NSCommon getRootDir];
    NSString *title =  [self getMenuCmdPath:cMenu];
    NSString *tlog = [title stringByReplacingOccurrencesOfString:@"/" withString:@"_"];
    
    NSString *name = @"reload";
    NSString *doSh = [NSString stringWithFormat:@"%@bin/reinstall/cmd/%@/%@.sh", rootDir, title,name];
    NSString *log = [NSString stringWithFormat:@"%@bin/logs/reinstall/cmd_%@_%@.log", rootDir, tlog, name];
    NSString *cmd = [NSString stringWithFormat:@"%@ 1>> %@ 2>&1", doSh,log];
    if ([NSCommon fileIsExists:doSh]){
        
        [NSCommon delayedRun:0 callback:^{
            [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
            [self userCenter:[NSString stringWithFormat:@"执行[%@服务%@脚本]成功!", title,name]];
        }];
        
        [NSCommon delayedRun:1 callback:^{
            [self openFile:log];
        }];
        
    } else {
        [self userCenter:[NSString stringWithFormat:@"CMD[%@](%@)脚本不存在!",title,name]];
    }
    [self initCmdList];
}

-(NSString *)getMenuCmdPath:(NSMenuItem *)menu
{
    NSMenuItem *pMenu=[menu parentItem];
    NSString *path = pMenu.title;
    
    for (;;) {
        pMenu = [pMenu parentItem];
        if (!pMenu){
            break;
        }
        
        if ([pMenu.title isEqualToString:@"CMD"]){
            break;
        }
        
        path = [NSString stringWithFormat:@"%@/dir/%@",pMenu.title,path];
    }
    
    return path;
}

-(NSString *)getMenuMainCmdPath:(NSMenuItem *)menu
{
    NSMenuItem *pMenu=[menu parentItem];
    NSString *path = menu.title;
    
    for (;;) {
        if ([pMenu.title isEqualToString:@"CMD"]){
            break;
        }
        
        path = [NSString stringWithFormat:@"%@/dir/%@",pMenu.title,path];
        pMenu = [pMenu parentItem];
        
        if (!pMenu){
            break;
        }
    }
    return path;
}

-(void)cmdDir:(id)sender
{
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSString *pathTitle = [self getMenuCmdPath:cMenu];
    
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    [NSCommon delayedRun:0 callback:^{
        NSString *str = [NSString stringWithFormat:@"%@bin/reinstall/cmd/%@",rootDir,pathTitle];
        BOOL isDir = YES;
        if ([fm fileExistsAtPath:str isDirectory:&isDir]){
            [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:str, nil]] waitUntilExit];
        } else {
            [self userCenter:[NSString stringWithFormat:@"CMD%@目录不存在!",pathTitle]];
        }
    }];
}

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

-(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/extensions", rootDir];
    NSArray *extList = [fm contentsOfDirectoryAtPath:extDir error:nil];
    
    NSString *content = @"";
    NSString *phpDir = [NSString stringWithFormat:@"%@bin/php/php%@", rootDir, v];
    
    if ([NSCommon fileIsExists:phpDir]){
        NSString *phpIni = [NSString stringWithFormat:@"%@bin/php/php%@/etc/php.ini", rootDir, v];
        
        if (![NSCommon fileIsExists:phpIni]){
            [self userCenter:[NSString stringWithFormat:@"PHP%@配置文件不存在!", v]];
        }
        
        content = [self getPhpIniContent:v];
        if ([content isEqualToString:@""])
        {
            [self userCenter:[NSString stringWithFormat:@"PHP%@INI配置文件读取错误!", v]];
        }
    }
    
    NSMutableArray *_extList = [[NSMutableArray alloc] init];
    for (NSString *e in extList) {
        NSString *path =[NSString stringWithFormat:@"%@/%@", extDir,e];
        BOOL isDir;
        [fm fileExistsAtPath:path isDirectory:&isDir];
        if (!isDir){
            continue;
        }
        [_extList addObject:e];
    }
    
    NSArray *__extList;
    __extList = [_extList sortedArrayUsingComparator:^NSComparisonResult(NSString* obj1, NSString* obj2){
        const char  * o1 = [[obj1 substringToIndex:1] UTF8String];
        const char  * o2 = [[obj2 substringToIndex:1] UTF8String];
        if (strcmp(o1, o2)>-1){
            return YES;
        }
        return NO;
    }];
    
    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:@""];
        [extMenu addItemWithTitle:@"UnInstall" action:@selector(phpExtUninstall:) keyEquivalent:@""];
        
        NSMenuItem *extItem = [[NSMenuItem alloc] initWithTitle:ee
                                                         action:@selector(phpExtStatusSet:)
                                                  keyEquivalent:@""];
        if ([self checkPhpExtIsLoadByContent:content extName:ee]){
            extItem.state = 1;
            
            NSString *reloadSh = [NSString stringWithFormat:@"%@bin/reinstall/php%@/%@/reload.sh", rootDir, v,ee];
            if ([NSCommon fileIsExists:reloadSh]){
                [extMenu addItemWithTitle:@"Reload" action:@selector(phpExtReload:) keyEquivalent:@""];
            }
        }
        [extMenu addItemWithTitle:@"Dir" action:@selector(phpExtDir:) keyEquivalent:@""];
        
        [extListMenu addItem:extItem];
        [extListMenu setSubmenu:extMenu forItem:extItem];
    }
    return extListMenu;
}

-(void)phpExtInstall:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    NSMenuItem *ppMenu=[pMenu parentItem];
    NSMenuItem *pppMenu=[ppMenu parentItem];
    
    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]];
        return;
    }
    
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    if (![NSCommon fileIsExists:logDir]){
        [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    }
    
    NSString *log = [NSString stringWithFormat:@"%@/php%@_ext_%@_install.log", logDir, pppMenu.title,pMenu.title];
    NSString *cmd = [NSString stringWithFormat:@"%@ %@ 1> %@ 2>&1", installSh,pppMenu.title,log];
    
    [NSCommon delayedRun:1 callback:^{
        [self openFile:log];
    }];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
}

-(void)phpExtUninstall:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    NSMenuItem *ppMenu=[pMenu parentItem];
    NSMenuItem *pppMenu=[ppMenu parentItem];
    
    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]];
        return;
    }
    
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    if (![NSCommon fileIsExists:logDir]){
        [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    }
    
    NSString *log = [NSString stringWithFormat:@"%@/php%@_ext_%@_uninstall.log", logDir, pppMenu.title,pMenu.title];
    
    NSString *cmd = [NSString stringWithFormat:@"%@ %@ 1> %@ 2>&1", installSh,pppMenu.title,log];
    [NSCommon delayedRun:1 callback:^{
        [self openFile:log];
    }];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
}
-(void)phpExtReload:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    NSMenuItem *ppMenu=[pMenu parentItem];
    NSMenuItem *pppMenu=[ppMenu parentItem];
    
    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]];
        return;
    }
    
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    NSString *log = [NSString stringWithFormat:@"%@/php%@_ext_%@_reload.log", logDir, pppMenu.title,pMenu.title];
    NSString *cmd = [NSString stringWithFormat:@"%@ %@ 1> %@ 2>&1", reloadSh, pppMenu.title, log];
    
    [NSCommon delayedRun:1 callback:^{
        [self openFile:log];
    }];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
    
}
-(void)phpExtDir:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
//    NSMenuItem *ppMenu=[pMenu parentItem];
//    NSMenuItem *pppMenu=[ppMenu parentItem];
    
    [NSCommon delayedRun:0 callback:^{
        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];
        } else {
            [self userCenter:[NSString stringWithFormat:@"PHP扩展脚本%@目录不存在!",pMenu.title]];
        }
    }];
}

-(NSString *)getPhpIniContent:(NSString*)version
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSString *phpIni = [NSString stringWithFormat:@"%@bin/php/php%@/etc/php.ini", rootDir, version];
    NSError *error = nil;
    NSString *content = [NSString stringWithContentsOfFile:phpIni encoding:NSUTF8StringEncoding error:&error];
    if (error != nil)
    {
        return @"";
    }
    return content;
}

-(BOOL)checkPhpExtIsLoadByContent:(NSString *)content extName:(NSString *)extName
{
    NSString *pattern = [NSString stringWithFormat:@"\\[%@\\]", extName];
    NSRegularExpression *regex = [[NSRegularExpression alloc] initWithPattern:pattern options:0 error:NULL];
    
    NSArray *results = [regex matchesInString:content options:0 range:NSMakeRange(0, content.length)];
    if (results.count == 0){
        return NO;
    }
    return YES;
}

-(BOOL)checkPhpExtIsLoad:(NSString*)version extName:(NSString *)extName
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSString *phpIni = [NSString stringWithFormat:@"%@bin/php/php%@/etc/php.ini", rootDir, version];
    
    if (![NSCommon fileIsExists:phpIni]){
        [self userCenter:[NSString stringWithFormat:@"PHP%@配置文件不存在!", version]];
        return NO;
    }
    
    NSString *content = [self getPhpIniContent:version];
    if ([content isEqualToString:@""])
    {
        [self userCenter:[NSString stringWithFormat:@"PHP%@配置文件读取错误!", version]];
        return NO;
    }
    
    if (![self checkPhpExtIsLoadByContent:content extName:extName]){
        return NO;
    }
    return YES;
}

-(BOOL)checkPhpExtIsExist:(NSString*)version extName:(NSString *)extName
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSString *extFile = [NSString stringWithFormat:@"%@bin/php/php%@/lib/php/extensions", rootDir,version];
    NSLog(@"%@",extFile);
    return NO;
}

-(void)phpExtStatusSet:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    NSMenuItem *ppMenu=[pMenu parentItem];
    
    NSString *shName = @"load";
    if ([self  checkPhpExtIsLoad:ppMenu.title extName:cMenu.title])
    {
        shName = @"unload";
    }
    
    NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/extensions/%@/%@.sh", rootDir,cMenu.title, shName];
    if (![NSCommon fileIsExists:installSh]){
        [self userCenter:[NSString stringWithFormat:@"PHP%@-%@扩展%@脚本不存在!", ppMenu.title,cMenu.title,shName]];
        return;
    }
    
    
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    if (![NSCommon fileIsExists:logDir]){
        [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    }
    
    NSString *log = [NSString stringWithFormat:@"%@/php%@_ext_%@_%@.log", logDir, ppMenu.title,cMenu.title,shName];
    NSString *cmd = [NSString stringWithFormat:@"%@ %@ 1> %@ 2>&1", installSh,ppMenu.title,log];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
    
    [NSCommon delayedRun:0.2 callback:^{
        [self initPhpList];
        [self userCenter:[NSString stringWithFormat:@"PHP%@-%@扩展%@脚本执行成功!", ppMenu.title,cMenu.title,shName]];
        [self phpFpmCmdReload:ppMenu.title];
    }];
}


-(BOOL)findEnv:(NSString *)title{

    if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"MD_PHP_VER"] isEqualToString:title]
        && [[NSUserDefaults standardUserDefaults] boolForKey:@"MD_PHP_VER_LOAD"]
        ){
        return YES;
    }
    return NO;
}

-(NSMenu*)getPhpVerMenu:(NSString *)title extlib:(NSMutableDictionary *)extlib
{
    NSMenu *vMenu = [[NSMenu alloc] initWithTitle:title];
    
    [vMenu addItemWithTitle:@"Install" action:@selector(phpInstall:) keyEquivalent:@""];
    [vMenu addItemWithTitle:@"UnInstall" action:@selector(phpUninstall:) keyEquivalent:@""];
    
    NSMenuItem *phpCommand = [[NSMenuItem alloc] initWithTitle:@"Command" action:@selector(phpCommand:) keyEquivalent:@""];
    phpCommand.state = (int)[self findEnv:title];
    
    [vMenu addItem:phpCommand];
    if ( [self checkWebPHP:title] ){
        [vMenu addItemWithTitle:@"Reload" action:@selector(phpReload:) keyEquivalent:@""];
    }
    [vMenu addItemWithTitle:@"Dir" action:@selector(phpDir:) keyEquivalent:@""];
    [vMenu addItemWithTitle:@"Extends Dir" action:@selector(phpExtendsDir:) keyEquivalent:@""];
    
//    NSLog(@"init %@", @"ddd");
    NSMenu *extMenu = [self getPhpExtendsMenu:title extlib:extlib];
    NSMenuItem *extItem = [[NSMenuItem alloc] initWithTitle:@"Extends"
                                                     action:NULL
                                              keyEquivalent:@""];
    [vMenu addItem:extItem];
    [vMenu setSubmenu:extMenu forItem:extItem];
    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
{
    NSMenu *newMenu = [phpVer submenu];
    for (NSInteger i = newMenu.numberOfItems - 1; i >= 0; i--) {
        [newMenu removeItemAtIndex:i];
    }
    
    NSFileManager *fm = [NSFileManager  defaultManager];
    NSString *rootDir           = [NSCommon getRootDir];
    
    NSString *phpDir = [NSString stringWithFormat:@"%@bin/reinstall", rootDir];
    
    NSArray *phpVlist = [fm contentsOfDirectoryAtPath:phpDir error:nil];
    NSInteger i = 1;
    
    
    NSMutableArray *_phpVlist = [[NSMutableArray alloc] init];
    for (NSString *f in phpVlist) {
        
        NSString *path =[NSString stringWithFormat:@"%@/%@", phpDir,f];
        BOOL isDir;
        [fm fileExistsAtPath:path isDirectory:&isDir];
        if (!isDir){
            continue;
        }
        
        if([f hasPrefix:@"php"]){
            NSString *v = [f stringByReplacingOccurrencesOfString:@"php" withString:@""];
            [_phpVlist addObject:v];
        }
    }
    
    [_phpVlist sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        if ([obj1 intValue]>[obj2 intValue]){
            return YES;
        }
        return NO;
    }];
    
    
    NSMutableDictionary *extlib = [self readPhpExtLib];
    for (NSString *f in _phpVlist) {
        NSMenu *vMenu = [self getPhpVerMenu:f extlib:extlib];
        
        NSMenuItem *vItem = [[NSMenuItem alloc] initWithTitle:f
                                                       action:@selector(phpStatusSet:)
                                                keyEquivalent:[NSString stringWithFormat:@"%ld", i]];
        if ( [self checkWebPHP:f] ){
            vItem.state = 1;
        }
        [newMenu addItem:vItem];
        [newMenu setSubmenu:vMenu forItem:vItem];
        i++;
    }
    
    [newMenu addItem:[NSMenuItem separatorItem]];
    NSMenuItem *refresh = [[NSMenuItem alloc] initWithTitle:@"refresh"
                                                     action:@selector(phpRefresh:)
                                              keyEquivalent:[NSString stringWithFormat:@"%d", 0]];
    refresh.state = 1;
    [newMenu addItem:refresh];
    // Submenu already attached in XIB
}

-(void)phpInstall:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/php%@/install.sh", rootDir, pMenu.title];
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    
    if (![fm fileExistsAtPath:logDir]){
        [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    }
    
    NSString *log = [NSString stringWithFormat:@"%@/php_%@_install.log", logDir, pMenu.title];
    
    NSString *cmd = [NSString stringWithFormat:@"%@ 1> %@ 2>&1", installSh,log];
    [NSCommon delayedRun:2 callback:^{
        [self openFile:log];
    }];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
}

-(void)phpUninstall:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/php%@/uninstall.sh", rootDir, pMenu.title];
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    
    NSString *log = [NSString stringWithFormat:@"%@bin/logs/reinstall/php_%@_uninstall.log", rootDir, pMenu.title];
    [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    
    NSString *cmd = [NSString stringWithFormat:@"%@ 1>> %@ 2>&1", installSh,log];
    [NSCommon delayedRun:1 callback:^{
        [self openFile:log];
    }];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
}

-(void)phpCommand:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    [[NSUserDefaults standardUserDefaults] setObject:pMenu.title forKey:@"MD_PHP_VER"];
    if (cMenu.state){
        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"MD_PHP_VER_LOAD"];
             
        [NSCommon delayedRun:0 callback:^{
            NSString *unloadEnv = [NSString stringWithFormat:@"%@bin/reinstall/unload_env.sh %@ > %@bin/logs/reinstall/unload_env.log", rootDir, pMenu.title,rootDir];
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", unloadEnv, nil]] waitUntilExit];
        }];
    } else{
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"MD_PHP_VER_LOAD"];
        
        [NSCommon delayedRun:0 callback:^{
            
            NSString *loadEnv = [NSString stringWithFormat:@"%@bin/reinstall/load_env.sh %@ > %@bin/logs/reinstall/load_env.log", rootDir, pMenu.title, rootDir];
            [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", loadEnv, nil]] waitUntilExit];
            
            sleep(1);
            if (@available(macOS 10.15, *)) {
                NSURL *terminalURL = [NSURL fileURLWithPath:@"/System/Applications/Utilities/Terminal.app" isDirectory:YES];
                NSWorkspaceOpenConfiguration *config = [NSWorkspaceOpenConfiguration configuration];
                config.activates = YES;
                [[NSWorkspace sharedWorkspace] openApplicationAtURL:terminalURL configuration:config completionHandler:^(NSRunningApplication * _Nullable app, NSError * _Nullable error) {
                    if (error) {
                        // Fallback: open the Terminal app bundle URL directly
                        [[NSWorkspace sharedWorkspace] openURL:terminalURL];
                    }
                }];
            } else {
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 110000
                [[NSWorkspace sharedWorkspace] launchApplication:@"Terminal"];
#endif
            }
        }];
    }
    
    [self phpRefresh:sender];
}

-(void)phpReload:(id)sender
{
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    [NSCommon delayedRun:0 callback:^{
        [self phpFpmReload:pMenu.title];
    }];
}

-(void)phpDir:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    [NSCommon delayedRun:0 callback:^{
        NSString *str = [NSString stringWithFormat:@"%@bin/php/php%@",rootDir,pMenu.title];
        BOOL isDir = YES;
        if ([fm fileExistsAtPath:str isDirectory:&isDir]){
            [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:str, nil]] waitUntilExit];
        } else {
            [self userCenter:[NSString stringWithFormat:@"PHP%@目录不存在!",pMenu.title]];
        }
    }];
}

-(void)phpExtendsDir:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    [NSCommon delayedRun:0 callback:^{
        NSString *str = [NSString stringWithFormat:@"%@bin/php/php%@/lib/php/extensions",rootDir,pMenu.title];
        NSArray *findExt = [fm contentsOfDirectoryAtPath:str error:nil];
        
        NSString *findExtDir = @"";
        for (NSString *f in findExt) {
            if([f hasPrefix:@"no-debug-non-zts"]){
                findExtDir = [NSString stringWithFormat:@"%@/%@", str, f];
            }
        }
        
        if ([findExtDir isEqualToString:@""]){
            [self userCenter:[NSString stringWithFormat:@"PHP%@安装不正确,请重新安装!",pMenu.title]];
            return;
        }
        
        
        BOOL isDir = YES;
        if ([fm fileExistsAtPath:findExtDir isDirectory:&isDir]){
            [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:findExtDir, nil]] waitUntilExit];
        } else {
            [self userCenter:[NSString stringWithFormat:@"PHP扩展%@目录不存在!",pMenu.title]];
        }
    }];
}

-(void)phpRefresh:(id)sender
{
    [self initPhpList];
}

#pragma 启动当前PHP-FPM
-(void)phpFpmCmdStart:(NSString *)version
{
    NSString *rootDir = [NSCommon getRootDir];
    NSString *cmd = [NSString stringWithFormat:@"%@bin/php/status.sh %@ start", rootDir, version];
    [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]] waitUntilExit];
}

#pragma 停止当前PHP-FPM
-(void)phpFpmCmdStop:(NSString *)version
{
    NSString *rootDir = [NSCommon getRootDir];
    NSString *cmd = [NSString stringWithFormat:@"%@bin/php/status.sh %@ stopone", rootDir, version];
    [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]] waitUntilExit];
}


-(void)phpFpmCmdReload:(NSString *)version
{
    NSString *rootDir = [NSCommon getRootDir];
    NSString *cmd = [NSString stringWithFormat:@"%@bin/php/status.sh %@ reload", rootDir, version];
    [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]] waitUntilExit];
}


-(void)phpFpmTrigger:(NSString *)version
{
    if ( [self checkWebPHP:version] ){
        [self phpFpmCmdStop:version];
        [self rmPHPSockFile:version];
        [self userCenter:[NSString stringWithFormat:@"执行[PHP%@-FPM停止]成功!", version]];
    } else {
        [self phpFpmCmdStart:version];
        [self userCenter:[NSString stringWithFormat:@"执行[PHP%@-FPM启动]成功!", version]];
    }
}

-(void)phpFpmReload:(NSString *)version
{
    if ( [self checkWebPHP:version] ){
        [self phpFpmCmdReload:version];
        [self userCenter:[NSString stringWithFormat:@"执行[PHP%@-FPM重启]成功!", version]];
    }
}

-(void)phpStatusSet:(id)sender {
    
    NSString *rootDir = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    NSMenuItem *cItem = (NSMenuItem *)sender;
    
    NSString *cPhpVer = [cItem title];
    NSString *phpDir = [NSString stringWithFormat:@"%@bin/php/php%@", rootDir, cPhpVer];
    
    if (![fm fileExistsAtPath:phpDir]){
        NSString *notice = [NSString stringWithFormat:@"PHP-%@没有安装,请先安装再使用!!", cPhpVer];
        [self userCenter:notice];
        return;
    }
    
    [NSCommon delayedRun:1 callback:^{
        [self phpFpmTrigger:cPhpVer];
        [NSCommon delayedRun:0.5 callback:^{
            [self phpRefresh:sender];
        }];
    }];
}
#pragma mark - 初始化PHP版本列表-END -

#pragma mark - 初始化MYSQL版本列表 -
-(void)initMySQLList
{
    NSMenu *newMenu = [mysqlVer submenu];
    for (NSInteger i = newMenu.numberOfItems - 1; i >= 0; i--) {
        [newMenu removeItemAtIndex:i];
    }
    
    NSFileManager *fm = [NSFileManager  defaultManager];
    NSString *rootDir           = [NSCommon getRootDir];
    
    NSString *mysqlDir = [NSString stringWithFormat:@"%@bin/reinstall/cmd/mysql", rootDir];
    
    NSArray *mysqlVlist = [fm contentsOfDirectoryAtPath:mysqlDir error:nil];
    NSInteger i = 1;
    
    NSArray *letter = @[@"0",@"a",@"b",@"c",@"d",@"e",@"f",@"g",@"h",@"j",@"k",@"m",@"q",@"x",@"y",@"z"];
    
    
    NSMutableArray *_mysqlVlist = [[NSMutableArray alloc] init];
    for (NSString *f in mysqlVlist) {
        
        NSString *path =[NSString stringWithFormat:@"%@/%@", mysqlDir,f];
        BOOL isDir;
        [fm fileExistsAtPath:path isDirectory:&isDir];
        if (!isDir){
            continue;
        }
        
        if([f hasPrefix:@"mysql"]){
            NSString *v = [f stringByReplacingOccurrencesOfString:@"mysql" withString:@""];
            [_mysqlVlist addObject:v];
        }
    }

    [_mysqlVlist sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        if ([obj1 intValue]>[obj2 intValue]){
            return YES;
        }
        return NO;
    }];
    
    for (NSString *f in _mysqlVlist) {
        NSMenu *vMenu = [self getMysqlVerMenu:f];
        
        NSMenuItem *vItem = [[NSMenuItem alloc] initWithTitle:f
                                                       action:@selector(mysqlStatusSet:)
                                                keyEquivalent:[NSString stringWithFormat:@"%@", [letter objectAtIndex:i]]];
        if ( [self checkMysqlStatus:f] ){
            vItem.state = 1;
        }
        [newMenu addItem:vItem];
        [newMenu setSubmenu:vMenu forItem:vItem];
        i++;
    }
    
    [newMenu addItem:[NSMenuItem separatorItem]];
    NSMenuItem *refresh = [[NSMenuItem alloc] initWithTitle:@"refresh"
                                                     action:@selector(mysqlRefresh:)
                                              keyEquivalent:@"!"];
    refresh.state = 1;
    [newMenu addItem:refresh];
    // Submenu already attached in XIB

}

// Opt-in to secure restorable state to silence warnings on supported macOS versions
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app
{
    return YES;
}

-(void)mysqlRefresh:(id)sender
{
    [self initMySQLList];
}

-(void)mysqlStatusSet:(id)sender {
    
    NSString *rootDir = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    NSMenuItem *cItem = (NSMenuItem *)sender;
    
    NSString *myVer = [cItem title];
    NSString *phpDir = [NSString stringWithFormat:@"%@bin/mysql/mysql%@", rootDir, myVer];
    
    if (![fm fileExistsAtPath:phpDir]){
        NSString *notice = [NSString stringWithFormat:@"MYSQL-%@没有安装,请先安装再使用!!", myVer];
        [self userCenter:notice];
        return;
    }
    
    [NSCommon delayedRun:1 callback:^{
        [self mysqlTrigger:myVer];
        [NSCommon delayedRun:1 callback:^{
            [self mysqlRefresh:sender];
        }];
    }];
}

-(NSMenu*)getMysqlVerMenu:(NSString *)title
{
    NSMenu *vMenu = [[NSMenu alloc] initWithTitle:title];
    
    [vMenu addItemWithTitle:@"Install" action:@selector(mysqlInstall:) keyEquivalent:@""];
    [vMenu addItemWithTitle:@"UnInstall" action:@selector(mysqlUninstall:) keyEquivalent:@""];

    if ( [self checkMysqlStatus:title] ){
        [vMenu addItemWithTitle:@"Reload" action:@selector(mysqlReload:) keyEquivalent:@""];
    }
    [vMenu addItemWithTitle:@"Dir" action:@selector(mysqlDir:) keyEquivalent:@""];
    return vMenu;
}


-(void)mysqlDir:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    [NSCommon delayedRun:0 callback:^{
        NSString *str = [NSString stringWithFormat:@"%@bin/mysql/mysql%@",rootDir,pMenu.title];
        BOOL isDir = YES;
        if ([fm fileExistsAtPath:str isDirectory:&isDir]){
            [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:str, nil]] waitUntilExit];
        } else {
            [self userCenter:[NSString stringWithFormat:@"MYSQL%@目录不存在!",pMenu.title]];
        }
    }];
}

-(BOOL)checkMysqlStatus:(NSString *)ver
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager defaultManager];
    
    NSString *path = [NSString stringWithFormat:@"%@bin/mysql/mysql%@/data/mysql.pid", rootDir,ver];
//    NSLog(@"mysql:%@",path);
    return [fm fileExistsAtPath:path];
}

-(void)mysqlTrigger:(NSString *)version
{
    NSFileManager *fm = [NSFileManager defaultManager];
    
    NSString *rootDir           = [NSCommon getRootDir];
    NSString *phpDir = [NSString stringWithFormat:@"%@bin/mysql/mysql%@", rootDir, version];
    
    if (![fm fileExistsAtPath:phpDir]){
        NSString *notice = [NSString stringWithFormat:@"MYSQL-%@没有安装,请先安装再使用!!", version];
        [self userCenter:notice];
        return;
    }
    
    if ( [self checkMysqlStatus:version] ){
        [self mysqlCmdStop:version];
        [self userCenter:[NSString stringWithFormat:@"停止MYSQL%@成功!", version]];
    } else {
        [self mysqlCmdStart:version];
        [self userCenter:[NSString stringWithFormat:@"启动MYSQL%@成功!", version]];
    }

}

#pragma 启动当前MYSQL
-(void)mysqlCmdStart:(NSString *)version
{
    NSString *rootDir = [NSCommon getRootDir];
    NSString *cmd = [NSString stringWithFormat:@"%@bin/reinstall/cmd/mysql/mysql%@/start.sh", rootDir, version];
    [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]] waitUntilExit];
}

#pragma 停止当前MYSQL
-(void)mysqlCmdStop:(NSString *)version
{
    NSString *rootDir = [NSCommon getRootDir];
    NSString *cmd = [NSString stringWithFormat:@"%@bin/reinstall/cmd/mysql/mysql%@/stop.sh", rootDir, version];
    [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]] waitUntilExit];
}

-(void)mysqlReload:(id)sender
{
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    NSString *myVer = [pMenu title];
    
    
    NSString *rootDir = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    NSString *cmd = [NSString stringWithFormat:@"%@bin/reinstall/cmd/mysql/mysql%@/reload.sh", rootDir, myVer];
    
    if ([fm fileExistsAtPath:cmd]){
        [self userCenter:[NSString stringWithFormat:@"执行重启MYSQL%@成功!", myVer]];
        [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]] waitUntilExit];
    } else {
        [self userCenter:[NSString stringWithFormat:@"重启MYSQL%@文件不存在!", myVer]];
    }
}

-(void)mysqlInstall:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/cmd/mysql/mysql%@/install.sh", rootDir, pMenu.title];
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    
    if (![fm fileExistsAtPath:logDir]){
        [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    }
    
    NSString *log = [NSString stringWithFormat:@"%@/mysql_%@_install.log", logDir, pMenu.title];
    
    NSString *cmd = [NSString stringWithFormat:@"%@ 1> %@ 2>&1", installSh,log];
    [NSCommon delayedRun:2 callback:^{
        [self openFile:log];
    }];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
}

-(void)mysqlUninstall:(id)sender
{
    NSString *rootDir           = [NSCommon getRootDir];
    NSFileManager *fm = [NSFileManager  defaultManager];
    
    NSMenuItem *cMenu = (NSMenuItem*)sender;
    NSMenuItem *pMenu=[cMenu parentItem];
    
    NSString *installSh = [NSString stringWithFormat:@"%@bin/reinstall/cmd/mysql/mysql%@/uninstall.sh", rootDir, pMenu.title];
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    
    NSString *log = [NSString stringWithFormat:@"%@bin/logs/reinstall/mysql_%@_uninstall.log", rootDir, pMenu.title];
    [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    
    NSString *cmd = [NSString stringWithFormat:@"%@ 1>> %@ 2>&1", installSh,log];
    [NSCommon delayedRun:1 callback:^{
        [self openFile:log];
    }];
    
    [NSCommon delayedRun:0 callback:^{
        [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", cmd, nil]];
    }];
}


#pragma mark - 初始化MYSQL版本列表-END -

-(void)selfphpMsgStart:(NSNotification *)sender {
    NSDictionary *dic = sender.userInfo;
    NSString *ver =[dic objectForKey:@"ver"];
    [self userCenter:[NSString stringWithFormat:@"PHP%@检测未启动,已执行启动!",ver]];
}

#pragma mark - 程序加载时执行 -
 // Avoid rebuilding menus during AppKit update cycles to prevent menu inconsistencies
 // - Remove eager rebuild from applicationWillUpdate
 // - We now rebuild in applicationDidFinishLaunching and applicationDidBecomeActive
 //- (void)applicationWillUpdate:(NSNotification *)notification{
 //    [self initCmdList];
 //}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    [self installHelp];
    
    //初始化php版本信息
    [NSCommon setCommonConfig:PHP_C_VER_KEY value:@"71"];
    [NSCommon setCommonConfig:PHP_S_VER_KEY value:@"56"];
    [NSCommon setCommonConfig:MYSQL_C_VER_KEY value:@"80"];
    [NSCommon setCommonConfig:@"isOpenModMySQLPwdWindow" value:@"no"];
    
    NSString *rootDir = [NSCommon getRootDir];
    
    NSFileManager *fm = [NSFileManager  defaultManager];
    NSString *logDir = [NSString stringWithFormat:@"%@bin/logs/reinstall", rootDir];
    if ([NSCommon fileIsExists:logDir]){
        [fm createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:NULL error:NULL];
    }
    
    [self initCmdList];
    [self initPhpList];
    [self initMySQLList];
    
    [self checkWebStatus];
    
    [self checkRedisStatus];
    [self checkMongoStatus];
    [self checkMemcachedStatus];
    [self checkMySQLOnStatus];
    
    [self setBarStatus];
    
    NSString *isos = [NSCommon getCommonConfig:@"isOpenAfterStart"];
    if ([isos isEqualTo:@"1"]) {
        sleep(1);
        [self startWebService];
    }
    
    //消息
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selfReStart) name: @"reloadSVC" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selfphpMsgStart:) name: @"startPhpVerInChange" object:nil];
}

 -(void) applicationDidBecomeActive:(NSNotification *)notification
 {
     // Defer menu rebuild slightly to avoid racing with system Services population
     [NSCommon delayedRun:0.05 callback:^{
         [self initCmdList];
         [self initPhpList];
         [self initMySQLList];
         
         [self checkWebStatus];
         
         [self checkRedisStatus];
         [self checkMongoStatus];
         [self checkMemcachedStatus];
         [self checkMySQLOnStatus];
     }];
 }

#pragma mark - 点击dock应用图标重新弹出主窗口
-(BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication
                   hasVisibleWindows:(BOOL)flag{
    if (!flag){
        [NSApp activateIgnoringOtherApps:NO];
        [self.window makeKeyAndOrderFront:self];
    }
    return YES;
}

#pragma mark - 程序退出时执行
- (void)applicationWillTerminate:(NSNotification *)aNotification {
    
    NSString *iseall = [NSCommon getCommonConfig:@"isExitAfterCloseAll"];
    if ([iseall isEqualTo:@"1"]) {
        sleep(1);
        [self stopWebService];
    }
    
    [NSCommon setCommonConfig:@"isOpenModMySQLPwdWindow" value:@"no"];
}
@end




================================================
FILE: mdserver/mdserver/Base.lproj/Credits.rtf
================================================
{\rtf1\ansi\ansicpg1252\cocoartf2580
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset134 STHeitiSC-Light;\f1\fswiss\fcharset0 Helvetica;\f2\fswiss\fcharset0 Helvetica-Bold;
\f3\fnil\fcharset134 STHeitiSC-Medium;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww9600\viewh8400\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0

\f0\fs24 \cf0 \'bd\'e7\'c3\'e6\'c9\'e8\'bc\'c6
\f1 :
\f2\b \expnd0\expndtw0\kerning0
\
\kerning1\expnd0\expndtw0 midoks
\f1\b0 \expnd0\expndtw0\kerning0
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural\partightenfactor0

\f0 \cf0 \'cf\'ee\'c4\'bf\'d4\'b4\'c2\'eb\'d6\'f7\'d2\'b3:\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural\partightenfactor0
{\field{\*\fldinst{HYPERLINK "https://github.com/midoks/mdserver-mac"}}{\fldrslt 
\f1 \cf0 https://github.com/midoks/mdserver-mac}}
\f1 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural\partightenfactor0

\f0 \cf0 \kerning1\expnd0\expndtw0 \'d7\'f7\'d5\'df\'b2\'a9\'bf\'cd\'d6\'f7\'d2\'b3
\f1 :
\f2\b \expnd0\expndtw0\kerning0
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
{\field{\*\fldinst{HYPERLINK "http://midoks.cachecha.com/"}}{\fldrslt 
\f1\b0 \cf0 \kerning1\expnd0\expndtw0 http://www.cachecha.com/}}
\f1\b0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural\partightenfactor0

\f0 \cf0 \kerning1\expnd0\expndtw0 \'b9\'b1\'cf\'d7
\f1 :
\f2\b \expnd0\expndtw0\kerning0
\
midoks
\f1\b0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0

\f0 \cf0 \kerning1\expnd0\expndtw0 \'b8\'d0\'d0\'bb
\f1 :
\f2\b \expnd0\expndtw0\kerning0
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural\partightenfactor0

\f3 \cf0 \kerning1\expnd0\expndtw0 \'cb\'f9\'d3\'d0\'bf\'aa\'d4\'b4\'c8\'ed\'bc\'fe
\f2 \expnd0\expndtw0\kerning0
\
}

================================================
FILE: mdserver/mdserver/Base.lproj/MainMenu.xib
================================================
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19455" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
    <dependencies>
        <deployment identifier="macosx"/>
        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19455"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <objects>
        <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
            <connections>
                <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
            </connections>
        </customObject>
        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
        <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
            <connections>
                <outlet property="cmd" destination="0qH-Mk-cQl" id="Rwx-0g-48i"/>
                <outlet property="mMemcachedButton" destination="pcK-yB-8NY" id="yJ0-VU-5aq"/>
                <outlet property="mMemcachedTool" destination="gAm-U8-CgO" id="5jB-fA-AD8"/>
                <outlet property="mMongoButton" destination="5rd-h7-S8p" id="Zah-Dk-90V"/>
                <outlet property="mMongoTool" destination="lry-lY-Knx" id="y25-n4-wOb"/>
                <outlet property="mMySQLButton" destination="rFw-SI-Kgp" id="rpP-hb-9fD"/>
                <outlet property="mMySQLTool" destination="JJV-kP-Bb3" id="PCg-ZL-yHB"/>
                <outlet property="mRedisButton" destination="RKy-kT-jP0" id="0Ev-QT-zY3"/>
                <outlet property="mRedisTool" destination="FW6-8l-zZa" id="aKJ-vo-M7k"/>
                <outlet property="mysqlVer" destination="Obj-oA-QwR" id="3Zj-2e-DtJ"/>
                <outlet property="pNginxStatus" destination="iCn-DW-pu3" id="Snf-r4-mQN"/>
                <outlet property="pPHPStatus" destination="eq2-P5-dYn" id="O5h-bl-SRb"/>
                <outlet property="pProgress" destination="XYp-dI-Cdf" id="XsF-0U-mPu"/>
                <outlet property="pReStart" destination="l2b-ZL-DL0" id="Cvc-7X-bf2"/>
                <outlet property="pStart" destination="ynu-WP-Afh" id="2dP-Me-3oN"/>
                <outlet property="pStartTitle" destination="TMl-iR-kF8" id="iEx-i9-s5c"/>
                <outlet property="phpVer" destination="U5T-o3-HhE" id="K8k-Ji-Gf7"/>
                <outlet property="statusBarItemMenu" destination="2J9-UB-8Ud" id="5x7-db-8qk"/>
                <outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
            </connections>
        </customObject>
        <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
        <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6" userLabel="Menu Main">
            <items>
                <menuItem title="mdserver" id="1Xt-HY-uBw">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="mdserver" systemMenu="apple" id="uQy-DD-JDr">
                        <items>
                            <menuItem title="About mdserver" id="5kV-Vb-QxS">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
                            <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
                            <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
                            <menuItem title="Services" id="NMo-om-nkz">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
                            <menuItem title="Hide mdserver" keyEquivalent="h" id="Olw-nP-bQN">
                                <connections>
                                    <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
                                <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                                <connections>
                                    <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Show All" id="Kd2-mp-pUS">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
                            <menuItem title="Quit mdserver" keyEquivalent="q" id="4sb-4s-VLi">
                                <connections>
                                    <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="Window" id="aUF-d1-5bR">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
                        <items>
                            <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
                                <connections>
                                    <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Zoom" id="R4o-n2-Eq4">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
                            <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="CMD" id="0qH-Mk-cQl">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="CMD" id="IwK-hp-vvF"/>
                </menuItem>
                <menuItem title="PHP" id="U5T-o3-HhE" userLabel="Php">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="PHP" id="Qbf-RL-G3C"/>
                </menuItem>
                <menuItem title="MYSQL" id="Obj-oA-QwR">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="MYSQL" id="yR3-pB-Yj4"/>
                </menuItem>
                <menuItem title="Help" id="wpr-3q-Mcd">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
                        <items>
                            <menuItem title="mdserver Help" keyEquivalent="?" id="FKE-Sm-Kum">
                                <connections>
                                    <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
            </items>
            <point key="canvasLocation" x="160" y="-83"/>
        </menu>
        <menu id="2J9-UB-8Ud" userLabel="Menu Icon">
            <items>
                <menuItem title="显示主界面" id="TKn-nw-eEy">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <connections>
                        <action selector="showMain:" target="Voe-Tx-rLC" id="uxR-i4-nej"/>
                    </connections>
                </menuItem>
                <menuItem title="关注我" id="az0-YM-3ri">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <connections>
                        <action selector="showWeibo:" target="Voe-Tx-rLC" id="qFU-NO-FnS"/>
                    </connections>
                </menuItem>
                <menuItem title="捐赠我" id="UX8-jq-NWI">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <connections>
                        <action selector="showDonateAlipay:" target="Voe-Tx-rLC" id="fo3-jg-oHT"/>
                    </connections>
                </menuItem>
                <menuItem title="关于MDserver" id="5Pg-wU-sOP">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <connections>
                        <action selector="showAbout:" target="Voe-Tx-rLC" id="TwD-af-wpd"/>
                    </connections>
                </menuItem>
            </items>
            <point key="canvasLocation" x="771" y="56"/>
        </menu>
        <window title="mdserver" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
            <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
            <rect key="contentRect" x="471" y="228" width="600" height="500"/>
            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
            <value key="minSize" type="size" width="600" height="500"/>
            <value key="maxSize" type="size" width="600" height="500"/>
            <view key="contentView" autoresizesSubviews="NO" id="EiT-Mj-1SZ">
                <rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
                <autoresizingMask key="autoresizingMask"/>
                <subviews>
                    <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="mTe-Hw-6DS">
                        <rect key="frame" x="0.0" y="431" width="600" height="5"/>
                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                    </box>
                    <progressIndicator hidden="YES" wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="XYp-dI-Cdf">
                        <rect key="frame" x="472" y="456" width="16" height="16"/>
                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                    </progressIndicator>
                    <tabView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WOp-cV-L3f">
                        <rect key="frame" x="14" y="22" width="574" height="393"/>
                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                        <font key="font" metaFont="system"/>
                        <tabViewItems>
                            <tabViewItem label="General" identifier="1" image="NSAddTemplate" id="GiV-X5-aca">
                                <view key="view" placeholderIntrinsicWidth="554" placeholderIntrinsicHeight="354" id="AKV-5F-b0l">
                                    <rect key="frame" x="10" y="33" width="554" height="347"/>
                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                    <subviews>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hau-uk-1Ey">
                                            <rect key="frame" x="128" y="301" width="97" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="默认HTTP端口:" id="PdE-Wi-kt5">
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <textField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4FE-5V-96D">
                                            <rect key="frame" x="229" y="298" width="96" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" title="8000" drawsBackground="YES" id="Xer-XA-puc">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OEw-M3-giq">
                                            <rect key="frame" x="140" y="274" width="85" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="MySQL端口:" id="oTh-TW-90G">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <textField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vVI-zR-zCi">
                                            <rect key="frame" x="229" y="271" width="96" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" title="3306" drawsBackground="YES" id="Dso-T0-ynK">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tmR-xd-AZI">
                                            <rect key="frame" x="12" y="244" width="213" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="设置HTTP端口80和MySQL端口3306:" id="PGc-tY-REp">
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qBA-OQ-ZFu">
                                            <rect key="frame" x="223" y="233" width="179" height="32"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="push" title="设置端口8000&amp;3306" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Vks-fL-z7o">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="setCommonPort:" target="yKg-vm-BmC" id="udw-IQ-gVk"/>
                                            </connections>
                                        </button>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uPZ-g6-NbI">
                                            <rect key="frame" x="68" y="215" width="158" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="设置MDserver默认的端口:" id="yAp-SM-eu5">
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LzK-58-HE4">
                                            <rect key="frame" x="223" y="204" width="179" height="32"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="push" title="设置MDserver默认端口" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="90b-iZ-55U">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="setSpecialPort:" target="yKg-vm-BmC" id="PVe-we-cGr"/>
                                            </connections>
                                        </button>
                                        <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="OG7-BH-SDe">
                                            <rect key="frame" x="-9" y="197" width="566" height="5"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                        </box>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="icI-BH-qEf">
                                            <rect key="frame" x="227" y="64" width="139" height="18"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="check" title="启动时清空日志" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="gcX-tn-Raf">
                                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="isStartAfterFlushLog:" target="yKg-vm-BmC" id="3Et-uR-tNk"/>
                                            </connections>
                                        </button>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fYk-M8-7Rp">
                                            <rect key="frame" x="227" y="97" width="139" height="18"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="check" title="退出时停止所有服务" bezelStyle="regularSquare" imagePosition="left" inset="2" id="ovH-mh-OKX">
                                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="isExitAfterCloseAll:" target="yKg-vm-BmC" id="eSr-6L-2yI"/>
                                            </connections>
                                        </button>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DQv-Ob-Ytx">
                                            <rect key="frame" x="227" y="160" width="139" height="18"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="check" title="系统启动时自动启动" bezelStyle="regularSquare" imagePosition="left" enabled="NO" inset="2" id="63D-bl-cpA">
                                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="isSystemStartAfterStart:" target="yKg-vm-BmC" id="XjV-Qt-WUL"/>
                                            </connections>
                                        </button>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0E6-I8-Al0">
                                            <rect key="frame" x="227" y="128" width="139" height="18"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="check" title="打开本软件启动服务" bezelStyle="regularSquare" imagePosition="left" inset="2" id="lMh-rb-2dm">
                                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="isOpenAfterStart:" target="yKg-vm-BmC" id="0Ju-Ha-7IV"/>
                                            </connections>
                                        </button>
                                        <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="3Fz-JW-pvN">
                                            <rect key="frame" x="-3" y="44" width="588" height="5"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                        </box>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NUZ-q1-7LV">
                                            <rect key="frame" x="116" y="17" width="101" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Nginx Error Log:" id="UFY-a6-yT5">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <pathControl autoresizesSubviews="NO" focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lpR-Yx-xy5">
                                            <rect key="frame" x="223" y="13" width="251" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <pathCell key="cell" selectable="YES" focusRingType="none" alignment="left" id="6Oe-9w-G0e">
                                                <font key="font" metaFont="system"/>
                                                <url key="url" string="file:///Applications/"/>
                                            </pathCell>
                                        </pathControl>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ytx-kk-Skl">
                                            <rect key="frame" x="478" y="14" width="23" height="21"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSFollowLinkFreestandingTemplate" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="gho-Ch-307">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="goNginxErrorLog:" target="yKg-vm-BmC" id="k0l-ie-HGM"/>
                                            </connections>
                                        </button>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zfc-FD-Q2n">
                                            <rect key="frame" x="129" y="162" width="96" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="特殊设置:" id="G10-zG-sfy">
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                    </subviews>
                                </view>
                            </tabViewItem>
                            <tabViewItem label="HOSTS" identifier="1" image="NSAddTemplate" id="PY9-Tm-pe5">
                                <view key="view" id="L1w-M1-XQt">
                                    <rect key="frame" x="10" y="33" width="554" height="347"/>
                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                    <subviews>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ul9-33-hAx">
                                            <rect key="frame" x="7" y="14" width="23" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSAddTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="dD2-Ld-Bbv">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="add:" target="A2B-NI-gKD" id="Mib-Bc-CG3"/>
                                            </connections>
                                        </button>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VwO-po-2CV">
                                            <rect key="frame" x="29" y="14" width="24" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0sx-Ar-Gx3">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="remove:" target="A2B-NI-gKD" id="CPV-XU-FgF"/>
                                            </connections>
                                        </button>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WAo-tN-xz6">
                                            <rect key="frame" x="52" y="14" width="195" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" imagePosition="only" alignment="center" continuous="YES" enabled="NO" borderStyle="border" inset="2" id="v1j-w5-0BD">
                                                <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                        </button>
                                        <box horizontalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="s8J-UD-u5V">
                                            <rect key="frame" x="275" y="-10" width="5" height="362"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                        </box>
                                        <textField autoresizesSubviews="NO" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ivw-nI-5cQ">
                                            <rect key="frame" x="284" y="313" width="88" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Server Name:" id="xLJ-g2-qHc">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <textField autoresizesSubviews="NO" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kG5-si-is5">
                                            <rect key="frame" x="284" y="278" width="87" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Port Number:" id="Z4V-5v-FXb">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <textField autoresizesSubviews="NO" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f90-l0-zQM">
                                            <rect key="frame" x="285" y="248" width="87" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="PHP Version:" id="C62-W3-je5">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ffK-h8-Oef">
                                            <rect key="frame" x="285" y="192" width="105" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Doucment Root:" id="f4i-nq-I90">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <textField autoresizesSubviews="NO" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="k4l-qs-JF4">
                                            <rect key="frame" x="372" y="310" width="127" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" continuous="YES" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" bezelStyle="round" id="3O1-zh-lev">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                            <connections>
                                                <action selector="changeServerName:" target="A2B-NI-gKD" id="EUs-oF-vyG"/>
                                                <outlet property="delegate" destination="A2B-NI-gKD" id="qQa-r9-Y19"/>
                                            </connections>
                                        </textField>
                                        <textField autoresizesSubviews="NO" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4r4-hg-1kA">
                                            <rect key="frame" x="372" y="276" width="127" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" bezelStyle="round" id="2qc-Zi-m8h">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                            <connections>
                                                <action selector="changeServerPort:" target="A2B-NI-gKD" id="SpR-yq-j5x"/>
                                            </connections>
                                        </textField>
                                        <scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="22" horizontalPageScroll="10" verticalLineScroll="22" verticalPageScroll="10" usesPredominantAxisScrolling="NO" scrollerKnobStyle="light" translatesAutoresizingMaskIntoConstraints="NO" id="UWK-bH-meB">
                                            <rect key="frame" x="7" y="35" width="240" height="297"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="0RZ-5f-Xjz">
                                                <rect key="frame" x="1" y="1" width="238" height="295"/>
                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                <subviews>
                                                    <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="20" rowSizeStyle="automatic" headerView="B9H-aO-DLa" viewBased="YES" id="tNs-DA-7w6">
                                                        <rect key="frame" x="0.0" y="0.0" width="253" height="278"/>
                                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                        <size key="intercellSpacing" width="3" height="2"/>
                                                        <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                        <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
                                                        <tableColumns>
                                                            <tableColumn identifier="hostname" width="125.34765625" minWidth="40" maxWidth="1000" id="i8U-Cb-htP">
                                                                <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="hostname">
                                                                    <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                    <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
                                                                </tableHeaderCell>
                                                                <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="ONn-AB-HbN">
                                                                    <font key="font" metaFont="system"/>
                                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                                    <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                </textFieldCell>
                                                                <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                                <prototypeCellViews>
                                                                    <tableCellView identifier="hostname" id="z4R-pW-Rsb">
                                                                        <rect key="frame" x="11" y="1" width="130" height="20"/>
                                                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                                        <subviews>
                                                                            <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZSi-AY-1ia">
                                                                                <rect key="frame" x="0.0" y="3" width="130" height="17"/>
                                                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
                                                                                <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="cell" id="skf-Z3-l4l">
                                                                                    <font key="font" metaFont="system"/>
                                                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                                                    <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                                                                </textFieldCell>
                                                                            </textField>
                                                                        </subviews>
                                                                        <connections>
                                                                            <outlet property="textField" destination="ZSi-AY-1ia" id="41c-hw-wRo"/>
                                                                        </connections>
                                                                    </tableCellView>
                                                                </prototypeCellViews>
                                                            </tableColumn>
                                                            <tableColumn identifier="port" width="67.5" minWidth="40" maxWidth="1000" id="KEW-qE-O2B" userLabel="port">
                                                                <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="port">
                                                                    <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                    <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
                                                                </tableHeaderCell>
                                                                <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="P1w-pl-uMh">
                                                                    <font key="font" metaFont="system"/>
                                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                                    <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                </textFieldCell>
                                                                <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                                <prototypeCellViews>
                                                                    <tableCellView id="fIa-93-cdc">
                                                                        <rect key="frame" x="144" y="1" width="68" height="20"/>
                                                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                                        <subviews>
                                                                            <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u1M-08-mKh">
                                                                                <rect key="frame" x="0.0" y="3" width="68" height="17"/>
                                                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
                                                                                <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="cell" id="Opr-ZN-LMY">
                                                                                    <font key="font" metaFont="system"/>
                                                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                                                    <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                                                                </textFieldCell>
                                                                            </textField>
                                                                        </subviews>
                                                                        <connections>
                                                                            <outlet property="textField" destination="u1M-08-mKh" id="30l-kE-jd6"/>
                                                                        </connections>
                                                                    </tableCellView>
                                                                </prototypeCellViews>
                                                            </tableColumn>
                                                            <tableColumn identifier="php" width="42" minWidth="40" maxWidth="1000" id="ciU-HK-O62" userLabel="php">
                                                                <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="php">
                                                                    <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                    <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
                                                                </tableHeaderCell>
                                                                <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="fEr-S3-dR4">
                                                                    <font key="font" metaFont="system"/>
                                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                                    <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                </textFieldCell>
                                                                <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                                <prototypeCellViews>
                                                                    <tableCellView identifier="php" id="waE-Ly-C4e">
                                                                        <rect key="frame" x="215" y="1" width="46" height="20"/>
                                                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                                        <subviews>
                                                                            <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hbp-q7-YaK">
                                                                                <rect key="frame" x="0.0" y="3" width="46" height="17"/>
                                                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
                                                                                <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="cell" id="h3Q-Yd-3S5">
                                                                                    <font key="font" metaFont="system"/>
                                                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                                                    <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                                                                </textFieldCell>
                                                                            </textField>
                                                                        </subviews>
                                                                        <connections>
                                                                            <outlet property="textField" destination="hbp-q7-YaK" id="Bi8-l0-PZj"/>
                                                                        </connections>
                                                                    </tableCellView>
                                                                </prototypeCellViews>
                                                            </tableColumn>
                                                        </tableColumns>
                                                        <connections>
                                                            <outlet property="dataSource" destination="A2B-NI-gKD" id="wcF-4p-ljV"/>
                                                            <outlet property="delegate" destination="A2B-NI-gKD" id="LyI-Fh-htL"/>
                                                        </connections>
                                                    </tableView>
                                                </subviews>
                                                <nil key="backgroundColor"/>
                                            </clipView>
                                            <scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="A7A-Su-Dgr">
                                                <rect key="frame" x="1" y="280" width="238" height="16"/>
                                                <autoresizingMask key="autoresizingMask"/>
                                            </scroller>
                                            <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="33F-Hx-qfL">
                                                <rect key="frame" x="224" y="17" width="15" height="102"/>
                                                <autoresizingMask key="autoresizingMask"/>
                                            </scroller>
                                            <tableHeaderView key="headerView" id="B9H-aO-DLa">
                                                <rect key="frame" x="0.0" y="0.0" width="253" height="17"/>
                                                <autoresizingMask key="autoresizingMask"/>
                                            </tableHeaderView>
                                        </scrollView>
                                        <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sqd-Gn-UUj">
                                            <rect key="frame" x="302" y="10" width="92" height="32"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="push" title="恢复设置" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="qhA-nw-2qi">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="revert:" target="A2B-NI-gKD" id="UI6-mc-XJc"/>
                                            </connections>
                                        </button>
                                        <pathControl focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gbO-JY-Wqj">
                                            <rect key="frame" x="284" y="162" width="266" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <pathCell key="cell" truncatesLastVisibleLine="YES" selectable="YES" editable="YES" focusRingType="none" baseWritingDirection="leftToRight" alignment="left" id="r4x-3z-1IC">
                                                <font key="font" metaFont="system"/>
                                                <url key="url" string="file:///Applications/"/>
                                            </pathCell>
                                            <connections>
                                                <action selector="openCellDir:" target="A2B-NI-gKD" id="2Qz-UA-5HL"/>
                                                <outlet property="delegate" destination="A2B-NI-gKD" id="Kg6-an-bIo"/>
                                            </connections>
                                        </pathControl>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gyv-lq-mU0">
                                            <rect key="frame" x="476" y="188" width="23" height="23"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="docs" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="gK8-ym-c5G">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="selectedDIr:" target="A2B-NI-gKD" id="cKc-Gx-5WL"/>
                                            </connections>
                                        </button>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tiS-uT-0A8">
                                            <rect key="frame" x="457" y="188" width="23" height="23"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSFollowLinkFreestandingTemplate" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="d5i-Pw-72t">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system" size="30"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="openDir:" target="A2B-NI-gKD" id="mFa-Mu-3v5"/>
                                            </connections>
                                        </button>
                                        <imageView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aol-PQ-9yu">
                                            <rect key="frame" x="396" y="193" width="14" height="14"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="proportionallyDown" image="NSInvalidDataFreestandingTemplate" id="Rjr-7Z-cqC"/>
                                        </imageView>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pVa-71-yAg">
                                            <rect key="frame" x="507" y="309" width="18" height="21"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSFollowLinkFreestandingTemplate" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="b0w-uT-FQy">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="goWebSite:" target="A2B-NI-gKD" id="uT3-DY-5yg"/>
                                            </connections>
                                        </button>
                                        <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Dym-99-nDe">
                                            <rect key="frame" x="451" y="10" width="92" height="32"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="push" title="保存设置" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="4wZ-C7-tYJ">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="save:" target="A2B-NI-gKD" id="4U2-aj-qfo"/>
                                            </connections>
                                        </button>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Iw9-ep-fIi">
                                            <rect key="frame" x="529" y="310" width="21" height="21"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="info" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="Fjy-5F-QYr">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="goWebInfo:" target="A2B-NI-gKD" id="LeX-WS-ggu"/>
                                            </connections>
                                        </button>
                                        <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="XSr-aR-0jX">
                                            <rect key="frame" x="277" y="216" width="280" height="5"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                        </box>
                                        <popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Z4t-4S-Izv">
                                            <rect key="frame" x="371" y="241" width="131" height="26"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <popUpButtonCell key="cell" type="push" title="Item 2" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" inset="2" preferredEdge="maxY" selectedItem="fJ0-Fm-7Kb" id="If9-kF-DLb">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="menu"/>
                                                <menu key="menu" id="c3H-rX-HVx">
                                                    <items>
                                                        <menuItem title="Item 2" state="on" id="fJ0-Fm-7Kb"/>
                                                        <menuItem title="Item 3" state="on" id="WLx-Uh-mP7"/>
                                                        <menuItem title="Item 3" state="on" id="VHO-3j-vXF"/>
                                                    </items>
                                                </menu>
                                            </popUpButtonCell>
                                        </popUpButton>
                                        <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Uo7-Fm-gdJ">
                                            <rect key="frame" x="52" y="13" width="27" height="24"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="docs" imagePosition="overlaps" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="uyB-2a-sSK">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="label" size="9"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="openConfigDir:" target="A2B-NI-gKD" id="wW5-cN-IRU"/>
                                            </connections>
                                        </button>
                                    </subviews>
                                </view>
                            </tabViewItem>
                            <tabViewItem label="MySQL" identifier="1" image="NSAddTemplate" id="nDn-si-qIs">
                                <view key="view" placeholderIntrinsicWidth="554" placeholderIntrinsicHeight="354" id="BE5-bJ-h7T">
                                    <rect key="frame" x="10" y="33" width="554" height="347"/>
                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                    <subviews>
                                        <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ORc-V4-qLF">
                                            <rect key="frame" x="261" y="300" width="92" height="32"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="push" title="更改密码" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6aK-ad-TIf">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="modMySQLPwd:" target="LQn-5o-BhM" id="xem-yy-YVZ"/>
                                            </connections>
                                        </button>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zXL-h4-kBF">
                                            <rect key="frame" x="147" y="310" width="117" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="更改账户root密码:" id="JU5-y2-E2S">
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="fib-q6-yap">
                                            <rect key="frame" x="-3" y="259" width="560" height="5"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                        </box>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" setsMaxLayoutWidthAtFirstLayout="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4Z5-b8-oNC">
                                            <rect key="frame" x="265" y="270" width="227" height="30"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" truncatesLastVisibleLine="YES" sendsActionOnEndEditing="YES" title="当你的MAC电脑连接互联网时,为了安全,你应该修改MySQL账户root的密码。" id="bz8-NV-97g">
                                                <font key="font" size="10" name="STHeitiSC-Light"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="EPA-6n-o1V">
                                            <rect key="frame" x="-3" y="156" width="560" height="5"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                        </box>
                                        <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="FPL-GO-aGi">
                                            <rect key="frame" x="-3" y="103" width="560" height="5"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                        </box>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dcL-To-cao">
                                            <rect key="frame" x="247" y="240" width="133" height="18"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="check" title="允许链接到MySQL" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="DLD-RO-SUt">
                                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                <font key="font" size="13" name="STHeitiSC-Light"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="isAllowToConnectMysql:" target="LQn-5o-BhM" id="Q5W-UA-vgK"/>
                                            </connections>
                                        </button>
                                        <matrix verticalHuggingPriority="750" fixedFrame="YES" allowsEmptySelection="NO" autorecalculatesCellSize="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7z7-Xj-fAG">
                                            <rect key="frame" x="267" y="200" width="100" height="38"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            <size key="cellSize" width="102" height="18"/>
                                            <size key="intercellSpacing" width="4" height="2"/>
                                            <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="YzZ-it-ale">
                                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <cells>
                                                <column>
                                                    <buttonCell type="radio" title="仅允许本电脑" imagePosition="left" alignment="left" state="on" tag="1" inset="2" id="njG-PK-Fr9">
                                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                        <font key="font" metaFont="system"/>
                                                        <connections>
                                                            <action selector="AllowConnectLocalMysql:" target="LQn-5o-BhM" id="v1j-jH-MSb"/>
                                                        </connections>
                                                    </buttonCell>
                                                    <buttonCell type="radio" title="允许其他电脑" imagePosition="left" alignment="left" inset="2" id="opB-Ra-WNa">
                                                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                                        <font key="font" metaFont="system"/>
                                                        <connections>
                                                            <action selector="AllowConnectOtherMysql:" target="LQn-5o-BhM" id="4KN-EC-t1X"/>
                                                        </connections>
                                                    </buttonCell>
                                                </column>
                                            </cells>
                                        </matrix>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vst-nH-m3j">
                                            <rect key="frame" x="151" y="123" width="107" height="17"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="MySQL Log File:" id="2xb-jP-u5b">
                                                <font key="font" metaFont="system"/>
                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                            </textFieldCell>
                                        </textField>
                                        <pathControl focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1HA-go-bxJ">
                                            <rect key="frame" x="258" y="120" width="232" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <pathCell key="cell" selectable="YES" editable="YES" focusRingType="none" alignment="left" id="7dG-qE-OIv">
                                                <font key="font" metaFont="system"/>
                                                <url key="url" string="file://localhost/Applications/"/>
                                            </pathCell>
                                        </pathControl>
                                        <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xb6-wC-uSV">
                                            <rect key="frame" x="498" y="120" width="35" height="22"/>
                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                            <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSFollowLinkFreestandingTemplate" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="BbB-81-iyz">
                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                <font key="font" metaFont="system"/>
                                            </buttonCell>
                                            <connections>
                                                <action selector="goMysqlLogPath:" target="LQn-5o-BhM" id="EAI-o2-ufZ"/>
                                            </connections>
                                        </button>
                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YJO-IU-Z25">
                                            <rect key="frame" x="177" y="55" width="86" height="17"/>
   
Download .txt
gitextract_myctrjsf/

├── .gitignore
├── FQ.md
├── LICENSE.md
├── README.md
├── README_2x.md
├── README_3x.md
├── README_4x.md
├── _config.yml
├── build/
│   ├── build.plist
│   ├── build.sh
│   └── build2.sh
├── host/
│   ├── host/
│   │   ├── NSCommon.h
│   │   ├── NSCommon.m
│   │   └── main.m
│   └── host.xcodeproj/
│       ├── project.pbxproj
│       ├── project.xcworkspace/
│       │   ├── contents.xcworkspacedata
│       │   ├── xcshareddata/
│       │   │   └── IDEWorkspaceChecks.plist
│       │   └── xcuserdata/
│       │       └── midoks.xcuserdatad/
│       │           └── UserInterfaceState.xcuserstate
│       └── xcuserdata/
│           └── midoks.xcuserdatad/
│               └── xcschemes/
│                   ├── host.xcscheme
│                   └── xcschememanagement.plist
├── mdserver/
│   ├── mdserver/
│   │   ├── AppDelegate.h
│   │   ├── AppDelegate.m
│   │   ├── Base.lproj/
│   │   │   ├── Credits.rtf
│   │   │   ├── MainMenu.xib
│   │   │   └── mdserver Help/
│   │   │       └── index.html
│   │   ├── Controller/
│   │   │   ├── GeneralController.h
│   │   │   ├── GeneralController.m
│   │   │   ├── HostNameController.h
│   │   │   ├── HostNameController.m
│   │   │   ├── ModMySQLPwdController.h
│   │   │   ├── ModMySQLPwdController.m
│   │   │   ├── MySQLController.h
│   │   │   └── MySQLController.m
│   │   ├── Images.xcassets/
│   │   │   ├── AppIcon.appiconset/
│   │   │   │   └── Contents.json
│   │   │   └── Contents.json
│   │   ├── Info.plist
│   │   ├── MainAlipay.xib
│   │   ├── MainWeibo.xib
│   │   ├── ModMySQLPwd.xib
│   │   ├── Model/
│   │   │   ├── HostNameModel.h
│   │   │   └── HostNameModel.m
│   │   ├── NSCommon.h
│   │   ├── NSCommon.m
│   │   ├── NSTextField+Copypast.h
│   │   ├── NSTextField+Copypast.m
│   │   ├── Resources/
│   │   │   ├── Icon.icns
│   │   │   ├── Sequel Pro.icns
│   │   │   ├── addhost
│   │   │   ├── header_back_left.tif
│   │   │   ├── install_helper.sh
│   │   │   ├── mIcon.icns
│   │   │   ├── modMysqlPwd.sh
│   │   │   ├── my.cnf
│   │   │   ├── removehost
│   │   │   ├── script.sh
│   │   │   ├── ss
│   │   │   └── st
│   │   ├── common.plist
│   │   ├── en.lproj/
│   │   │   └── Credits.rtf
│   │   ├── main.m
│   │   └── server.plist
│   ├── mdserver.xcodeproj/
│   │   ├── project.pbxproj
│   │   ├── project.xcworkspace/
│   │   │   ├── contents.xcworkspacedata
│   │   │   └── xcshareddata/
│   │   │       └── IDEWorkspaceChecks.plist
│   │   └── xcuserdata/
│   │       └── midoks.xcuserdatad/
│   │           ├── xcdebugger/
│   │           │   └── Breakpoints_v2.xcbkptlist
│   │           └── xcschemes/
│   │               ├── mdserver.xcscheme
│   │               └── xcschememanagement.plist
│   └── mdserverTests/
│       ├── Info.plist
│       └── mdserverTests.m
└── ss/
    ├── ss/
    │   ├── NSCommon.h
    │   ├── NSCommon.m
    │   └── main.m
    └── ss.xcodeproj/
        ├── project.pbxproj
        ├── project.xcworkspace/
        │   ├── contents.xcworkspacedata
        │   ├── xcshareddata/
        │   │   └── IDEWorkspaceChecks.plist
        │   └── xcuserdata/
        │       └── midoks.xcuserdatad/
        │           └── UserInterfaceState.xcuserstate
        └── xcuserdata/
            └── midoks.xcuserdatad/
                └── xcschemes/
                    ├── ss.xcscheme
                    └── xcschememanagement.plist
Download .txt
SYMBOL INDEX (3 symbols across 3 files)

FILE: mdserver/mdserver/Controller/GeneralController.h
  function interface (line 12) | interface GeneralController : NSObject

FILE: mdserver/mdserver/Controller/ModMySQLPwdController.h
  function interface (line 12) | interface ModMySQLPwdController : NSWindowController <NSWindowDelegate>

FILE: mdserver/mdserver/Controller/MySQLController.h
  function interface (line 12) | interface MySQLController : NSWindowController
Condensed preview — 78 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (396K chars).
[
  {
    "path": ".gitignore",
    "chars": 250,
    "preview": "\nmdserver/mdserver.xcodeproj/project.xcworkspace/xcuserdata/midoks.xcuserdatad/UserInterfaceState.xcuserstate\n*.DS_Store"
  },
  {
    "path": "FQ.md",
    "chars": 831,
    "preview": "### mdserver(mac版) FQ\n```\nmysql \n用户名 root 密码 root\nmongoldb\nredis\n都是默认端口\n\n如果你想自己调试,可以看我的记录:\n\n目录:re2c-0.13.5\n\ncd re2c-0.13"
  },
  {
    "path": "LICENSE.md",
    "chars": 1073,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2016 midoks\n\nPermission is hereby granted, free of charge, to any person obtaining "
  },
  {
    "path": "README.md",
    "chars": 2926,
    "preview": "## mdserver(mac版) 5.0\n\nMac上高度可定制的PHP开发环境,集成必要的扩展,方便使用。\n(pkg安装方式),安装方便,是你Mac上的PHP开发利器。\n\n\n- 支持80端口。\n- OpenResty(1.21.4.3)支"
  },
  {
    "path": "README_2x.md",
    "chars": 1323,
    "preview": "### mdserver(mac版) 2.4.2.0\nmac上高度可定制的PHP开发环境,集成必要的扩展,方便使用。\n(pkg安装方式),安装方便,是你Mac上的PHP开发利器。\n- 加入redis,mongo,yaf,swoole组件。\n"
  },
  {
    "path": "README_3x.md",
    "chars": 1923,
    "preview": "## mdserver(mac版) 3.3.2.1\n\nMac上高度可定制的PHP开发环境,集成必要的扩展,方便使用。\n(pkg安装方式),安装方便,是你Mac上的PHP开发利器。\n\n- **PHP8 Alpha**\n- 支持80端口。\n- "
  },
  {
    "path": "README_4x.md",
    "chars": 2133,
    "preview": "## mdserver(mac版) 4.0.2.0\n\nMac上高度可定制的PHP开发环境,集成必要的扩展,方便使用。\n(pkg安装方式),安装方便,是你Mac上的PHP开发利器。\n\n\n- 支持80端口。\n- OpenResty(1.15.8"
  },
  {
    "path": "_config.yml",
    "chars": 25,
    "preview": "theme: jekyll-theme-slate"
  },
  {
    "path": "build/build.plist",
    "chars": 308,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>  \n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs"
  },
  {
    "path": "build/build.sh",
    "chars": 1205,
    "preview": "#!/bin/bash\n# 打包\n\nBUILD_DIR=$(cd \"$(dirname \"$0\")\"; pwd)\nROOT_DIR=$(dirname \"$BUILD_DIR\")\n\nAPP_NAME=\"mdserver\"\nAPP_VER=$"
  },
  {
    "path": "build/build2.sh",
    "chars": 289,
    "preview": "#!/bin/bash\n# 打包\ncd mdserver && xcodebuild -project mdserver.xcodeproj -scheme mdserver -configuration Debug build \ncd ."
  },
  {
    "path": "host/host/NSCommon.h",
    "chars": 389,
    "preview": "//\n//  NSCommon.h\n//  host\n//\n//  Created by midoks on 15/2/11.\n//  Copyright (c) 2015年 midoks. All rights reserved.\n//\n"
  },
  {
    "path": "host/host/NSCommon.m",
    "chars": 3636,
    "preview": "//\n//  NSCommon.m\n//  host\n//\n//  Created by midoks on 15/2/11.\n//  Copyright (c) 2015年 midoks. All rights reserved.\n//\n"
  },
  {
    "path": "host/host/main.m",
    "chars": 855,
    "preview": "//\n//  main.m\n//  host\n//\n//  Created by midoks on 15/2/11.\n//  Copyright (c) 2015年 midoks. All rights reserved.\n//\n\n#im"
  },
  {
    "path": "host/host.xcodeproj/project.pbxproj",
    "chars": 7890,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "host/host.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 149,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:host.xcodeproj\""
  },
  {
    "path": "host/host.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "chars": 238,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "host/host.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/host.xcscheme",
    "chars": 3083,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"0610\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "host/host.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/xcschememanagement.plist",
    "chars": 476,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "mdserver/mdserver/AppDelegate.h",
    "chars": 1369,
    "preview": "//\n//  AppDelegate.h\n//  mdserver\n//\n//  Created by midoks on 15/1/22.\n//  Copyright (c) 2015年 midoks. All rights reserv"
  },
  {
    "path": "mdserver/mdserver/AppDelegate.m",
    "chars": 78530,
    "preview": "//\n//  AppDelegate.m\n//  mdserver\n//\n//  Created by midoks on 15/1/22.\n//  Copyright (c) 2015年 midoks. All rights reserv"
  },
  {
    "path": "mdserver/mdserver/Base.lproj/Credits.rtf",
    "chars": 2339,
    "preview": "{\\rtf1\\ansi\\ansicpg1252\\cocoartf2580\n\\cocoatextscaling0\\cocoaplatform0{\\fonttbl\\f0\\fnil\\fcharset134 STHeitiSC-Light;\\f1\\"
  },
  {
    "path": "mdserver/mdserver/Base.lproj/MainMenu.xib",
    "chars": 116913,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.Cocoa.XIB\" version=\"3.0\" toolsVersion"
  },
  {
    "path": "mdserver/mdserver/Base.lproj/mdserver Help/index.html",
    "chars": 202,
    "preview": "<html>\n<head>\n<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n<meta name=\"AppleTitle\" content=\"mdserv"
  },
  {
    "path": "mdserver/mdserver/Controller/GeneralController.h",
    "chars": 944,
    "preview": "//\n//  GeneralController.h\n//  mdserver\n//\n//  Created by midoks on 15/2/6.\n//  Copyright (c) 2015年 midoks.cachecha.com."
  },
  {
    "path": "mdserver/mdserver/Controller/GeneralController.m",
    "chars": 4417,
    "preview": "//\n//  GeneralController.m\n//  mdserver\n//\n//  Created by midoks on 15/2/6.\n//  Copyright (c) 2015年 midoks.cachecha.com."
  },
  {
    "path": "mdserver/mdserver/Controller/HostNameController.h",
    "chars": 842,
    "preview": "//\n//  HostNameController.h\n//  mdserver\n//\n//  Created by midoks on 15/2/2.\n//  Copyright (c) 2015年 midoks.cachecha.com"
  },
  {
    "path": "mdserver/mdserver/Controller/HostNameController.m",
    "chars": 18040,
    "preview": "//\n//  HostNameController.m\n//  mdserver\n//\n//  Created by midoks on 15/2/2.\n//  Copyright (c) 2015年 midoks.cachecha.com"
  },
  {
    "path": "mdserver/mdserver/Controller/ModMySQLPwdController.h",
    "chars": 457,
    "preview": "//\n//  ModMySQLPwdController.h\n//  mdserver\n//\n//  Created by midoks on 15/2/13.\n//  Copyright (c) 2015年 midoks.cachecha"
  },
  {
    "path": "mdserver/mdserver/Controller/ModMySQLPwdController.m",
    "chars": 3040,
    "preview": "//\n//  ModMySQLPwdController.m\n//  mdserver\n//\n//  Created by midoks on 15/2/13.\n//  Copyright (c) 2015年 midoks.cachecha"
  },
  {
    "path": "mdserver/mdserver/Controller/MySQLController.h",
    "chars": 873,
    "preview": "//\n//  MySQLController.h\n//  mdserver\n//\n//  Created by midoks on 15/2/8.\n//  Copyright (c) 2015年 midoks.cachecha.com. A"
  },
  {
    "path": "mdserver/mdserver/Controller/MySQLController.m",
    "chars": 4199,
    "preview": "//\n//  MySQLController.m\n//  mdserver\n//\n//  Created by midoks on 15/2/8.\n//  Copyright (c) 2015年 midoks.cachecha.com. A"
  },
  {
    "path": "mdserver/mdserver/Images.xcassets/AppIcon.appiconset/Contents.json",
    "chars": 903,
    "preview": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"mac\",\n      \"size\" : \"16x16\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : "
  },
  {
    "path": "mdserver/mdserver/Images.xcassets/Contents.json",
    "chars": 62,
    "preview": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "mdserver/mdserver/Info.plist",
    "chars": 1342,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "mdserver/mdserver/MainAlipay.xib",
    "chars": 3663,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.Cocoa.XIB\" version=\"3"
  },
  {
    "path": "mdserver/mdserver/MainWeibo.xib",
    "chars": 4709,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.Cocoa.XIB\" version=\"3"
  },
  {
    "path": "mdserver/mdserver/ModMySQLPwd.xib",
    "chars": 7384,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.Cocoa.XIB\" version=\"3"
  },
  {
    "path": "mdserver/mdserver/Model/HostNameModel.h",
    "chars": 646,
    "preview": "//\n//  HostNameModel.h\n//  mdserver\n//\n//  Created by midoks on 15/2/2.\n//  Copyright (c) 2015年 midoks.cachecha.com. All"
  },
  {
    "path": "mdserver/mdserver/Model/HostNameModel.m",
    "chars": 1261,
    "preview": "//\n//  HostNameModel.m\n//  mdserver\n//\n//  Created by midoks on 15/2/2.\n//  Copyright (c) 2015年 midoks.cachecha.com. All"
  },
  {
    "path": "mdserver/mdserver/NSCommon.h",
    "chars": 1500,
    "preview": "//\n//  NSCommon.h\n//  mdserver\n//\n//  Created by midoks on 15/1/26.\n//  Copyright (c) 2015年 midoks.cachecha.com. All rig"
  },
  {
    "path": "mdserver/mdserver/NSCommon.m",
    "chars": 13267,
    "preview": "//\n//  NSCommon.m\n//  mdserver\n//\n//  Created by midoks on 15/1/26.\n//  Copyright (c) 2015年 midoks All rights reserved.\n"
  },
  {
    "path": "mdserver/mdserver/NSTextField+Copypast.h",
    "chars": 261,
    "preview": "//\n//  NSTextField+Copypast.h\n//  mdserver\n//\n//  Created by midoks on 2019/4/13.\n//  Copyright © 2019年 midoks.cachecha."
  },
  {
    "path": "mdserver/mdserver/NSTextField+Copypast.m",
    "chars": 1248,
    "preview": "//\n//  NSTextField+Copypast.m\n//  mdserver\n//\n//  Created by midoks on 2019/4/13.\n//  Copyright © 2019年 midoks.cachecha."
  },
  {
    "path": "mdserver/mdserver/Resources/install_helper.sh",
    "chars": 988,
    "preview": "#!/bin/sh\n\n#  install_helper.sh\n#  mdserver-mac\n\ncd \"$(dirname \"${BASH_SOURCE[0]}\")\"\nUSER=$(who | sed -n \"2,1p\" |awk '{p"
  },
  {
    "path": "mdserver/mdserver/Resources/modMysqlPwd.sh",
    "chars": 220,
    "preview": "#! /bin/sh\nDIR=$(cd \"$(dirname \"$0\")\"; pwd)\nDIR=$(dirname \"$DIR\")\nPATH=$PATH:$DIR/cmd/\n\n#密码修改\n$DIR/bin/mysql/bin/mysql -"
  },
  {
    "path": "mdserver/mdserver/Resources/my.cnf",
    "chars": 890,
    "preview": "[client]\n#password\t= your_password\nport\t\t= {SQL_PORT}\nsocket\t\t= /tmp/mysql.sock\n\n# Here follows entries for some specifi"
  },
  {
    "path": "mdserver/mdserver/Resources/script.sh",
    "chars": 323,
    "preview": "#! /bin/sh\nDIR=$(cd \"$(dirname \"$0\")\"; pwd)\n\ndoCMD=$1\n\nif [ \"$doCMD\" == \"stop\" ];then\n    cd /Applications/mdserver/bin "
  },
  {
    "path": "mdserver/mdserver/common.plist",
    "chars": 181,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "mdserver/mdserver/en.lproj/Credits.rtf",
    "chars": 2306,
    "preview": "{\\rtf1\\ansi\\ansicpg1252\\cocoartf2580\n\\cocoatextscaling0\\cocoaplatform0{\\fonttbl\\f0\\fnil\\fcharset134 STHeitiSC-Light;\\f1\\"
  },
  {
    "path": "mdserver/mdserver/main.m",
    "chars": 232,
    "preview": "//\n//  main.m\n//  mdserver\n//\n//  Created by midoks on 15/1/22.\n//  Copyright (c) 2015年 midoks. All rights reserved.\n//\n"
  },
  {
    "path": "mdserver/mdserver/server.plist",
    "chars": 422,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "mdserver/mdserver.xcodeproj/project.pbxproj",
    "chars": 38664,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 54;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "mdserver/mdserver.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 153,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:mdserver.xcodep"
  },
  {
    "path": "mdserver/mdserver.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "chars": 238,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "mdserver/mdserver.xcodeproj/xcuserdata/midoks.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist",
    "chars": 140,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bucket\n   uuid = \"83F05F3A-F4A3-4A05-96A6-CDB2263FC42D\"\n   type = \"1\"\n   version"
  },
  {
    "path": "mdserver/mdserver.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/mdserver.xcscheme",
    "chars": 4229,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"2600\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "mdserver/mdserver.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/xcschememanagement.plist",
    "chars": 570,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "mdserver/mdserverTests/Info.plist",
    "chars": 790,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "mdserver/mdserverTests/mdserverTests.m",
    "chars": 856,
    "preview": "//\n//  mdserverTests.m\n//  mdserverTests\n//\n//  Created by midoks on 15/1/22.\n//  Copyright (c) 2015年 midoks. All rights"
  },
  {
    "path": "ss/ss/NSCommon.h",
    "chars": 290,
    "preview": "//\n//  NSCommon.h\n//  host\n//\n//  Created by midoks on 15/2/11.\n//  Copyright (c) 2015年 midoks. All rights reserved.\n//\n"
  },
  {
    "path": "ss/ss/NSCommon.m",
    "chars": 911,
    "preview": "//\n//  NSCommon.m\n//  host\n//\n//  Created by midoks on 15/2/11.\n//  Copyright (c) 2015年 midoks. All rights reserved.\n//\n"
  },
  {
    "path": "ss/ss/main.m",
    "chars": 877,
    "preview": "//\n//  main.m\n//  ss\n//\n//  Created by midoks on 15/2/12.\n//  Copyright (c) 2015年 midoks. All rights reserved.\n//\n\n#impo"
  },
  {
    "path": "ss/ss.xcodeproj/project.pbxproj",
    "chars": 7860,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "ss/ss.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 147,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:ss.xcodeproj\">\n"
  },
  {
    "path": "ss/ss.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "chars": 238,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "ss/ss.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/ss.xcscheme",
    "chars": 3059,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"0610\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "ss/ss.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/xcschememanagement.plist",
    "chars": 474,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  }
]

// ... and 10 more files (download for full content)

About this extraction

This page contains the full source code of the midoks/mdserver-mac GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 78 files (354.0 KB), approximately 96.8k tokens, and a symbol index with 3 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!