File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -59,4 +59,26 @@ def list():
5959@blueprint .route ('/get_site_types' , endpoint = 'get_site_types' ,methods = ['POST' ])
6060@panel_login_required
6161def get_site_types ():
62- return []
62+ return []
63+
64+ @blueprint .route ('/get_cli_php_version' , endpoint = 'get_cli_php_version' ,methods = ['POST' ])
65+ @panel_login_required
66+ def get_cli_php_version ():
67+ php_dir = mw .getServerDir () + '/php'
68+ if not os .path .exists (php_dir ):
69+ return mw .returnData (False , '未安装PHP,无法设置' )
70+
71+ php_bin = '/usr/bin/php'
72+ php_versions = self .getPhpVersion ()
73+ php_versions = php_versions [1 :]
74+
75+ if len (php_versions ) < 1 :
76+ return mw .returnData (False , '未安装PHP,无法设置' )
77+
78+ if os .path .exists (php_bin ) and os .path .islink (php_bin ):
79+ link_re = os .readlink (php_bin )
80+ for v in php_versions :
81+ if link_re .find (v ['version' ]) != - 1 :
82+ return mw .returnData ({"select" : v , "versions" : php_versions })
83+
84+ return mw .getJson ({"select" : php_versions [0 ],"versions" : php_versions })
You can’t perform that action at this time.
0 commit comments