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 ================================================ compileBitcode method mac-application ================================================ 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 #import #include @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 *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 #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 = ""; }; 820F1E8F1A8B89B100CBC093 /* NSCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCommon.h; sourceTree = ""; }; 820F1E901A8B89B100CBC093 /* NSCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCommon.m; sourceTree = ""; }; /* 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 = ""; }; 820F1E861A8B88AD00CBC093 /* Products */ = { isa = PBXGroup; children = ( 820F1E851A8B88AD00CBC093 /* host */, ); name = Products; sourceTree = ""; }; 820F1E871A8B88AD00CBC093 /* host */ = { isa = PBXGroup; children = ( 820F1E881A8B88AD00CBC093 /* main.m */, 820F1E8F1A8B89B100CBC093 /* NSCommon.h */, 820F1E901A8B89B100CBC093 /* NSCommon.m */, ); path = host; sourceTree = ""; }; /* 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 ================================================ ================================================ FILE: host/host.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: host/host.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/host.xcscheme ================================================ ================================================ FILE: host/host.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState host.xcscheme orderHint 0 SuppressBuildableAutocreation 820F1E841A8B88AD00CBC093 primary ================================================ FILE: mdserver/mdserver/AppDelegate.h ================================================ // // AppDelegate.h // mdserver // // Created by midoks on 15/1/22. // Copyright (c) 2015年 midoks. All rights reserved. // #import #import "NSCommon.h" @interface AppDelegate : NSObject { NSStatusItem *statusBarItem; IBOutlet NSMenu *statusBarItemMenu; IBOutlet NSMenuItem *phpVer; IBOutlet NSMenuItem *mysqlVer; IBOutlet NSMenuItem *cmd; // NSMutableArray *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 #import #import #include #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_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= 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 ================================================ ================================================ FILE: mdserver/mdserver/Base.lproj/mdserver Help/index.html ================================================ mdserver Help

Demo

================================================ FILE: mdserver/mdserver/Controller/GeneralController.h ================================================ // // GeneralController.h // mdserver // // Created by midoks on 15/2/6. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import #import @interface GeneralController : NSObject { IBOutlet NSPathControl *_nginxLogPath; IBOutlet NSTextField *HttpPort; IBOutlet NSTextField *MysqlPort; //IBOutlet IBOutlet NSButton *isSystemStartAfterStart; IBOutlet NSButton *isOpenAfterStart; IBOutlet NSButton *isExitAfterCloseAll; IBOutlet NSButton *isStartAfterFlushLog; } #pragma mark 设置端口 -(IBAction)setCommonPort:(id)sender; -(IBAction)setSpecialPort:(id)sender; #pragma mark 系统后启动本软件 -(IBAction)isSystemStartAfterStart:(id)sender; #pragma mark 打开本软件时启动服务 -(IBAction)isOpenAfterStart:(id)sender; #pragma mark 退出后停止所有程序 -(IBAction)isExitAfterCloseAll:(id)sender; #pragma mark 启动后刷新日志 -(IBAction)isStartAfterFlushLog:(id)sender; @end ================================================ FILE: mdserver/mdserver/Controller/GeneralController.m ================================================ // // GeneralController.m // mdserver // // Created by midoks on 15/2/6. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import "GeneralController.h" #import "NSCommon.h" @implementation GeneralController -(id)init { // NSLog(@"GeneralController"); self = [super init]; return self; } -(void)awakeFromNib { //初始化的数据 NSString *str = [NSCommon getRootDir]; str = [NSString stringWithFormat:@"file://%@bin/openresty/nginx/logs/error.log", str]; [_nginxLogPath setURL:[NSURL URLWithString:str]]; NSString *httpPort = [NSCommon getCommonConfig:@"HttpPort"]; NSString *mysqlPort = [NSCommon getCommonConfig:@"MysqlPort"]; if (httpPort != nil) { [HttpPort setStringValue:httpPort]; }else{ [NSCommon setCommonConfig:@"HttpPort" value:[HttpPort stringValue]]; } if (mysqlPort != nil) { [MysqlPort setStringValue:mysqlPort]; }else{ [NSCommon setCommonConfig:@"MysqlPort" value:[MysqlPort stringValue]]; } NSString *s_SystemStartAfterStart = [NSCommon getCommonConfig:@"isSystemStartAfterStart"]; if (s_SystemStartAfterStart == nil) { [NSCommon setCommonConfig:@"isSystemStartAfterStart" value:@"0"]; [isSystemStartAfterStart setIntValue:0]; }else{ [isSystemStartAfterStart setIntValue:s_SystemStartAfterStart.intValue]; } NSString *s_OpenAfterStart = [NSCommon getCommonConfig:@"isOpenAfterStart"]; if (s_OpenAfterStart == nil) { [NSCommon setCommonConfig:@"isOpenAfterStart" value:@"0"]; [isOpenAfterStart setIntValue:0]; }else{ [isOpenAfterStart setIntValue:s_OpenAfterStart.intValue]; } NSString *s_ExitAfterCloseAll = [NSCommon getCommonConfig:@"isExitAfterCloseAll"]; if (s_ExitAfterCloseAll == nil) { [NSCommon setCommonConfig:@"isExitAfterCloseAll" value:@"0"]; [isExitAfterCloseAll setIntValue:0]; }else{ [isExitAfterCloseAll setIntValue:s_ExitAfterCloseAll.intValue]; } NSString *s_StartAfterFlushLog = [NSCommon getCommonConfig:@"isStartAfterFlushLog"]; if (s_StartAfterFlushLog == nil) { [NSCommon setCommonConfig:@"isStartAfterFlushLog" value:@"0"]; [isStartAfterFlushLog setIntValue:0]; }else{ [isStartAfterFlushLog setIntValue:s_StartAfterFlushLog.intValue]; } } -(IBAction)goNginxErrorLog:(id)sender { NSString *logPath = [[_nginxLogPath URL] path]; if (logPath.length == 0) { // Fallback: use absoluteString minus scheme if path is unavailable NSString *abs = [[_nginxLogPath URL] absoluteString]; logPath = [abs stringByReplacingOccurrencesOfString:@"file://" withString:@""]; } NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:@[logPath]]; [task waitUntilExit]; } -(void)setHttpPort:(NSString *)httpPort mysqlPort:(NSString *)mysqlPort { [HttpPort setStringValue:httpPort]; [MysqlPort setStringValue:mysqlPort]; [NSCommon setCommonConfig:@"HttpPort" value:httpPort]; [NSCommon setCommonConfig:@"MysqlPort" value:mysqlPort]; } -(IBAction)setCommonPort:(id)sender { NSString *httpPort = @"8000"; NSString *mysqlPort = @"3306"; [self setHttpPort:httpPort mysqlPort:mysqlPort]; } -(IBAction)setSpecialPort:(id)sender { NSString *httpPort = @"8888"; NSString *mysqlPort = @"3306"; [self setHttpPort:httpPort mysqlPort:mysqlPort]; } #pragma mark 系统后启动本软件 -(IBAction)isSystemStartAfterStart:(id)sender { NSString *i = [NSString stringWithFormat:@"%d", isSystemStartAfterStart.intValue]; [NSCommon setCommonConfig:@"isSystemStartAfterStart" value:i]; } #pragma mark 打开本软件时启动服务 -(IBAction)isOpenAfterStart:(id)sender { NSString *i = [NSString stringWithFormat:@"%d", isOpenAfterStart.intValue]; [NSCommon setCommonConfig:@"isOpenAfterStart" value:i]; } #pragma mark 退出后停止所有程序 -(IBAction)isExitAfterCloseAll:(id)sender { NSString *i = [NSString stringWithFormat:@"%d", isExitAfterCloseAll.intValue]; [NSCommon setCommonConfig:@"isExitAfterCloseAll" value:i]; } #pragma mark 启动后刷新日志 -(IBAction)isStartAfterFlushLog:(id)sender { NSString *i = [NSString stringWithFormat:@"%d", isStartAfterFlushLog.intValue]; [NSCommon setCommonConfig:@"isStartAfterFlushLog" value:i]; } @end ================================================ FILE: mdserver/mdserver/Controller/HostNameController.h ================================================ // // HostNameController.h // mdserver // // Created by midoks on 15/2/2. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import #import @interface HostNameController : NSDocument { IBOutlet NSTableView *_tableView; IBOutlet NSPathControl *_serverPath; IBOutlet NSTextField *_serverName; IBOutlet NSTextField *_serverPort; IBOutlet NSPopUpButton *_serverPHPVer; IBOutlet NSTextField *_gPort; IBOutlet NSImageView *_emptyPath; NSMutableArray *_list; NSMutableArray *_phplist; IBOutlet NSTextField *pStartTitle; IBOutlet NSWindow *window; } - (IBAction)goWebSite:(id)sender; - (IBAction)goWebInfo:(id)sender; @end ================================================ FILE: mdserver/mdserver/Controller/HostNameController.m ================================================ // // HostNameController.m // mdserver // // Created by midoks on 15/2/2. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import "HostNameController.h" #import "HostNameModel.h" #import "NSCommon.h" @interface HostNameController() @end @implementation HostNameController - (id)init { // NSLog(@"HostNameController"); if (self = [super init]) { [_tableView setGridColor:[NSColor blackColor]]; [_tableView setRowSizeStyle:NSTableViewRowSizeStyleLarge]; [_tableView setGridStyleMask:(NSTableViewSolidHorizontalGridLineMask | NSTableViewSolidVerticalGridLineMask)]; [[_tableView cell] setLineBreakMode:NSLineBreakByTruncatingTail]; [[_tableView cell] setTruncatesLastVisibleLine:YES]; [_tableView setColumnAutoresizingStyle:NSTableViewSequentialColumnAutoresizingStyle]; [_tableView setUsesAlternatingRowBackgroundColors:NO]; [_tableView.headerView setHidden:YES];//使用隐藏的效果会出现表头的高度 _tableView.delegate = self; _tableView.dataSource = self; //plist操作 [self reloadListData]; _phplist = [NSMutableArray array]; NSFileManager *fm = [NSFileManager defaultManager]; NSString *rootDir = [NSCommon getRootDir]; NSString *phpDir = [NSString stringWithFormat:@"%@bin/php", rootDir]; NSArray *phpVlist = [fm contentsOfDirectoryAtPath:phpDir error:NULL]; for (NSString *f in phpVlist) { NSString *path =[NSString stringWithFormat:@"%@/%@", phpDir,f]; BOOL isDir; [fm fileExistsAtPath:path isDirectory:&isDir]; if (!isDir){ continue; } NSString *v = [f stringByReplacingOccurrencesOfString:@"php" withString:@""]; [_phplist addObject:v]; } [_phplist sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { if ([obj1 intValue]>[obj2 intValue]){ return YES; } return NO; }]; } return self; } -(void)awakeFromNib { //默认路径为空 //[_serverPath setURL:[NSURL URLWithString:@"file://"]]; [NSCommon delayedRun:0.5 callback:^{ static BOOL reload = YES; if (reload) {//默认选择 if ([self->_list count] > 0) { [self->_tableView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:0] byExtendingSelection:YES]; } reload = NO; } }]; } - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { return [_list count]; } -(NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { HostNameModel *hnm = [_list objectAtIndex:row]; NSTableCellView *cell = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self]; [cell.textField setStringValue:[hnm valueForKey:tableColumn.identifier]]; [cell.textField setEditable:NO]; [cell.textField setDrawsBackground:NO]; return cell; } - (NSDragOperation)tableView:(NSTableView *)tableView validateDrop:(id)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)dropOperation { if (dropOperation == NSTableViewDropAbove) { return NSDragOperationNone; } return NSDragOperationMove; } #pragma mark 点击选择框 - (void)tableViewSelectionDidChange:(NSNotification *)notification { [_serverPHPVer removeAllItems]; for (NSString *i in _phplist) { [_serverPHPVer addItemWithTitle:i]; } [_serverPHPVer setTarget:self]; [_serverPHPVer setAction:@selector(handlePopBtn:)]; NSInteger row = [_tableView selectedRow]; if (row > -1) { NSMutableDictionary *serverinfo = [_list objectAtIndex:row]; [_serverName setStringValue:[serverinfo objectForKey:@"hostname"]]; [_serverPort setStringValue:[serverinfo objectForKey:@"port"]]; [_serverPHPVer setStringValue:[serverinfo objectForKey:@"php"]]; NSString *php = [serverinfo objectForKey:@"php"]; NSInteger cphp = [_phplist indexOfObject:php]; if (cphp > -1){ [_serverPHPVer selectItemAtIndex:cphp]; } if ([[serverinfo objectForKey:@"hostname"] isEqual:@"localhost"] && [[serverinfo objectForKey:@"port"] isEqual:@"8888"]) { _serverName.enabled = NO; _serverPort.enabled = NO; _serverPHPVer.enabled = NO; }else{ _serverName.enabled = YES; _serverPort.enabled = YES; _serverPHPVer.enabled = YES; } NSString * path = [serverinfo objectForKey:@"path"]; if ([path isEqual:@""]) { _emptyPath.hidden = NO; [_serverPath setURL:[NSURL URLWithString:@"file://"]]; }else{ NSString *urlstr = [NSString stringWithFormat:@"file://%@", path]; [_serverPath setURL:[NSURL URLWithString:urlstr]]; _emptyPath.hidden = YES; } [NSCommon setCommonConfig:@"selectPhpVer" value:[serverinfo objectForKey:@"php"]]; } } #pragma mark - NSTextFieldDelegate - #pragma mark - IBACTION - #pragma mark 添加功能 -(IBAction)add:(id)sender { NSString *hostname = [NSString stringWithFormat:@"host-%ld", [_list count]+1]; NSString *port = _gPort.stringValue; NSString *php = @"71"; [_serverName setStringValue:hostname]; [_serverPort setStringValue:port]; [_serverPHPVer setStringValue:php]; [_list addObject:[[HostNameModel alloc] setWithHost:hostname port:port path:@"" php:php]]; [_tableView reloadData]; [_tableView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:[_list count]-1] byExtendingSelection:YES]; } #pragma mark 删除功能 -(IBAction)remove:(id)sender { NSInteger row = [_tableView selectedRow]; if (row!=-1) { NSMutableDictionary *serverinfo = [_list objectAtIndex:row]; if ([[serverinfo objectForKey:@"hostname"] isEqual:@"localhost"] && [[serverinfo objectForKey:@"port"] isEqual:@"8888"]) { return; } if ([[serverinfo objectForKey:@"path"] isNotEqualTo:@""]) { NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:@"删除设置"]; [alert setInformativeText:@"你是否确认删除有设置路径的配置"]; [alert addButtonWithTitle:@"确定"]; [alert addButtonWithTitle:@"取消"]; [alert setAlertStyle:NSAlertStyleInformational]; NSModalResponse r = [alert runModal]; if (r != 1000) { return; } } [_list removeObjectAtIndex:row]; //保存配置 [self save:sender]; [_tableView reloadData]; [_tableView deselectAll:sender]; [_tableView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:[_list count] - 1] byExtendingSelection:YES]; }else{ NSLog(@"没有选择!!!"); [_tableView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:[_list count] - 1] byExtendingSelection:YES]; } } -(IBAction)openConfigDir:(id)sender{ NSString *dir = [[NSCommon appSupportDirURL] path]; [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:dir, nil]] waitUntilExit]; } -(void)reloadListData { _list = [[NSMutableArray alloc] init]; NSString *str = [NSCommon getRootDir]; NSString *pathplist = [NSCommon getServerPlist]; // NSString *pathplist = [[NSBundle mainBundle] pathForResource:@"server" ofType:@"plist"]; NSMutableDictionary *listContent = [[NSMutableDictionary alloc] initWithContentsOfFile:pathplist]; for (NSInteger i=0; i<[listContent count]; i++) { NSString *pos = [NSString stringWithFormat:@"%ld", i]; NSMutableDictionary *t = [listContent objectForKey:pos]; if ([[t objectForKey:@"hostname"] isEqual:@"localhost"] && [[t objectForKey:@"port"] isEqual:@"8888"] ) { NSString *urlstr = [NSString stringWithFormat:@"%@htdocs/www/", str]; [[listContent objectForKey:pos] setObject:urlstr forKey:@"path"]; [[listContent objectForKey:pos] setObject:@"71" forKey:@"php"]; } if (![[listContent objectForKey:pos] objectForKey:@"php"]){ [[listContent objectForKey:pos] setObject:@"71" forKey:@"php"]; } [_list addObject:t]; } [_tableView reloadData]; } #pragma mark 恢复功能 -(IBAction)revert:(id)sender { [self reloadListData]; //默认选择 if ([_list count] > 0) { [_tableView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:0] byExtendingSelection:YES]; } } #pragma mark 保存功能 -(IBAction)save:(id)sender { // NSString *pathplist = [[NSBundle mainBundle] pathForResource:@"server" ofType:@"plist"]; NSString *pathplist = [NSCommon getServerPlist]; NSMutableDictionary *dictplist = [NSMutableDictionary dictionary]; NSUInteger c = 0; for (NSDictionary *i in _list) { NSMutableDictionary *serverinfo = [NSMutableDictionary dictionary]; [serverinfo setObject:[i objectForKey:@"hostname"] forKey:@"hostname"]; [serverinfo setObject:[i objectForKey:@"port"] forKey:@"port"]; [serverinfo setObject:[i objectForKey:@"path"] forKey:@"path"]; [serverinfo setObject:[i objectForKey:@"php"] forKey:@"php"]; [dictplist setObject:serverinfo forKey:[NSString stringWithFormat:@"%ld", c]]; ++c; } NSMutableDictionary *listContent = [[NSMutableDictionary alloc] initWithContentsOfFile:pathplist]; //判断是否改变 BOOL isNotify = false; //数量上判断 if ([listContent count] != [_list count]){ isNotify = true; } NSString *hostname = @""; NSString *port = @""; NSString *path = @""; NSString *php = @""; //内容上判断 if(!isNotify){ for (id key in listContent){ int key_num = [key intValue]; id obj = [listContent objectForKey:key]; hostname = [obj objectForKey:@"hostname"]; port = [obj objectForKey:@"port"]; path = [obj objectForKey:@"path"]; php = [obj objectForKey:@"php"]; if([[[_list objectAtIndex:key_num] objectForKey:@"hostname"] isEqualToString:hostname] && [[[_list objectAtIndex:key_num] objectForKey:@"port"] isEqualToString:port] && [[[_list objectAtIndex:key_num] objectForKey:@"path"] isEqualToString:path] && [[[_list objectAtIndex:key_num] objectForKey:@"php"] isEqualToString:php]){ } else { isNotify = true; } } } [dictplist writeToFile:pathplist atomically:YES]; //改变后,重新启动,发送通知 if (isNotify){ NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:@""]; [alert setInformativeText:@"你是否重新启动服务?"]; [alert addButtonWithTitle:@"确定"]; [alert addButtonWithTitle:@"取消"]; [alert setAlertStyle:NSAlertStyleInformational]; NSModalResponse r = [alert runModal]; if (1001 == r) { return; } NSString *changeAfterPhpVer =[NSCommon getCommonConfig:@"selectPhpVer"]; NSFileManager *fm = [NSFileManager defaultManager]; NSString *path = [NSString stringWithFormat:@"/tmp/php%@-cgi.sock", changeAfterPhpVer]; if(![fm fileExistsAtPath:path]){ NSString *rootDir = [NSCommon getRootDir]; [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"%@bin/php/status.sh %@ start", rootDir, changeAfterPhpVer], nil]] waitUntilExit]; NSDictionary *dict =[[NSDictionary alloc] initWithObjectsAndKeys:changeAfterPhpVer,@"ver", nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"startPhpVerInChange" object:nil userInfo:dict]; } [[NSNotificationCenter defaultCenter] postNotificationName:@"reloadSVC" object:nil]; } } #pragma mark 选择文件 -(IBAction)selectedDIr:(id)sender { NSOpenPanel *panel = [NSOpenPanel openPanel]; [panel setPrompt: @"choose"]; [panel setCanChooseDirectories:YES]; //可以打开目录 [panel setCanChooseFiles:NO]; //不能选择文件 [panel beginSheetModalForWindow:[self windowForSheet] completionHandler:^(NSInteger result) { [self->_serverPath setURL:[panel URL]]; [self->_emptyPath setHidden:YES]; NSInteger row = [self->_tableView selectedRow]; if (row > -1) { NSString *path = [[[panel URL] absoluteString] stringByReplacingOccurrencesOfString:@"file://" withString:@""]; [[self->_list objectAtIndex:row] setObject:path forKey:@"path"]; [self save:sender]; } }]; } - (IBAction)openDir:(id)sender { NSURL *pathstring = [_serverPath URL]; NSString *dir = [[pathstring absoluteString] stringByReplacingOccurrencesOfString:@"file://" withString:@""]; if (![dir isEqual:@""]) { [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:dir, nil]] waitUntilExit]; } } #pragma mark NSPathControlDelegate - (IBAction)openCellDir:(id)sender { NSPathControlItem *clickedItem = _serverPath.clickedPathItem; NSURL *pathURL = clickedItem.URL; NSString *dir = pathURL.path; if (dir.length == 0) { dir = [[pathURL absoluteString] stringByReplacingOccurrencesOfString:@"file://" withString:@""]; } if (dir.length > 0) { [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:@[dir]] waitUntilExit]; } } -(IBAction)changeServerName:(id)sender { NSInteger row = [_tableView selectedRow]; if (row != -1) { NSString *hostname = [_serverName stringValue]; NSString *port = [_serverPort stringValue]; if([hostname isEqualToString:@"localhost"] && [port isEqualToString:@"8888"]){ [_serverName setStringValue:@"youdomain.midoks"]; [NSCommon alert:@"localhost:8888是默认地址,不可使用!"]; } [[_list objectAtIndex:row] setObject:[_serverName stringValue] forKey:@"hostname"]; [_tableView reloadData]; [_tableView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:row] byExtendingSelection:YES]; if ([[[_list objectAtIndex:row] objectForKey:@"path"] isNotEqualTo:@""]) { [self save:sender]; } } // NSLog(@"changeServerName"); } -(IBAction)changeServerPort:(id)sender { NSInteger row = [_tableView selectedRow]; if (row != -1) { NSInteger port = [_serverPort integerValue]; if (port == 8888){ NSString *hostname = [_serverName stringValue]; if([hostname isEqualToString:@"localhost"]){ port = 8000; [_serverPort setStringValue:@"8000"]; [NSCommon alert:@"localhost:8888是默认地址,不可使用!"]; } } // NSLog(@"changeServerPort"); //默认0-1023是系统默认的端口,需要root权限才能开启。 if (port < 80) { port = 80; } else if (port > 65534){ port = 65534; } NSString *portstr = [NSString stringWithFormat:@"%ld", port]; [[_list objectAtIndex:row] setObject:portstr forKey:@"port"]; [_tableView reloadData]; [_tableView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:row] byExtendingSelection:YES]; if ([[[_list objectAtIndex:row] objectForKey:@"path"] isNotEqualTo:@""]) { [self save:sender]; } } } -(void)handlePopBtn:(NSPopUpButton *)popBtn { popBtn.title = popBtn.selectedItem.title; NSInteger row = [_tableView selectedRow]; if (row != -1) { [[_list objectAtIndex:row] setObject:popBtn.title forKey:@"php"]; [_tableView reloadData]; [_tableView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:row] byExtendingSelection:YES]; if ([[[_list objectAtIndex:row] objectForKey:@"path"] isNotEqualTo:@""]) { [self save:popBtn]; } } } - (IBAction)goWebSite:(id)sender { NSInteger row = [_tableView selectedRow]; if(row>-1){ NSMutableDictionary *rowdata = [_list objectAtIndex:row]; NSString *gourl = [NSString stringWithFormat:@"http://%@:%@", [rowdata objectForKey:@"hostname"], [rowdata objectForKey:@"port"]]; [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:gourl]]; //NSLog(@"%ld", row); //[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://localhost:8888/"]]; } } - (IBAction)goWebInfo:(id)sender { NSInteger row = [_tableView selectedRow]; NSString *title = [pStartTitle stringValue]; if((row>-1) && ([title isEqual:@"stop"])){ NSMutableDictionary *rowdata = [_list objectAtIndex:row]; NSString *hostname = [rowdata objectForKey:@"hostname"]; NSString *port = [rowdata objectForKey:@"port"]; NSString *path = [rowdata objectForKey:@"path"]; path = [path stringByReplacingOccurrencesOfString:@"file://" withString:@""]; NSString *gourl = [NSString stringWithFormat:@"http://%@:%@", hostname, port]; long r = random(); gourl = [NSString stringWithFormat:@"%@/tmp_%ld.php", gourl, r]; path = [NSString stringWithFormat:@"%@tmp_%ld.php", path, r]; [NSCommon makePhpInfo:path]; [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:gourl]]; [NSCommon delayedRun:5.0 callback:^{ NSFileManager *fm = [NSFileManager defaultManager]; [fm removeItemAtPath:path error:nil]; }]; } } @end ================================================ FILE: mdserver/mdserver/Controller/ModMySQLPwdController.h ================================================ // // ModMySQLPwdController.h // mdserver // // Created by midoks on 15/2/13. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import #import @interface ModMySQLPwdController : NSWindowController { IBOutlet NSSecureTextField *mysqlPwd; IBOutlet NSSecureTextField *mysqlRePwd; } - (IBAction)exitMySQLPwd:(id)sender; - (IBAction)updateMySQLPwd:(id)sender; @end ================================================ FILE: mdserver/mdserver/Controller/ModMySQLPwdController.m ================================================ // // ModMySQLPwdController.m // mdserver // // Created by midoks on 15/2/13. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import "ModMySQLPwdController.h" #import "NSCommon.h" #import @implementation ModMySQLPwdController - (id)initWithWindow:(NSWindow *)window { if (self = [super initWithWindow:window]) { } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:self.window]; return self; } - (void)windowDidLoad { [super windowDidLoad]; } -(void)windowWillClose:(NSNotification *)notification{ [NSCommon setCommonConfig:@"isOpenModMySQLPwdWindow" value:@"no"]; } - (IBAction)exitMySQLPwd:(id)sender { [self.window performClose:sender]; [NSCommon setCommonConfig:@"isOpenModMySQLPwdWindow" value:@"no"]; } - (IBAction)updateMySQLPwd:(id)sender { NSString *root = [NSCommon getRootDir]; NSString *pwd = [mysqlPwd stringValue]; NSString *repwd = [mysqlRePwd stringValue]; NSString *WebServerStatus = [NSCommon getCommonConfig:@"WebServerStatus"]; //NSLog(@"%@", WebServerStatus); if (WebServerStatus && [WebServerStatus isEqual:@"stoped"]) { [NSCommon alert:@"启动MySQL服务后才能修改!!!,Sorry"]; return; } if ([pwd isNotEqualTo:repwd]) { [NSCommon alert:@"两次密码不一致!!!"]; return; } if([pwd isEqual:@""]){ [NSCommon alert:@"不能为空!!!"]; return; } NSString *modMysqlSh = [NSString stringWithFormat:@"%@bin/modMysqlPwd.sh", root]; NSString *modMysqlPwd = [[NSBundle mainBundle] pathForResource:@"modMysqlPwd" ofType:@"sh"];; NSString *modMysqlPwd_content = [NSString stringWithContentsOfFile:modMysqlPwd encoding:NSUTF8StringEncoding error:nil]; NSString *oldpassword = [NSCommon getCommonConfig:@"setMySQLPwd"]; if (!oldpassword) { oldpassword = @"root"; } modMysqlPwd_content = [modMysqlPwd_content stringByReplacingOccurrencesOfString:@"{OLD_PASSWORD}" withString:oldpassword]; modMysqlPwd_content = [modMysqlPwd_content stringByReplacingOccurrencesOfString:@"{NEW_PASSWORD}" withString:pwd]; [modMysqlPwd_content writeToFile:modMysqlSh atomically:YES encoding:NSUTF8StringEncoding error:nil]; NSTask *task = [[NSTask alloc] init]; [task setLaunchPath: @"/bin/sh"]; [task setArguments:[NSArray arrayWithObjects:@"-c", modMysqlSh, nil]]; [task launch]; [task waitUntilExit]; if(task.terminationStatus!=0){ [NSCommon alert:@"修改失败!!!"]; return; } [self.window performClose:sender]; [NSCommon setCommonConfig:@"setMySQLPwd" value:pwd]; [NSCommon setCommonConfig:@"isOpenModMySQLPwdWindow" value:@"no"]; NSString *empty= @"#Don`t Delele This File;"; [empty writeToFile:modMysqlSh atomically:YES encoding:NSUTF8StringEncoding error:nil]; [NSCommon alert:@"修改成功!!!"]; } @end ================================================ FILE: mdserver/mdserver/Controller/MySQLController.h ================================================ // // MySQLController.h // mdserver // // Created by midoks on 15/2/8. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import #import @interface MySQLController : NSWindowController { IBOutlet NSPathControl *_mysqlLogPath; IBOutlet NSButton *isAllowToLinkMysql; IBOutlet NSMatrix *AllowConnectType; IBOutlet NSButtonCell *AllowConnectLocalMysql; IBOutlet NSButtonCell *AllowConnectOtherMysql; IBOutlet NSTextField *pStartTitle; } #pragma mark 是否允许链接Mysql -(IBAction)isAllowToConnectMysql:(id)sender; - (IBAction)AllowConnectLocalMysql:(id)sender; - (IBAction)AllowConnectOtherMysql:(id)sender; #pragma mark - 辅助工具 - -(IBAction)goPhpMysqAdmin:(id)sender; -(IBAction)goSequelPro:(id)sender; #pragma mark - 更改mysql密码 - - (IBAction)modMySQLPwd:(id)sender; @end ================================================ FILE: mdserver/mdserver/Controller/MySQLController.m ================================================ // // MySQLController.m // mdserver // // Created by midoks on 15/2/8. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import "MySQLController.h" #import "NSCommon.h" #import "ModMySQLPwdController.h" @interface MySQLController() { ModMySQLPwdController *myp; } @end @implementation MySQLController -(id)init { if (self = [super init]) { } return self; } -(void)awakeFromNib { // NSLog(@"MySQLController"); NSString *str = [NSCommon getRootDir]; str = [NSString stringWithFormat:@"file://%@bin/mysql/mysql80/data", str]; [_mysqlLogPath setURL:[NSURL URLWithString:str]]; if (isAllowToLinkMysql.intValue == 0) { AllowConnectType.enabled = NO; [NSCommon setCommonConfig:@"isAllowToConnectMysql" value:@"0"]; }else{ AllowConnectType.enabled = YES; [NSCommon setCommonConfig:@"isAllowToConnectMysql" value:@"1"]; } if (AllowConnectLocalMysql.intValue == 1) { [NSCommon setCommonConfig:@"AllowConnectLocalMysql" value:@"1"]; [NSCommon setCommonConfig:@"AllowConnectOtherMysql" value:@"0"]; }else{ [NSCommon setCommonConfig:@"AllowConnectLocalMysql" value:@"0"]; [NSCommon setCommonConfig:@"AllowConnectOtherMysql" value:@"1"]; } } -(IBAction)isAllowToConnectMysql:(id)sender { if (isAllowToLinkMysql.intValue == 0) { AllowConnectType.enabled = NO; [NSCommon setCommonConfig:@"isAllowToConnectMysql" value:@"0"]; }else{ AllowConnectType.enabled = YES; [NSCommon setCommonConfig:@"isAllowToConnectMysql" value:@"1"]; } } - (IBAction)AllowConnectLocalMysql:(id)sender { [NSCommon setCommonConfig:@"AllowConnectLocalMysql" value:@"1"]; [NSCommon setCommonConfig:@"AllowConnectOtherMysql" value:@"0"]; } - (IBAction)AllowConnectOtherMysql:(id)sender { //NSLog(@"AllowConnectLocalMysql:%d", AllowConnectLocalMysql.isHighlighted); [NSCommon setCommonConfig:@"AllowConnectLocalMysql" value:@"0"]; [NSCommon setCommonConfig:@"AllowConnectOtherMysql" value:@"1"]; } #pragma mark 跳到mysql日志 -(IBAction)goMysqlLogPath:(id)sender { NSString *logDir = [[_mysqlLogPath URL] path]; if (logDir.length == 0) { NSString *abs = [[_mysqlLogPath URL] absoluteString]; logDir = [abs stringByReplacingOccurrencesOfString:@"file://" withString:@""]; } [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:@[logDir]] waitUntilExit]; } #pragma mark - 辅助工具 - -(IBAction)goPhpMysqAdmin:(id)sender { NSString *title = [pStartTitle stringValue]; if ([title isEqual:@"stop"]) { [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://localhost:8888/phpMyAdmin"]]; }else{ [NSCommon alert:@"web服务未启动"]; } } -(IBAction)goSequelPro:(id)sender { NSString *str = [NSCommon getRootDir]; str = [NSString stringWithFormat:@"%@bin/Sequel Pro.app", str]; [[NSTask launchedTaskWithLaunchPath:@"/usr/bin/open" arguments:[NSArray arrayWithObjects:str, nil]] waitUntilExit]; } #pragma mark - MySQL密码修改 - - (IBAction)modMySQLPwd:(id)sender { NSString *status = [NSCommon getCommonConfig:@"isOpenModMySQLPwdWindow"]; if(status) { if ([status isNotEqualTo:@"yes"]) { myp = [[ModMySQLPwdController alloc] initWithWindowNibName:@"ModMySQLPwd"]; [NSCommon setCommonConfig:@"isOpenModMySQLPwdWindow" value:@"yes"]; } }else{ myp = [[ModMySQLPwdController alloc] initWithWindowNibName:@"ModMySQLPwd"]; [NSCommon setCommonConfig:@"isOpenModMySQLPwdWindow" value:@"yes"]; } [myp loadWindow]; [myp.window makeMainWindow]; [myp.window makeKeyAndOrderFront:sender]; [myp.window center]; // NSLog(@"b:%@", myp); // [NSApp beginSheet:[myp window] // modalForWindow:[NSApp mainWindow] // modalDelegate:self // didEndSelector:nil // contextInfo:nil]; // [myp.window center]; // NSLog(@"e:%@", myp); // [NSApp beginSheet:[myp window] completionHandler:^(NSModalResponse returnCode) { // NSLog(@"%ld", returnCode); // }]; } @end ================================================ FILE: mdserver/mdserver/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "mac", "size" : "16x16", "scale" : "1x" }, { "idiom" : "mac", "size" : "16x16", "scale" : "2x" }, { "idiom" : "mac", "size" : "32x32", "scale" : "1x" }, { "idiom" : "mac", "size" : "32x32", "scale" : "2x" }, { "idiom" : "mac", "size" : "128x128", "scale" : "1x" }, { "idiom" : "mac", "size" : "128x128", "scale" : "2x" }, { "idiom" : "mac", "size" : "256x256", "scale" : "1x" }, { "idiom" : "mac", "size" : "256x256", "scale" : "2x" }, { "idiom" : "mac", "size" : "512x512", "scale" : "1x" }, { "idiom" : "mac", "size" : "512x512", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: mdserver/mdserver/Images.xcassets/Contents.json ================================================ { "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: mdserver/mdserver/Info.plist ================================================ CFBundleDevelopmentRegion zh_CN CFBundleExecutable $(EXECUTABLE_NAME) CFBundleHelpBookFolder mdserver Help CFBundleHelpBookName index CFBundleIconFile Icon.icns CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString $(MARKETING_VERSION) CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright Copyright © 2015年 midoks. All rights reserved. NSMainNibFile MainMenu NSPrincipalClass NSApplication ================================================ FILE: mdserver/mdserver/MainAlipay.xib ================================================ ================================================ FILE: mdserver/mdserver/MainWeibo.xib ================================================ ================================================ FILE: mdserver/mdserver/ModMySQLPwd.xib ================================================ NSAllRomanInputSourcesLocaleIdentifier NSAllRomanInputSourcesLocaleIdentifier ================================================ FILE: mdserver/mdserver/Model/HostNameModel.h ================================================ // // HostNameModel.h // mdserver // // Created by midoks on 15/2/2. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import @interface HostNameModel : NSObject @property (nonatomic, strong) NSString *hostname; @property (nonatomic, strong) NSString *port; @property (nonatomic, strong) NSString *path; @property (nonatomic, strong) NSString *php; #pragma mark 初始化值 - (id)initWithHost:(NSString *)host port:(NSString *)port path:(NSString *)path php:(NSString *)php; -(NSMutableDictionary *)setWithHost:(NSString *)host port:(NSString *)port path:(NSString *)path php:(NSString *)php; @end ================================================ FILE: mdserver/mdserver/Model/HostNameModel.m ================================================ // // HostNameModel.m // mdserver // // Created by midoks on 15/2/2. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import "HostNameModel.h" @implementation HostNameModel -(id)init { if (self = [super init]) { _hostname = @"localhost"; _port = @"8888"; _path = @""; _php = @"56"; } return self; } #pragma mark 初始化值 -(id)initWithHost:(NSString *)host port:(NSString *)port path:(NSString *)path php:(NSString *)php { // NSMutableDictionary *serverinfo = [[NSMutableDictionary alloc] init]; // [serverinfo setObject:host forKey:@"hostname"]; // [serverinfo setObject:port forKey:@"port"]; // [serverinfo setObject:path forKey:@"path"]; _hostname = host; _port = port; _path = path; _php = php; return self; } -(NSMutableDictionary *)setWithHost:(NSString *)host port:(NSString *)port path:(NSString *)path php:(NSString *)php { NSMutableDictionary *serverinfo = [[NSMutableDictionary alloc] init]; [serverinfo setObject:host forKey:@"hostname"]; [serverinfo setObject:port forKey:@"port"]; [serverinfo setObject:path forKey:@"path"]; [serverinfo setObject:php forKey:@"php"]; return serverinfo; } @end ================================================ FILE: mdserver/mdserver/NSCommon.h ================================================ // // NSCommon.h // mdserver // // Created by midoks on 15/1/26. // Copyright (c) 2015年 midoks.cachecha.com. All rights reserved. // #import #import #include @interface NSCommon : NSObject #pragma mark - 弹出提示 - +(void)alert:(NSString *)content; +(void)alert:(NSString *)content delayedClose:(float)t; #pragma mark 延迟回调 +(void)delayedRun:(float)t callback:(void(^)(void)) callback; #pragma mark 只执行一次方法 +(void)runOneTime:(NSString *)sign run:(void(^)(void))run; #pragma mark 判断文件是否存在 +(BOOL)fileIsExists:(NSString *)absPathFile; #pragma mark 打开文件 +(void)openFile:(NSString *)file; #pragma mark 获取进程执行结构 +(void)getProcessReturn:(NSString *)pathsh; #pragma mark 获取运行根目录 + (NSString *)getRootDir; #pragma mark 获取app目录 +(NSString *)getAppDir; + (NSString *)getSupportDir; #pragma mark HostCofig +(BOOL)saveNginxConfig; +(BOOL)setRemoveAllConfig; +(BOOL)setConfigWithServerName:(NSString *)serverName port:(NSString *)port path:(NSString *)path php:(NSString *)php; +(NSString *)getHostFileNeedContent; +(NSString *)setHostFileNotNeedContent:(NSString *)content; #pragma mark LogFlush +(BOOL)setFlushLog:(NSString *)path; #pragma mark 全局设置 +(BOOL)setCommonConfig:(NSString *)name value:(id)value; +(id)getCommonConfig:(NSString *)name; #pragma mark 创建info文件 +(BOOL)makePhpInfo:(NSString *)path; #pragma mark - 获取App支持的目录,不存在就自动创建 +(NSURL *)appSupportDirURL; +(NSString*)getServerPlist; +(NSMutableArray *)getAllPhpVer; @end ================================================ FILE: mdserver/mdserver/NSCommon.m ================================================ // // NSCommon.m // mdserver // // Created by midoks on 15/1/26. // Copyright (c) 2015年 midoks All rights reserved. // #import "NSCommon.h" @interface NSCommon() @end @implementation NSCommon #pragma mark - 弹出提示 - +(void)alert:(NSString *)content { NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:@"提示"]; [alert setInformativeText:content]; [alert setAlertStyle:NSAlertStyleInformational]; [alert runModal]; } +(void)alert:(NSString *)content delayedClose:(float)t { NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:@"提示"]; [alert setInformativeText:content]; [alert setAlertStyle:NSAlertStyleInformational]; [alert runModal]; //[alert cl]; [self delayedRun:t callback:^{ [alert.window close]; }]; } #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)runOneTime:(NSString *)sign run:(void(^)(void))run { static NSMutableSet *executedSigns = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ executedSigns = [NSMutableSet set]; }); if (![executedSigns containsObject:sign]) { run(); [executedSigns addObject:sign]; } NSLog(@"Executed signs: %@", executedSigns); } #pragma mark 判断文件是否存在 +(BOOL)fileIsExists:(NSString *)absPathFile { NSFileManager *fm = [NSFileManager defaultManager]; return [fm fileExistsAtPath:absPathFile]; } #pragma mark 打开文件 +(void)openFile:(NSString *)file { NSTask *task = [[NSTask alloc] init]; task.launchPath = @"/usr/bin/open"; task.arguments = @[file]; [task launch]; } #pragma mark 获取进程执行结构 +(void)getProcessReturn:(NSString *)pathsh { NSTask *task = [[NSTask alloc] init]; task.launchPath = @"/bin/sh"; task.arguments = @[@"-c", pathsh]; 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 output: %@", string); NSLog(@"Exit status: %d", task.terminationStatus); } #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 获取app目录 +(NSString *)getAppDir { char path[1024]; unsigned size = 1024; _NSGetExecutablePath(path, &size); path[size] = '\0'; NSString *str = [NSString stringWithFormat:@"%s", path]; str = [NSString stringWithFormat:@"%@", str]; str = [self getDirName:str]; str = [self getDirName:str]; str = [self getDirName:str]; str = [NSString stringWithFormat:@"%@/", str]; return str; } #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 = [self getDirName:str]; // str = [self getDirName:str]; // str = [self getDirName:str]; // // str = [NSString stringWithFormat:@"%@/mdserver/", str]; // NSLog(@"debug:%@", str); // return str; // /Users/midoks/Library/Developer/Xcode/DerivedData NSString *root_path = [NSString stringWithFormat:@"/Applications/mdserver/%@", @""]; return root_path; } +(NSString *)getBundleName{ NSDictionary *dir = [[NSBundle mainBundle] infoDictionary]; return [dir objectForKey:@"CFBundleName"]; } + (NSString *)getSupportDir { // NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); // NSString *appSupportDirectory = [paths objectAtIndex:0]; // appSupportDirectory = [appSupportDirectory stringByAppendingFormat:@"/%@",@"mdserver"]; // return appSupportDirectory; return @"/Library/Application\\ Support/mdserver"; } +(BOOL)saveNginxConfig { [NSCommon setRemoveAllConfig]; NSMutableArray *list = [NSMutableArray array]; NSString *pathplist = [NSCommon getServerPlist]; // NSString *pathplist = [[NSBundle mainBundle] pathForResource:@"server" ofType:@"plist"]; NSMutableDictionary *listContent = [NSMutableDictionary dictionaryWithContentsOfFile:pathplist]; for (NSMutableDictionary *k in listContent) { [list addObject:[listContent objectForKey:k]]; } NSString *rootDir = [NSCommon getRootDir]; NSString *vhost = [NSString stringWithFormat:@"%@bin/openresty/nginx/conf/vhost", rootDir]; NSFileManager *fm = [NSFileManager defaultManager]; for (NSMutableDictionary *i in list) { if ([[i objectForKey:@"path"] isEqualToString:@""]){ continue; } if ([[i objectForKey:@"port"] isEqualToString:@"8888"] && [[i objectForKey:@"hostname"] isEqualToString:@"localhost"]) { continue; } //Check if there is a custom configuration NSString *serverName = [[i objectForKey:@"hostname"] stringByReplacingOccurrencesOfString:@"." withString:@"_"]; NSString *own_host = [NSString stringWithFormat:@"%@%@", @"own_", serverName]; NSString *own_conf = [NSString stringWithFormat:@"%@/%@.conf", vhost, own_host]; //NSLog(@"%@",own_conf); if (![fm fileExistsAtPath:own_conf]){ [NSCommon setConfigWithServerName:[i objectForKey:@"hostname"] port:[i objectForKey:@"port"] path:[i objectForKey:@"path"] php:[i objectForKey:@"php"]]; } } return YES; } +(BOOL)setRemoveAllConfig { NSString *str = [NSCommon getRootDir]; NSString *vhost = [NSString stringWithFormat:@"%@bin/openresty/nginx/conf/vhost", str]; NSFileManager *fm = [NSFileManager defaultManager]; NSArray *list = [fm contentsOfDirectoryAtPath:vhost error:nil]; for (NSString *i in list) { if ([i hasSuffix:@"conf"]) { NSString *temp = [i substringToIndex:4]; if ([temp isEqualTo:@"tmp_"]) { NSString *removeFile = [NSString stringWithFormat:@"%@/%@", vhost,i]; [fm removeItemAtPath:removeFile error:nil]; } } } return YES; } +(BOOL)setConfigWithServerName:(NSString *)serverName port:(NSString *)port path:(NSString *)path php:(NSString *)php { NSString *str = [NSCommon getRootDir]; //vhost下配置 NSString *vhost = [NSString stringWithFormat:@"%@bin/openresty/nginx/conf/vhost", str]; NSString *rserverName = [serverName stringByReplacingOccurrencesOfString:@"." withString:@"_"]; NSString *nginx_vhost = [NSString stringWithFormat:@"%@/tmp_%@.conf" , vhost, rserverName]; NSString *template = [NSString stringWithFormat:@"%@/conf.template", vhost]; NSString *content = [NSString stringWithContentsOfFile:template encoding:NSUTF8StringEncoding error:nil]; content = [content stringByReplacingOccurrencesOfString:@"{SERVERNAME}" withString:serverName]; content = [content stringByReplacingOccurrencesOfString:@"{PORT}" withString:port]; content = [content stringByReplacingOccurrencesOfString:@"{PATH}" withString:path]; content = [content stringByReplacingOccurrencesOfString:@"MD:/" withString:str]; content = [content stringByReplacingOccurrencesOfString:@"{VERSION}" withString:php]; return [content writeToFile:nginx_vhost atomically:YES encoding:NSUTF8StringEncoding error:nil]; } #pragma mark - 清空日志 - +(BOOL)setFlushLog:(NSString *)path { NSFileManager *fm = [NSFileManager defaultManager]; if([fm fileExistsAtPath:path]){ NSString *content = @""; [content writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil]; } return NO; } #pragma mark - Host文件操作 - +(NSString *)getHostFileNeedContent{ NSMutableArray *list = [[NSMutableArray alloc] init]; NSString *pathplist = [self getServerPlist]; // NSString *pathplist = [[NSBundle mainBundle] pathForResource:@"server" ofType:@"plist"]; NSMutableDictionary *listContent = [[NSMutableDictionary alloc] initWithContentsOfFile:pathplist]; 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:@"\r\n%@\r\n127.0.0.1\t\t%@\t%@", ret, [i objectForKey:@"hostname"], @"#MDserver Hosts Don`t Remove and Change"]; } } //ret = [NSString stringWithFormat:@"%@\r\n##**MDserver Hosts Don`t Remove **##", ret]; //NSLog(@"%@", ret); return ret; } +(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]]; //NSLog(@"error:%@", error); return content; } #pragma mark 全局设置 +(BOOL)setCommonConfig:(NSString *)key value:(id)value { NSString *commonplist = [[NSBundle mainBundle] pathForResource:@"common" ofType:@"plist"]; NSMutableDictionary *cContent = [[NSMutableDictionary alloc] initWithContentsOfFile:commonplist]; [cContent setValue:value forKey:key]; //NSLog(@"%@", cContent); return [cContent writeToFile:commonplist atomically:YES]; } +(id)getCommonConfig:(NSString *)key{ NSString *commomplist = [[NSBundle mainBundle] pathForResource:@"common" ofType:@"plist"]; NSMutableDictionary *cContent = [[NSMutableDictionary alloc] initWithContentsOfFile:commomplist]; return [cContent objectForKey:key]; } #pragma mark 创建info文件 +(BOOL)makePhpInfo:(NSString *)path{ //NSFileManager *fm = [NSFileManager defaultManager]; NSString *phpinfo = @""; NSError *error; BOOL rok = [phpinfo writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:&error]; if (!rok) { [NSCommon alert:[error domain]]; } return rok; } #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 *asPath = [fm URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; NSString *bundleID = [NSBundle mainBundle].bundleIdentifier; NSURL * appAsUrl = [asPath.firstObject URLByAppendingPathComponent:bundleID]; [self createDirIfNoExist:appAsUrl]; return appAsUrl; } +(NSString*)getServerPlist{ NSFileManager *fm = [NSFileManager defaultManager]; NSURL *dirUrl = [NSCommon appSupportDirURL]; NSURL *writeURL = [dirUrl URLByAppendingPathComponent:@"server.plist"]; if (![fm fileExistsAtPath:[writeURL path]]){ NSString *serverList = [[NSBundle mainBundle] pathForResource:@"server" ofType:@"plist"]; NSString *content = [NSString stringWithContentsOfFile:serverList encoding:NSUTF8StringEncoding error:nil]; [content writeToURL:writeURL atomically:YES encoding:NSUTF8StringEncoding error:nil]; } return [writeURL path]; } +(NSArray *)getAllPhpVer{ NSMutableArray *tmp =[[NSMutableArray alloc] init]; NSMutableDictionary *listContent = [[NSMutableDictionary alloc] initWithContentsOfFile:[self getServerPlist]]; for (id key in listContent){ id obj = [listContent objectForKey:key]; NSString *php = [obj objectForKey:@"php"]; if ([php intValue]>50){ [tmp addObject:php]; } } NSArray *data = [[NSSet setWithArray:tmp] allObjects]; return data; } @end ================================================ FILE: mdserver/mdserver/NSTextField+Copypast.h ================================================ // // NSTextField+Copypast.h // mdserver // // Created by midoks on 2019/4/13. // Copyright © 2019年 midoks.cachecha.com. All rights reserved. // #import @interface NSTextField (Copypast) - (BOOL)performKeyEquivalent:(NSEvent *)event; @end ================================================ FILE: mdserver/mdserver/NSTextField+Copypast.m ================================================ // // NSTextField+Copypast.m // mdserver // // Created by midoks on 2019/4/13. // Copyright © 2019年 midoks.cachecha.com. All rights reserved. // #import "NSTextField+Copypast.h" @implementation NSTextField (Copypast) - (BOOL)performKeyEquivalent:(NSEvent *)event { if (([event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask) == NSEventModifierFlagCommand) { // The command key is the ONLY modifier key being pressed. if ([[event charactersIgnoringModifiers] isEqualToString:@"x"]) { return [NSApp sendAction:@selector(cut:) to:[[self window] firstResponder] from:self]; } else if ([[event charactersIgnoringModifiers] isEqualToString:@"c"]) { return [NSApp sendAction:@selector(copy:) to:[[self window] firstResponder] from:self]; } else if ([[event charactersIgnoringModifiers] isEqualToString:@"v"]) { return [NSApp sendAction:@selector(paste:) to:[[self window] firstResponder] from:self]; } else if ([[event charactersIgnoringModifiers] isEqualToString:@"a"]) { return [NSApp sendAction:@selector(selectAll:) to:[[self window] firstResponder] from:self]; } } return [super performKeyEquivalent:event]; } @end ================================================ FILE: mdserver/mdserver/Resources/install_helper.sh ================================================ #!/bin/sh # install_helper.sh # mdserver-mac cd "$(dirname "${BASH_SOURCE[0]}")" USER=$(who | sed -n "2,1p" |awk '{print $1}') sudo mkdir -p "/Library/Application Support/mdserver/" sudo cp addhost "/Library/Application Support/mdserver/" sudo cp removehost "/Library/Application Support/mdserver/" sudo chown {$USER}:admin "/Library/Application Support/mdserver/addhost" sudo chmod a+rx "/Library/Application Support/mdserver/addhost" sudo chmod +s "/Library/Application Support/mdserver/addhost" sudo chown {$USER}:admin "/Library/Application Support/mdserver/removehost" sudo chmod a+rx "/Library/Application Support/mdserver/removehost" sudo chmod +s "/Library/Application Support/mdserver/removehost" sudo cp script.sh "/Library/Application Support/mdserver/" sudo chown {$USER}:admin "/Library/Application Support/mdserver/script.sh" sudo chmod a+rx "/Library/Application Support/mdserver/script.sh" sudo chmod +s "/Library/Application Support/mdserver/script.sh" echo done ================================================ FILE: mdserver/mdserver/Resources/modMysqlPwd.sh ================================================ #! /bin/sh DIR=$(cd "$(dirname "$0")"; pwd) DIR=$(dirname "$DIR") PATH=$PATH:$DIR/cmd/ #密码修改 $DIR/bin/mysql/bin/mysql -uroot -p{OLD_PASSWORD} < ================================================ FILE: mdserver/mdserver/en.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} ================================================ FILE: mdserver/mdserver/main.m ================================================ // // main.m // mdserver // // Created by midoks on 15/1/22. // Copyright (c) 2015年 midoks. All rights reserved. // #import int main(int argc, const char * argv[]) { return NSApplicationMain(argc, argv); } ================================================ FILE: mdserver/mdserver/server.plist ================================================ 0 hostname localhost path /Applications/mdserver/htdocs/www php 55 port 8888 ================================================ FILE: mdserver/mdserver.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 54; objects = { /* Begin PBXBuildFile section */ 820F1E941A8B90E200CBC093 /* addhost in Resources */ = {isa = PBXBuildFile; fileRef = 820F1E921A8B90E200CBC093 /* addhost */; }; 820F1E951A8B90E200CBC093 /* removehost in Resources */ = {isa = PBXBuildFile; fileRef = 820F1E931A8B90E200CBC093 /* removehost */; }; 820F1EAD1A8C823800CBC093 /* ss in Resources */ = {isa = PBXBuildFile; fileRef = 820F1EAC1A8C823800CBC093 /* ss */; }; 820F1EAF1A8CA74700CBC093 /* st in Resources */ = {isa = PBXBuildFile; fileRef = 820F1EAE1A8CA74700CBC093 /* st */; }; 822279A42261810B00928FB1 /* NSTextField+Copypast.m in Sources */ = {isa = PBXBuildFile; fileRef = 822279A32261810B00928FB1 /* NSTextField+Copypast.m */; }; 82409EEC1A8F448700CE78F9 /* my.cnf in Resources */ = {isa = PBXBuildFile; fileRef = 82409EEB1A8F448700CE78F9 /* my.cnf */; }; 82409EEE1A90451700CE78F9 /* modMysqlPwd.sh in Resources */ = {isa = PBXBuildFile; fileRef = 82409EED1A90451700CE78F9 /* modMysqlPwd.sh */; }; 824EBDD91A8DD6BC0043BFA7 /* ModMySQLPwd.xib in Resources */ = {isa = PBXBuildFile; fileRef = 824EBDD81A8DD6BC0043BFA7 /* ModMySQLPwd.xib */; }; 824EBDDC1A8E1D730043BFA7 /* ModMySQLPwdController.m in Sources */ = {isa = PBXBuildFile; fileRef = 824EBDDB1A8E1D730043BFA7 /* ModMySQLPwdController.m */; }; 8255B51D1E7ECEC20068D35F /* restart.png in Resources */ = {isa = PBXBuildFile; fileRef = 8255B51B1E7ECEC20068D35F /* restart.png */; }; 8255B51E1E7ECEC20068D35F /* restart@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8255B51C1E7ECEC20068D35F /* restart@2x.png */; }; 8263CC5B1A9A14B0007E791A /* MainAlipay.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8263CC5A1A9A14B0007E791A /* MainAlipay.xib */; }; 8263CC5D1A9A14E9007E791A /* MainWeibo.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8263CC5C1A9A14E9007E791A /* MainWeibo.xib */; }; 8279E0AD1A73646700CD79C9 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 8279E0AB1A73646700CD79C9 /* Credits.rtf */; }; 8285780F1A9CA8C900526446 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 8285780E1A9CA8C900526446 /* Icon.icns */; }; 828B75821A7F7CCF0040DA32 /* HostNameController.m in Sources */ = {isa = PBXBuildFile; fileRef = 828B75811A7F7CCF0040DA32 /* HostNameController.m */; }; 828B75861A81F9180040DA32 /* HostNameModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 828B75851A81F9180040DA32 /* HostNameModel.m */; }; 828B758F1A8239780040DA32 /* docs.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B75871A8239780040DA32 /* docs.png */; }; 828B75901A8239780040DA32 /* docs@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B75881A8239780040DA32 /* docs@2x.png */; }; 828B75911A8239780040DA32 /* goto.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B75891A8239780040DA32 /* goto.png */; }; 828B75921A8239780040DA32 /* goto@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B758A1A8239780040DA32 /* goto@2x.png */; }; 828B75931A8239780040DA32 /* hostInfo.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B758B1A8239780040DA32 /* hostInfo.png */; }; 828B75941A8239780040DA32 /* hostInfo@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B758C1A8239780040DA32 /* hostInfo@2x.png */; }; 828B75951A8239780040DA32 /* info.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B758D1A8239780040DA32 /* info.png */; }; 828B75961A8239780040DA32 /* info@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B758E1A8239780040DA32 /* info@2x.png */; }; 828B759C1A823AE10040DA32 /* header_back_left.tif in Resources */ = {isa = PBXBuildFile; fileRef = 828B75971A823AE10040DA32 /* header_back_left.tif */; }; 828B759D1A823AE10040DA32 /* start.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B75981A823AE10040DA32 /* start.png */; }; 828B759E1A823AE10040DA32 /* start@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B75991A823AE10040DA32 /* start@2x.png */; }; 828B759F1A823AE10040DA32 /* webstart.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B759A1A823AE10040DA32 /* webstart.png */; }; 828B75A01A823AE10040DA32 /* webstart@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B759B1A823AE10040DA32 /* webstart@2x.png */; }; 828B75A21A835CC40040DA32 /* server.plist in Resources */ = {isa = PBXBuildFile; fileRef = 828B75A11A835CC40040DA32 /* server.plist */; }; 828B76061A84D7150040DA32 /* GeneralController.m in Sources */ = {isa = PBXBuildFile; fileRef = 828B76051A84D7150040DA32 /* GeneralController.m */; }; 828B760A1A8603660040DA32 /* Sequel Pro.icns in Resources */ = {isa = PBXBuildFile; fileRef = 828B76091A8603660040DA32 /* Sequel Pro.icns */; }; 828B760F1A860DEF0040DA32 /* stop.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B760D1A860DEF0040DA32 /* stop.png */; }; 828B76101A860DEF0040DA32 /* stop@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 828B760E1A860DEF0040DA32 /* stop@2x.png */; }; 828B76671A874C2D0040DA32 /* MySQLController.m in Sources */ = {isa = PBXBuildFile; fileRef = 828B76661A874C2D0040DA32 /* MySQLController.m */; }; 829C3C25276B63EC00181B11 /* install_helper.sh in Resources */ = {isa = PBXBuildFile; fileRef = 829C3C24276B63EB00181B11 /* install_helper.sh */; }; 829C3C27276B78E100181B11 /* script.sh in Resources */ = {isa = PBXBuildFile; fileRef = 829C3C26276B78E000181B11 /* script.sh */; }; 82C366621D313DE80044B58C /* tool.png in Resources */ = {isa = PBXBuildFile; fileRef = 82C366611D313DE80044B58C /* tool.png */; }; 82D9208E1A9C4D0800AFF5B1 /* weibo.png in Resources */ = {isa = PBXBuildFile; fileRef = 82D9208D1A9C4D0800AFF5B1 /* weibo.png */; }; 82DDD0EE1A88B2A5002FFD4D /* common.plist in Resources */ = {isa = PBXBuildFile; fileRef = 82DDD0ED1A88B2A5002FFD4D /* common.plist */; }; 82DDD0F01A88D974002FFD4D /* pma.ico in Resources */ = {isa = PBXBuildFile; fileRef = 82DDD0EF1A88D974002FFD4D /* pma.ico */; }; 82DF53571A9CA9E90078DB2F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 82DF53551A9CA9E90078DB2F /* MainMenu.xib */; }; 82DF53591A9CAD470078DB2F /* mIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 82DF53581A9CAD470078DB2F /* mIcon.icns */; }; 82F8CFF91A70E5FC00B9FD25 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 82F8CFF81A70E5FC00B9FD25 /* AppDelegate.m */; }; 82F8CFFB1A70E5FC00B9FD25 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 82F8CFFA1A70E5FC00B9FD25 /* main.m */; }; 82F8CFFD1A70E5FC00B9FD25 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 82F8CFFC1A70E5FC00B9FD25 /* Images.xcassets */; }; 82F8D00C1A70E5FC00B9FD25 /* mdserverTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 82F8D00B1A70E5FC00B9FD25 /* mdserverTests.m */; }; 82FC77471A765DB800D599AA /* NSCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 82FC77461A765DB800D599AA /* NSCommon.m */; }; 82FDBB671A9AD9450086E89B /* alipay.png in Resources */ = {isa = PBXBuildFile; fileRef = 82FDBB661A9AD9450086E89B /* alipay.png */; }; 82FDBB691A9ADAA80086E89B /* weixin.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 82FDBB681A9ADAA80086E89B /* weixin.jpg */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 82F8D0061A70E5FC00B9FD25 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 82F8CFEA1A70E5FC00B9FD25 /* Project object */; proxyType = 1; remoteGlobalIDString = 82F8CFF11A70E5FC00B9FD25; remoteInfo = mdserver; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 820F1E921A8B90E200CBC093 /* addhost */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = addhost; sourceTree = ""; }; 820F1E931A8B90E200CBC093 /* removehost */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = removehost; sourceTree = ""; }; 820F1EAC1A8C823800CBC093 /* ss */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = ss; sourceTree = ""; }; 820F1EAE1A8CA74700CBC093 /* st */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = st; sourceTree = ""; }; 822279A22261810B00928FB1 /* NSTextField+Copypast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSTextField+Copypast.h"; sourceTree = ""; }; 822279A32261810B00928FB1 /* NSTextField+Copypast.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSTextField+Copypast.m"; sourceTree = ""; }; 82409EEB1A8F448700CE78F9 /* my.cnf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = my.cnf; sourceTree = ""; }; 82409EED1A90451700CE78F9 /* modMysqlPwd.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = modMysqlPwd.sh; sourceTree = ""; }; 824EBDD81A8DD6BC0043BFA7 /* ModMySQLPwd.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ModMySQLPwd.xib; sourceTree = ""; }; 824EBDDA1A8E1D730043BFA7 /* ModMySQLPwdController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModMySQLPwdController.h; sourceTree = ""; }; 824EBDDB1A8E1D730043BFA7 /* ModMySQLPwdController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModMySQLPwdController.m; sourceTree = ""; }; 8255B51B1E7ECEC20068D35F /* restart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = restart.png; sourceTree = ""; }; 8255B51C1E7ECEC20068D35F /* restart@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "restart@2x.png"; sourceTree = ""; }; 8263CC591A99DC6F007E791A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 8263CC5A1A9A14B0007E791A /* MainAlipay.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainAlipay.xib; sourceTree = ""; }; 8263CC5C1A9A14E9007E791A /* MainWeibo.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainWeibo.xib; sourceTree = ""; }; 8279E0AC1A73646700CD79C9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = Base; path = Base.lproj/Credits.rtf; sourceTree = ""; }; 8285780E1A9CA8C900526446 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 828B75801A7F7CCF0040DA32 /* HostNameController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HostNameController.h; sourceTree = ""; }; 828B75811A7F7CCF0040DA32 /* HostNameController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HostNameController.m; sourceTree = ""; }; 828B75841A81F9180040DA32 /* HostNameModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HostNameModel.h; sourceTree = ""; }; 828B75851A81F9180040DA32 /* HostNameModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HostNameModel.m; sourceTree = ""; }; 828B75871A8239780040DA32 /* docs.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = docs.png; sourceTree = ""; }; 828B75881A8239780040DA32 /* docs@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "docs@2x.png"; sourceTree = ""; }; 828B75891A8239780040DA32 /* goto.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = goto.png; sourceTree = ""; }; 828B758A1A8239780040DA32 /* goto@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "goto@2x.png"; sourceTree = ""; }; 828B758B1A8239780040DA32 /* hostInfo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hostInfo.png; sourceTree = ""; }; 828B758C1A8239780040DA32 /* hostInfo@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "hostInfo@2x.png"; sourceTree = ""; }; 828B758D1A8239780040DA32 /* info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = info.png; sourceTree = ""; }; 828B758E1A8239780040DA32 /* info@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "info@2x.png"; sourceTree = ""; }; 828B75971A823AE10040DA32 /* header_back_left.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = header_back_left.tif; sourceTree = ""; }; 828B75981A823AE10040DA32 /* start.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = start.png; sourceTree = ""; }; 828B75991A823AE10040DA32 /* start@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "start@2x.png"; sourceTree = ""; }; 828B759A1A823AE10040DA32 /* webstart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = webstart.png; sourceTree = ""; }; 828B759B1A823AE10040DA32 /* webstart@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "webstart@2x.png"; sourceTree = ""; }; 828B75A11A835CC40040DA32 /* server.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = server.plist; sourceTree = ""; }; 828B76041A84D7150040DA32 /* GeneralController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneralController.h; sourceTree = ""; }; 828B76051A84D7150040DA32 /* GeneralController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneralController.m; sourceTree = ""; }; 828B76091A8603660040DA32 /* Sequel Pro.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "Sequel Pro.icns"; sourceTree = ""; }; 828B760D1A860DEF0040DA32 /* stop.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = stop.png; sourceTree = ""; }; 828B760E1A860DEF0040DA32 /* stop@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stop@2x.png"; sourceTree = ""; }; 828B76651A874C2D0040DA32 /* MySQLController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MySQLController.h; sourceTree = ""; }; 828B76661A874C2D0040DA32 /* MySQLController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MySQLController.m; sourceTree = ""; }; 829C3C24276B63EB00181B11 /* install_helper.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = install_helper.sh; sourceTree = ""; }; 829C3C26276B78E000181B11 /* script.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = script.sh; sourceTree = ""; }; 82C366611D313DE80044B58C /* tool.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tool.png; sourceTree = ""; }; 82D9208D1A9C4D0800AFF5B1 /* weibo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = weibo.png; sourceTree = ""; }; 82DDD0ED1A88B2A5002FFD4D /* common.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = common.plist; sourceTree = ""; }; 82DDD0EF1A88D974002FFD4D /* pma.ico */ = {isa = PBXFileReference; lastKnownFileType = image.ico; path = pma.ico; sourceTree = ""; }; 82DF53561A9CA9E90078DB2F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 82DF53581A9CAD470078DB2F /* mIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = mIcon.icns; sourceTree = ""; }; 82F8CFF21A70E5FC00B9FD25 /* mdserver.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = mdserver.app; sourceTree = BUILT_PRODUCTS_DIR; }; 82F8CFF61A70E5FC00B9FD25 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 82F8CFF71A70E5FC00B9FD25 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 82F8CFF81A70E5FC00B9FD25 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 82F8CFFA1A70E5FC00B9FD25 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 82F8CFFC1A70E5FC00B9FD25 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 82F8D0051A70E5FC00B9FD25 /* mdserverTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = mdserverTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 82F8D00A1A70E5FC00B9FD25 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 82F8D00B1A70E5FC00B9FD25 /* mdserverTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = mdserverTests.m; sourceTree = ""; }; 82FC77451A765DB800D599AA /* NSCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCommon.h; sourceTree = ""; }; 82FC77461A765DB800D599AA /* NSCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCommon.m; sourceTree = ""; }; 82FDBB661A9AD9450086E89B /* alipay.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = alipay.png; sourceTree = ""; }; 82FDBB681A9ADAA80086E89B /* weixin.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = weixin.jpg; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 82F8CFEF1A70E5FC00B9FD25 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 82F8D0021A70E5FC00B9FD25 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 824CD7C41A7265E400668E6F /* Resources */ = { isa = PBXGroup; children = ( 829C3C26276B78E000181B11 /* script.sh */, 829C3C24276B63EB00181B11 /* install_helper.sh */, 8255B51B1E7ECEC20068D35F /* restart.png */, 8255B51C1E7ECEC20068D35F /* restart@2x.png */, 8285780E1A9CA8C900526446 /* Icon.icns */, 82FDBB681A9ADAA80086E89B /* weixin.jpg */, 82409EED1A90451700CE78F9 /* modMysqlPwd.sh */, 82FDBB661A9AD9450086E89B /* alipay.png */, 82409EEB1A8F448700CE78F9 /* my.cnf */, 820F1EAE1A8CA74700CBC093 /* st */, 820F1EAC1A8C823800CBC093 /* ss */, 820F1E921A8B90E200CBC093 /* addhost */, 820F1E931A8B90E200CBC093 /* removehost */, 828B760D1A860DEF0040DA32 /* stop.png */, 828B760E1A860DEF0040DA32 /* stop@2x.png */, 828B76091A8603660040DA32 /* Sequel Pro.icns */, 82DDD0EF1A88D974002FFD4D /* pma.ico */, 82C366611D313DE80044B58C /* tool.png */, 828B75971A823AE10040DA32 /* header_back_left.tif */, 828B75981A823AE10040DA32 /* start.png */, 828B75991A823AE10040DA32 /* start@2x.png */, 828B759A1A823AE10040DA32 /* webstart.png */, 828B759B1A823AE10040DA32 /* webstart@2x.png */, 828B75871A8239780040DA32 /* docs.png */, 828B75881A8239780040DA32 /* docs@2x.png */, 828B75891A8239780040DA32 /* goto.png */, 828B758A1A8239780040DA32 /* goto@2x.png */, 82DF53581A9CAD470078DB2F /* mIcon.icns */, 82D9208D1A9C4D0800AFF5B1 /* weibo.png */, 828B758B1A8239780040DA32 /* hostInfo.png */, 828B758C1A8239780040DA32 /* hostInfo@2x.png */, 828B758D1A8239780040DA32 /* info.png */, 828B758E1A8239780040DA32 /* info@2x.png */, ); path = Resources; sourceTree = ""; }; 828B75831A81F8D80040DA32 /* Model */ = { isa = PBXGroup; children = ( 828B75841A81F9180040DA32 /* HostNameModel.h */, 828B75851A81F9180040DA32 /* HostNameModel.m */, ); path = Model; sourceTree = ""; }; 82F8CFE91A70E5FC00B9FD25 = { isa = PBXGroup; children = ( 82F8CFF41A70E5FC00B9FD25 /* mdserver */, 82F8D0081A70E5FC00B9FD25 /* mdserverTests */, 82F8CFF31A70E5FC00B9FD25 /* Products */, ); sourceTree = ""; }; 82F8CFF31A70E5FC00B9FD25 /* Products */ = { isa = PBXGroup; children = ( 82F8CFF21A70E5FC00B9FD25 /* mdserver.app */, 82F8D0051A70E5FC00B9FD25 /* mdserverTests.xctest */, ); name = Products; sourceTree = ""; }; 82F8CFF41A70E5FC00B9FD25 /* mdserver */ = { isa = PBXGroup; children = ( 824CD7C41A7265E400668E6F /* Resources */, 828B75831A81F8D80040DA32 /* Model */, 82F8D0151A70E7B000B9FD25 /* Controller */, 82F8CFF71A70E5FC00B9FD25 /* AppDelegate.h */, 82F8CFF81A70E5FC00B9FD25 /* AppDelegate.m */, 82FC77451A765DB800D599AA /* NSCommon.h */, 82FC77461A765DB800D599AA /* NSCommon.m */, 82F8CFFC1A70E5FC00B9FD25 /* Images.xcassets */, 82DF53551A9CA9E90078DB2F /* MainMenu.xib */, 824EBDD81A8DD6BC0043BFA7 /* ModMySQLPwd.xib */, 8263CC5A1A9A14B0007E791A /* MainAlipay.xib */, 8263CC5C1A9A14E9007E791A /* MainWeibo.xib */, 82F8CFF51A70E5FC00B9FD25 /* Supporting Files */, 822279A22261810B00928FB1 /* NSTextField+Copypast.h */, 822279A32261810B00928FB1 /* NSTextField+Copypast.m */, ); path = mdserver; sourceTree = ""; }; 82F8CFF51A70E5FC00B9FD25 /* Supporting Files */ = { isa = PBXGroup; children = ( 828B75A11A835CC40040DA32 /* server.plist */, 82DDD0ED1A88B2A5002FFD4D /* common.plist */, 8279E0AB1A73646700CD79C9 /* Credits.rtf */, 82F8CFF61A70E5FC00B9FD25 /* Info.plist */, 82F8CFFA1A70E5FC00B9FD25 /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; 82F8D0081A70E5FC00B9FD25 /* mdserverTests */ = { isa = PBXGroup; children = ( 82F8D00B1A70E5FC00B9FD25 /* mdserverTests.m */, 82F8D0091A70E5FC00B9FD25 /* Supporting Files */, ); path = mdserverTests; sourceTree = ""; }; 82F8D0091A70E5FC00B9FD25 /* Supporting Files */ = { isa = PBXGroup; children = ( 82F8D00A1A70E5FC00B9FD25 /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; 82F8D0151A70E7B000B9FD25 /* Controller */ = { isa = PBXGroup; children = ( 828B75801A7F7CCF0040DA32 /* HostNameController.h */, 828B75811A7F7CCF0040DA32 /* HostNameController.m */, 828B76041A84D7150040DA32 /* GeneralController.h */, 828B76051A84D7150040DA32 /* GeneralController.m */, 828B76651A874C2D0040DA32 /* MySQLController.h */, 828B76661A874C2D0040DA32 /* MySQLController.m */, 824EBDDA1A8E1D730043BFA7 /* ModMySQLPwdController.h */, 824EBDDB1A8E1D730043BFA7 /* ModMySQLPwdController.m */, ); path = Controller; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 82F8CFF11A70E5FC00B9FD25 /* mdserver */ = { isa = PBXNativeTarget; buildConfigurationList = 82F8D00F1A70E5FC00B9FD25 /* Build configuration list for PBXNativeTarget "mdserver" */; buildPhases = ( 82F8CFEE1A70E5FC00B9FD25 /* Sources */, 82F8CFEF1A70E5FC00B9FD25 /* Frameworks */, 82F8CFF01A70E5FC00B9FD25 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = mdserver; productName = mdserver; productReference = 82F8CFF21A70E5FC00B9FD25 /* mdserver.app */; productType = "com.apple.product-type.application"; }; 82F8D0041A70E5FC00B9FD25 /* mdserverTests */ = { isa = PBXNativeTarget; buildConfigurationList = 82F8D0121A70E5FC00B9FD25 /* Build configuration list for PBXNativeTarget "mdserverTests" */; buildPhases = ( 82F8D0011A70E5FC00B9FD25 /* Sources */, 82F8D0021A70E5FC00B9FD25 /* Frameworks */, 82F8D0031A70E5FC00B9FD25 /* Resources */, ); buildRules = ( ); dependencies = ( 82F8D0071A70E5FC00B9FD25 /* PBXTargetDependency */, ); name = mdserverTests; productName = mdserverTests; productReference = 82F8D0051A70E5FC00B9FD25 /* mdserverTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 82F8CFEA1A70E5FC00B9FD25 /* Project object */ = { isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; LastUpgradeCheck = 2600; ORGANIZATIONNAME = midoks.cachecha.com; TargetAttributes = { 82F8CFF11A70E5FC00B9FD25 = { CreatedOnToolsVersion = 6.1.1; }; 82F8D0041A70E5FC00B9FD25 = { CreatedOnToolsVersion = 6.1.1; TestTargetID = 82F8CFF11A70E5FC00B9FD25; }; }; }; buildConfigurationList = 82F8CFED1A70E5FC00B9FD25 /* Build configuration list for PBXProject "mdserver" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 82F8CFE91A70E5FC00B9FD25; productRefGroup = 82F8CFF31A70E5FC00B9FD25 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 82F8CFF11A70E5FC00B9FD25 /* mdserver */, 82F8D0041A70E5FC00B9FD25 /* mdserverTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 82F8CFF01A70E5FC00B9FD25 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 820F1E941A8B90E200CBC093 /* addhost in Resources */, 824EBDD91A8DD6BC0043BFA7 /* ModMySQLPwd.xib in Resources */, 82DDD0F01A88D974002FFD4D /* pma.ico in Resources */, 828B760A1A8603660040DA32 /* Sequel Pro.icns in Resources */, 828B759E1A823AE10040DA32 /* start@2x.png in Resources */, 828B75931A8239780040DA32 /* hostInfo.png in Resources */, 8263CC5D1A9A14E9007E791A /* MainWeibo.xib in Resources */, 828B75A21A835CC40040DA32 /* server.plist in Resources */, 828B75961A8239780040DA32 /* info@2x.png in Resources */, 82C366621D313DE80044B58C /* tool.png in Resources */, 820F1EAD1A8C823800CBC093 /* ss in Resources */, 828B759D1A823AE10040DA32 /* start.png in Resources */, 8279E0AD1A73646700CD79C9 /* Credits.rtf in Resources */, 82FDBB691A9ADAA80086E89B /* weixin.jpg in Resources */, 828B759F1A823AE10040DA32 /* webstart.png in Resources */, 828B75921A8239780040DA32 /* goto@2x.png in Resources */, 829C3C27276B78E100181B11 /* script.sh in Resources */, 828B75951A8239780040DA32 /* info.png in Resources */, 82D9208E1A9C4D0800AFF5B1 /* weibo.png in Resources */, 82409EEE1A90451700CE78F9 /* modMysqlPwd.sh in Resources */, 828B758F1A8239780040DA32 /* docs.png in Resources */, 82DF53591A9CAD470078DB2F /* mIcon.icns in Resources */, 82F8CFFD1A70E5FC00B9FD25 /* Images.xcassets in Resources */, 828B75911A8239780040DA32 /* goto.png in Resources */, 8263CC5B1A9A14B0007E791A /* MainAlipay.xib in Resources */, 82409EEC1A8F448700CE78F9 /* my.cnf in Resources */, 828B75901A8239780040DA32 /* docs@2x.png in Resources */, 82FDBB671A9AD9450086E89B /* alipay.png in Resources */, 828B759C1A823AE10040DA32 /* header_back_left.tif in Resources */, 82DF53571A9CA9E90078DB2F /* MainMenu.xib in Resources */, 828B75A01A823AE10040DA32 /* webstart@2x.png in Resources */, 828B760F1A860DEF0040DA32 /* stop.png in Resources */, 820F1EAF1A8CA74700CBC093 /* st in Resources */, 829C3C25276B63EC00181B11 /* install_helper.sh in Resources */, 82DDD0EE1A88B2A5002FFD4D /* common.plist in Resources */, 828B76101A860DEF0040DA32 /* stop@2x.png in Resources */, 8285780F1A9CA8C900526446 /* Icon.icns in Resources */, 828B75941A8239780040DA32 /* hostInfo@2x.png in Resources */, 8255B51E1E7ECEC20068D35F /* restart@2x.png in Resources */, 820F1E951A8B90E200CBC093 /* removehost in Resources */, 8255B51D1E7ECEC20068D35F /* restart.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; 82F8D0031A70E5FC00B9FD25 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 82F8CFEE1A70E5FC00B9FD25 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 828B76061A84D7150040DA32 /* GeneralController.m in Sources */, 828B75821A7F7CCF0040DA32 /* HostNameController.m in Sources */, 82F8CFFB1A70E5FC00B9FD25 /* main.m in Sources */, 82F8CFF91A70E5FC00B9FD25 /* AppDelegate.m in Sources */, 828B75861A81F9180040DA32 /* HostNameModel.m in Sources */, 822279A42261810B00928FB1 /* NSTextField+Copypast.m in Sources */, 824EBDDC1A8E1D730043BFA7 /* ModMySQLPwdController.m in Sources */, 828B76671A874C2D0040DA32 /* MySQLController.m in Sources */, 82FC77471A765DB800D599AA /* NSCommon.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 82F8D0011A70E5FC00B9FD25 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 82F8D00C1A70E5FC00B9FD25 /* mdserverTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 82F8D0071A70E5FC00B9FD25 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 82F8CFF11A70E5FC00B9FD25 /* mdserver */; targetProxy = 82F8D0061A70E5FC00B9FD25 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 8279E0AB1A73646700CD79C9 /* Credits.rtf */ = { isa = PBXVariantGroup; children = ( 8279E0AC1A73646700CD79C9 /* Base */, 8263CC591A99DC6F007E791A /* en */, ); name = Credits.rtf; sourceTree = ""; }; 82DF53551A9CA9E90078DB2F /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( 82DF53561A9CA9E90078DB2F /* Base */, ); name = MainMenu.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 82F8D00D1A70E5FC00B9FD25 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; 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 = 14.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; STRING_CATALOG_GENERATE_SYMBOLS = YES; }; name = Debug; }; 82F8D00E1A70E5FC00B9FD25 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; 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 = 14.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; STRING_CATALOG_GENERATE_SYMBOLS = YES; }; name = Release; }; 82F8D0101A70E5FC00B9FD25 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; INFOPLIST_FILE = mdserver/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 5.0; PRODUCT_BUNDLE_IDENTIFIER = "com.midoks.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 82F8D0111A70E5FC00B9FD25 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; INFOPLIST_FILE = mdserver/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; MARKETING_VERSION = 5.0; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.midoks.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 82F8D0131A70E5FC00B9FD25 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", "$(inherited)", ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = mdserverTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = "com.midoks.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mdserver.app/Contents/MacOS/mdserver"; }; name = Debug; }; 82F8D0141A70E5FC00B9FD25 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", "$(inherited)", ); INFOPLIST_FILE = mdserverTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; PRODUCT_BUNDLE_IDENTIFIER = "com.midoks.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mdserver.app/Contents/MacOS/mdserver"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 82F8CFED1A70E5FC00B9FD25 /* Build configuration list for PBXProject "mdserver" */ = { isa = XCConfigurationList; buildConfigurations = ( 82F8D00D1A70E5FC00B9FD25 /* Debug */, 82F8D00E1A70E5FC00B9FD25 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 82F8D00F1A70E5FC00B9FD25 /* Build configuration list for PBXNativeTarget "mdserver" */ = { isa = XCConfigurationList; buildConfigurations = ( 82F8D0101A70E5FC00B9FD25 /* Debug */, 82F8D0111A70E5FC00B9FD25 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 82F8D0121A70E5FC00B9FD25 /* Build configuration list for PBXNativeTarget "mdserverTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 82F8D0131A70E5FC00B9FD25 /* Debug */, 82F8D0141A70E5FC00B9FD25 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 82F8CFEA1A70E5FC00B9FD25 /* Project object */; } ================================================ FILE: mdserver/mdserver.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: mdserver/mdserver.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: mdserver/mdserver.xcodeproj/xcuserdata/midoks.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: mdserver/mdserver.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/mdserver.xcscheme ================================================ ================================================ FILE: mdserver/mdserver.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState mdserver.xcscheme orderHint 0 SuppressBuildableAutocreation 82F8CFF11A70E5FC00B9FD25 primary 82F8D0041A70E5FC00B9FD25 primary ================================================ FILE: mdserver/mdserverTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIconFile Icon.icns CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: mdserver/mdserverTests/mdserverTests.m ================================================ // // mdserverTests.m // mdserverTests // // Created by midoks on 15/1/22. // Copyright (c) 2015年 midoks. All rights reserved. // #import #import @interface mdserverTests : XCTestCase @end @implementation mdserverTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { // This is an example of a functional test case. XCTAssert(YES, @"Pass"); } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: ss/ss/NSCommon.h ================================================ // // NSCommon.h // host // // Created by midoks on 15/2/11. // Copyright (c) 2015年 midoks. All rights reserved. // #import #import #include @interface NSCommon : NSObject #pragma mark 获取运行根目录 + (NSString *)getRootDir; @end ================================================ FILE: ss/ss/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 = [self getDirName:str]; str = [self getDirName:str]; str = [self getDirName:str]; str = [NSString stringWithFormat:@"%@/mdserver/bin", str]; return str; } @end ================================================ FILE: ss/ss/main.m ================================================ // // main.m // ss // // Created by midoks on 15/2/12. // Copyright (c) 2015年 midoks. All rights reserved. // #import #import "NSCommon.h" int main(int argc, const char * argv[]) { @autoreleasepool { // insert code here... //NSLog(@"Hello, World!"); NSString *root = [NSCommon getRootDir]; //#1.启动 NSString *start = [NSString stringWithFormat:@"%@/stop.sh", root]; //NSLog(@"%@", start); [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", start, nil]] waitUntilExit]; //#2.停止 // NSString *stop = [NSString stringWithFormat:@"%@/stop.sh", root]; // [[NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:[NSArray arrayWithObjects:@"-c", stop, nil]] waitUntilExit]; } return 0; } ================================================ FILE: ss/ss.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 820F1EA31A8C7EA700CBC093 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 820F1EA21A8C7EA700CBC093 /* main.m */; }; 820F1EAB1A8C807800CBC093 /* NSCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 820F1EAA1A8C807800CBC093 /* NSCommon.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 820F1E9D1A8C7EA600CBC093 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = /usr/share/man/man1/; dstSubfolderSpec = 0; files = ( ); runOnlyForDeploymentPostprocessing = 1; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 820F1E9F1A8C7EA600CBC093 /* ss */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ss; sourceTree = BUILT_PRODUCTS_DIR; }; 820F1EA21A8C7EA700CBC093 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 820F1EA91A8C807800CBC093 /* NSCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCommon.h; sourceTree = ""; }; 820F1EAA1A8C807800CBC093 /* NSCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCommon.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 820F1E9C1A8C7EA600CBC093 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 820F1E961A8C7EA600CBC093 = { isa = PBXGroup; children = ( 820F1EA11A8C7EA600CBC093 /* ss */, 820F1EA01A8C7EA600CBC093 /* Products */, ); sourceTree = ""; }; 820F1EA01A8C7EA600CBC093 /* Products */ = { isa = PBXGroup; children = ( 820F1E9F1A8C7EA600CBC093 /* ss */, ); name = Products; sourceTree = ""; }; 820F1EA11A8C7EA600CBC093 /* ss */ = { isa = PBXGroup; children = ( 820F1EA91A8C807800CBC093 /* NSCommon.h */, 820F1EAA1A8C807800CBC093 /* NSCommon.m */, 820F1EA21A8C7EA700CBC093 /* main.m */, ); path = ss; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 820F1E9E1A8C7EA600CBC093 /* ss */ = { isa = PBXNativeTarget; buildConfigurationList = 820F1EA61A8C7EA700CBC093 /* Build configuration list for PBXNativeTarget "ss" */; buildPhases = ( 820F1E9B1A8C7EA600CBC093 /* Sources */, 820F1E9C1A8C7EA600CBC093 /* Frameworks */, 820F1E9D1A8C7EA600CBC093 /* CopyFiles */, ); buildRules = ( ); dependencies = ( ); name = ss; productName = ss; productReference = 820F1E9F1A8C7EA600CBC093 /* ss */; productType = "com.apple.product-type.tool"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 820F1E971A8C7EA600CBC093 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0610; ORGANIZATIONNAME = midoks; TargetAttributes = { 820F1E9E1A8C7EA600CBC093 = { CreatedOnToolsVersion = 6.1.1; }; }; }; buildConfigurationList = 820F1E9A1A8C7EA600CBC093 /* Build configuration list for PBXProject "ss" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 820F1E961A8C7EA600CBC093; productRefGroup = 820F1EA01A8C7EA600CBC093 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 820F1E9E1A8C7EA600CBC093 /* ss */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ 820F1E9B1A8C7EA600CBC093 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 820F1EA31A8C7EA700CBC093 /* main.m in Sources */, 820F1EAB1A8C807800CBC093 /* NSCommon.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 820F1EA41A8C7EA700CBC093 /* 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; }; 820F1EA51A8C7EA700CBC093 /* 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; }; 820F1EA71A8C7EA700CBC093 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 820F1EA81A8C7EA700CBC093 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 820F1E9A1A8C7EA600CBC093 /* Build configuration list for PBXProject "ss" */ = { isa = XCConfigurationList; buildConfigurations = ( 820F1EA41A8C7EA700CBC093 /* Debug */, 820F1EA51A8C7EA700CBC093 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 820F1EA61A8C7EA700CBC093 /* Build configuration list for PBXNativeTarget "ss" */ = { isa = XCConfigurationList; buildConfigurations = ( 820F1EA71A8C7EA700CBC093 /* Debug */, 820F1EA81A8C7EA700CBC093 /* Release */, ); defaultConfigurationIsVisible = 0; }; /* End XCConfigurationList section */ }; rootObject = 820F1E971A8C7EA600CBC093 /* Project object */; } ================================================ FILE: ss/ss.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: ss/ss.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: ss/ss.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/ss.xcscheme ================================================ ================================================ FILE: ss/ss.xcodeproj/xcuserdata/midoks.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState ss.xcscheme orderHint 0 SuppressBuildableAutocreation 820F1E9E1A8C7EA600CBC093 primary