本文整理汇总了PHP中unix::IMAPD_GET方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::IMAPD_GET方法的具体用法?PHP unix::IMAPD_GET怎么用?PHP unix::IMAPD_GET使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::IMAPD_GET方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cyrus_paritition_default_path
function cyrus_paritition_default_path()
{
$unix = new unix();
echo "<articadatascgi>" . base64_encode($unix->IMAPD_GET("partition-default")) . "</articadatascgi>";
}
示例2: basename
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$unix = new unix();
if ($unix->process_exists(@file_get_contents($pidfile))) {
echo "Process already exists...\n";
die;
}
@file_put_contents($pidfile, getmypid());
$t1 = time();
$time = date('Y-m-d') . "_" . date('h:i');
$ini = new Bs_IniHandler();
$ini->loadFile("/etc/artica-postfix/settings/Daemons/CyrusAVConfig");
$nice = EXEC_NICE();
$clamscan = $unix->find_program("clamscan");
if (!is_file($clamscan)) {
die;
}
$partition_default = $unix->IMAPD_GET("partition-default");
if (!is_dir($partition_default)) {
send_email_events("Mailboxes antivirus scanning failed", "partition-default: \"{$partition_default}\"\nno such directory", "mailbox");
echo "partition-default: no such directory\n";
die;
}
@mkdir("/var/log/artica-postfix/antivirus/cyrus-imap", 0755, true);
$time = date('Y-m-d') . "_" . date('h:I');
$cmd = "{$nice} /usr/bin/clamscan --recursive=yes --infected ";
$cmd = $cmd . "--max-filesize=10M --max-scansize=10M --max-recursion=5 --max-dir-recursion=10 ";
$cmd = $cmd . "--log=/log/artica-postfix/antivirus/cyrus-imap/{$time}.scan {$partition_default}";
shell_exec($cmd);
$t2 = time();
$time_duration = distanceOfTimeInWords($t1, $t2);
send_email_events("Mailboxes antivirus scan terminated: {$time_duration}", @file_get_contents("/log/artica-postfix/antivirus/cyrus-imap/{$time}.scan"), "mailbox");
示例3: restorembx
function restorembx($basedContent)
{
$GLOBALS["ONNLY_MOUNT"] = true;
$unix = new unix();
$rsync = $unix->find_program("rsync");
$chown = $unix->find_program("chown");
$sudo = $unix->find_program("sudo");
$reconstruct = $unix->LOCATE_CYRRECONSTRUCT();
if (!is_file($rsync)) {
writelogs(date('m-d H:i:s') . " " . "Unable to stat rsync program", __FUNCTION__, __FILE__, __LINE__);
return;
}
if (!is_file($reconstruct)) {
writelogs(date('m-d H:i:s') . " " . "Unable to stat reconstruct program", __FUNCTION__, __FILE__, __LINE__);
return;
}
$array = unserialize(base64_decode($basedContent));
$id = $array["taskid"];
writelogs(date('m-d H:i:s') . " " . "mounting {$id}", __FUNCTION__, __FILE__);
$mounted_dir = backup($id);
if ($mounted_dir == null) {
writelogs(date('m-d H:i:s') . " " . "cannot mount task id {$id}", __FUNCTION__, __FILE__);
return;
}
$path = $array["path"];
$uid = $array["uid"];
if (preg_match("#INBOX\\/(.+)#", $array["mailbox"], $re)) {
$mailbox = $re[1];
$cyrus = new cyrus();
$cyrus->CreateSubDir($uid, $mailbox);
} else {
$mailbox = $array["mailbox"];
}
$localimapdir = $unix->IMAPD_GET("partition-default");
if (!is_dir($localimapdir)) {
writelogs(date('m-d H:i:s') . " " . "Unable to stat local partition-default", __FUNCTION__, __FILE__, __LINE__);
return;
}
$userfs = str_replace(".", "^", $uid);
$firstletter = substr($userfs, 0, 1);
$localuserfs = "{$localimapdir}/{$firstletter}/user/{$userfs}";
$localimapdir = "{$localimapdir}/{$firstletter}/user/{$userfs}/";
if (!is_dir($localimapdir)) {
writelogs(date('m-d H:i:s') . " " . "Unable to stat local \"{$localimapdir}\"", __FUNCTION__, __FILE__, __LINE__);
return;
}
$remoteimapdir = "{$mounted_dir}/{$path}/{$mailbox}";
@mkdir($localimapdir, null, true);
if (substr($remoteimapdir, strlen($remoteimapdir) - 1, 1) != "/") {
$remoteimapdir = $remoteimapdir . "/";
}
$cmd = "{$rsync} -z --stats {$remoteimapdir}* {$localimapdir} 2>&1";
if ($GLOBALS["USE_RSYNC"]) {
$backup = new backup_protocols();
writelogs(date('m-d H:i:s') . " " . "Using rsync protocol", __FUNCTION__, __FILE__, __LINE__);
$array_config = $backup->extract_rsync_protocol($remoteimapdir);
if (!is_array($array)) {
writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}]: rsync protocol error", __FUNCTION__, __FILE__, __LINE__);
return false;
}
if ($array_config["PASSWORD"] != null) {
$tmpstr = "/opt/artica/passwords/" . md5($array_config["PASSWORD"]);
@mkdir("/opt/artica/passwords", null, true);
@file_put_contents($tmpstr, $array_config["PASSWORD"]);
$pwd = " --password-file={$tmpstr}";
}
if ($array["USER"] != null) {
$user = "{$array["USER"]}@";
}
$cmd = "{$rsync}{$pwd} --stats rsync://{$user}{$array_config["SERVER"]}/{$array_config["FOLDER"]}* {$localimapdir} 2>&1";
}
writelogs(date('m-d H:i:s') . " " . "Restore from {$remoteimapdir}", __FUNCTION__, __FILE__, __LINE__);
writelogs(date('m-d H:i:s') . " " . "Restore to {$localimapdir}", __FUNCTION__, __FILE__, __LINE__);
writelogs(date('m-d H:i:s') . " " . "reconstruct path {$reconstruct}", __FUNCTION__, __FILE__, __LINE__);
writelogs(date('m-d H:i:s') . " " . "{$cmd}", __FUNCTION__, __FILE__, __LINE__);
exec($cmd, $rsynclogs);
$i = 0;
while (list($num, $line) = each($rsynclogs)) {
if (preg_match("#Number of files transferred:\\s+([0-9]+)#", $line, $re)) {
$GLOBALS["events"][] = "Files restored: {$re[1]}";
}
if (preg_match("#Total transferred file size:\\s+([0-9]+)#", $line, $re)) {
$bytes = $re[1];
$re[1] = round($re[1] / 1024 / 1000) . "M";
$GLOBALS["events"][] = "{$re[1]} size restored ({$bytes} bytes)";
}
if (preg_match("#Permission denied#", $line)) {
$i = $i + 1;
}
}
$GLOBALS["events"][] = "{$i} file(s) on error";
shell_exec("{$chown} -R cyrus:mail {$localuserfs}");
shell_exec("/bin/chmod -R 755 {$localuserfs}");
$cmd = "{$sudo} -u cyrus {$reconstruct} -r -f user/{$uid} 2>&1";
writelogs(date('m-d H:i:s') . " " . "{$cmd}", __FUNCTION__, __FILE__, __LINE__);
exec($cmd, $rsynclogs);
$GLOBALS["events"][] = "Reconstruct information: ";
while (list($num, $line) = each($rsynclogs)) {
$GLOBALS["events"][] = "reconstructed path: {$line}";
}
//.........这里部分代码省略.........
示例4: move_default_dir_to_newdir
function move_default_dir_to_newdir($path)
{
$path = base64_decode($path);
if ($path == null) {
return null;
}
if (!is_dir($path)) {
return null;
}
$unix = new unix();
$logs = "/usr/share/artica-postfix/ressources/logs/cyrus_dir_logs";
$currentdir = $unix->IMAPD_GET("partition-default");
$sock = new sockets();
$sock->SET_INFO("CyrusPartitionDefault", $path);
system($unix->find_program("mv") . " -fv {$currentdir}/* {$path}/ >{$logs} 2>&1");
system("/usr/share/artica-postfix/bin/artica-install --reconfigure-cyrus >>{$logs} 2>&1");
@chmod("/usr/share/artica-postfix/ressources/logs/cyrus_dir_logs", 0755);
}
示例5: events
$su = $unix->find_program("su");
if (!is_file($su)) {
events("unable to locate su tool !");
die;
}
$cyrreconstruct = $unix->LOCATE_CYRRECONSTRUCT();
if (!is_file($cyrreconstruct)) {
events("unable to locate CYRRECONSTRUCT tool !");
die;
}
$cyrquota = $unix->LOCATE_CYRQUOTA();
if (!is_file($cyrquota)) {
events("unable to locate cyrquota tool !");
die;
}
$unixhierarchysep = $unix->IMAPD_GET('unixhierarchysep');
$account = "user.{$GLOBALS["uid"]}";
if (strtolower($unixhierarchysep) == "yes") {
$account = "user/{$GLOBALS["uid"]}";
}
events("unixhierarchysep -> {$unixhierarchysep} ({$account})");
$queue_path = $unix->IMAPD_GET('partition-default');
events("unixhierarchysep -> {$unixhierarchysep} ({$account}) on {$queue_path}");
$first_letter = substr($GLOBALS["uid"], 0, 1);
$user_path = str_replace('.', '^', $GLOBALS["uid"]);
$fpath = "{$queue_path}/{$first_letter}/user/{$user_path}";
events("mailbox path -> {$fpath}");
if (is_file("{$fpath}/cyrus.seen")) {
events("Delete file {$fpath}/cyrus.seen");
@unlink("{$fpath}/cyrus.seen");
}
示例6: DirectorySize
function DirectorySize()
{
$unix = new unix();
$pid_path = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__;
$timePath = "/etc/artica-postfix/croned.1/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$pid = @file_get_contents($pid_path);
if (!$GLOBALS["FORCE"]) {
if ($unix->process_exists($pid)) {
die;
}
$childpid = posix_getpid();
@file_put_contents($pid_path, $childpid);
if (system_is_overloaded()) {
if ($GLOBALS["VERBOSE"]) {
echo "Overloaded system.\n";
}
return;
}
}
$filetim = $unix->file_time_min($timePath);
if ($GLOBALS["VERBOSE"]) {
echo "Time File: {$timePath} ({$filetim}Mn)\n";
}
if (!$GLOBALS["FORCE"]) {
if ($filetim < 240) {
return;
}
}
$partition_default = $unix->IMAPD_GET("partition-default");
if (is_link($partition_default)) {
$partition_default = readlink($partition_default);
}
@file_put_contents($timePath, time());
if ($GLOBALS["VERBOSE"]) {
echo "partition_default = {$partition_default}\n";
}
artica_mysql_events("Starting calculate - {$partition_default} - disk size", null, __FILE__, "mailbox");
if (strlen($partition_default) < 3) {
return;
}
if (!is_dir($partition_default)) {
return;
}
$currentsize = $unix->DIRSIZE_BYTES($partition_default) / 1024 / 1024;
$PartInfo = $unix->DIRPART_INFO($partition_default);
$totalMB = $PartInfo["TOT"];
$totalMB = round($totalMB / 1048576);
if ($GLOBALS["VERBOSE"]) {
echo "partition_default = {$currentsize}MB/{$totalMB}MB\n";
}
$sock = new sockets();
$currentsize = round($currentsize);
$sock->SET_INFO("CyrusImapPartitionDefaultSize", $currentsize);
$sock->SET_INFO("CyrusImapPartitionDefaultSizeTime", time());
$sock->SET_INFO("CyrusImapPartitionDiskSize", $totalMB);
send_email_events("Mailboxes size on your server: {$currentsize} MB", "Mailboxes size on your server: {$currentsize} MB", "mailbox");
if ($partition_default == "/var/spool/cyrus/mail") {
$sock->SET_INFO("CyrusImapPartitionDefaultDirSize", $currentsize);
return;
}
$currentsize = $unix->DIRSIZE_BYTES("/var/spool/cyrus/mail") / 1024 / 1024;
$sock->SET_INFO("CyrusImapPartitionDefaultDirSize", $currentsize);
}