|
46 | 46 | $app->auth->check_module_permissions('admin'); |
47 | 47 | $app->auth->check_security_permissions('admin_allow_server_php'); |
48 | 48 |
|
49 | | -$app->uses("tform_actions"); |
50 | | -$app->tform_actions->onDelete(); |
| 49 | +$app->uses('tpl,tform,tform_actions'); |
| 50 | +$app->load('tform_actions'); |
| 51 | + |
| 52 | +class page_action extends tform_actions { |
| 53 | + |
| 54 | + function onBeforeDelete() { |
| 55 | + global $app; $conf; |
| 56 | + |
| 57 | + $check = array(); |
| 58 | + |
| 59 | + // fastcgi |
| 60 | + if(!empty(trim($this->dataRecord['php_fastcgi_binary']))) $check[] = trim($this->dataRecord['php_fastcgi_binary']); |
| 61 | + if(!empty(trim($this->dataRecord['php_fastcgi_ini_dir']))) $check[] = trim($this->dataRecord['php_fastcgi_ini_dir']); |
| 62 | + if(!empty($check)) $fastcgi_check = implode(':', $check); |
| 63 | + unset($check); |
| 64 | + |
| 65 | + // fpm |
| 66 | + if(!empty(trim($this->dataRecord['php_fpm_init_script']))) $check[] = trim($this->dataRecord['php_fpm_init_script']); |
| 67 | + if(!empty(trim($this->dataRecord['php_fpm_ini_dir']))) $check[] = trim($this->dataRecord['php_fpm_ini_dir']); |
| 68 | + if(!empty(trim($this->dataRecord['php_fpm_pool_dir']))) $check[] = trim($this->dataRecord['php_fpm_pool_dir']); |
| 69 | + if(!empty($check)) $fpm_check = implode(':', $check); |
| 70 | + |
| 71 | + $sql = 'SELECT domain_id FROM web_domain WHERE server_id = ? AND fastcgi_php_version LIKE ?'; |
| 72 | + if(isset($fastcgi_check)) $web_domains_fastcgi = $app->db->queryAllRecords($sql, $this->dataRecord['server_id'], '%:'.$fastcgi_check); |
| 73 | + if(isset($fpm_check)) $web_domains_fpm = $app->db->queryAllRecords($sql, $this->dataRecord['server_id'], '%:'.$fpm_check); |
| 74 | + |
| 75 | + if(!empty($webdomains_fastcgi) || !empty($web_domains_fpm)) $app->error($app->tform->lng('php_in_use_error')); |
| 76 | + |
| 77 | + } |
| 78 | + |
| 79 | +} |
| 80 | + |
| 81 | +$page = new page_action; |
| 82 | +$page->onDelete(); |
51 | 83 |
|
52 | 84 | ?> |
0 commit comments