function getfile($filename) { return ZFile::getfile($filename); }
function syncQuota() { global $pdo; $arr = file(ZFile::getfile('/etc/passwd')); $uids = array(); foreach ($arr as $v) { $tmp = explode(':', $v); $uids[$tmp[0]] = $tmp[2]; $pdo->update('user', array('uid' => $tmp[2], 'gid' => $tmp[3]), "user='******'"); } $sql = "SELECT * FROM user"; $users = $pdo->fetchAll($sql); foreach ($users as $v) { $user = $v->user; $quota = ZPackage::getPackage($v->package)->space; if (preg_match('/^[\\d\\.]+$/', $quota)) { $quota .= 'G'; } $kb = intval(human2bytes($quota) / 1024); $uid = $uids[$user]; if ($uid < 9000) { continue; } if ($quota == -1) { $kb = 0; } //var_dump($kb, $quota,human2bytes($quota.'GB'));echo '<hr>'; shell_exec("quotaquery set {$uid} {$kb},{$kb},0,0"); shell_exec("usermod -s /zh/bin/shell_{$v->shell} {$user}"); } //exit; }