• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP posix_uname函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中posix_uname函数的典型用法代码示例。如果您正苦于以下问题:PHP posix_uname函数的具体用法?PHP posix_uname怎么用?PHP posix_uname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了posix_uname函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct($params)
 {
     if (isset($params['mailname'])) {
         $this->mailname = $params['mailname'];
     } else {
         if (function_exists('posix_uname')) {
             $uname = posix_uname();
             $this->mailname = $uname['nodename'];
         }
     }
     if (isset($params['port'])) {
         $this->_port = $params['port'];
     } else {
         $this->_port = getservbyname('smtp', 'tcp');
     }
     if (isset($params['timeout'])) {
         $this->timeout = $params['timeout'];
     }
     if (isset($params['verp'])) {
         $this->verp = $params['verp'];
     }
     if (isset($params['test'])) {
         $this->test = $params['test'];
     }
     if (isset($params['peardebug'])) {
         $this->test = $params['peardebug'];
     }
     if (isset($params['netdns'])) {
         $this->withNetDns = $params['netdns'];
     }
 }
开发者ID:MMU-TWT-Class-Oct-2015,项目名称:G10B_Sales_of_Point_System_for_Video_and_Audio_shop,代码行数:31,代码来源:smtpmx.php


示例2: getIdc

 private static function getIdc()
 {
     $uname = posix_uname();
     $hostname = $uname["nodename"];
     $words = explode(".", $hostname);
     $cluster = $words[count($words) - 3];
     return $cluster;
 }
开发者ID:sdgdsffdsfff,项目名称:qconf-inner,代码行数:8,代码来源:QconfExtra.php


示例3: report

 public static function report($topic, $msg, $email = '')
 {
     /*{{{*/
     $sysinfo = posix_uname();
     $nodename = $sysinfo['nodename'];
     if (empty($email)) {
         $email = ALARM_EMAIL;
     }
     return mail($email, 'phpcron-' . $nodename . '-' . $topic, $msg);
 }
开发者ID:sdgdsffdsfff,项目名称:xcron,代码行数:10,代码来源:logger.php


示例4: __construct

 /**
  * Constroi o objeto de conexão HTTP.
  *
  * @param string $client
  */
 public function __construct($client = 'SDK PHP')
 {
     if (self::$userAgent == null) {
         $locale = setlocale(LC_ALL, null);
         if (function_exists('posix_uname')) {
             $uname = posix_uname();
             self::$userAgent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s %s; %s; %s; %s)', $client, PHP_SAPI, PHP_VERSION, $uname['sysname'], $uname['machine'], $locale);
         } else {
             self::$userAgent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s %s; %s; %s)', $client, PHP_SAPI, PHP_VERSION, PHP_OS, $locale);
         }
     }
 }
开发者ID:moip,项目名称:moip-http-php,代码行数:17,代码来源:HTTPConnection.php


示例5: get_loadavg

/**
* get 1 minute load average
*/
function get_loadavg()
{
    $uname = posix_uname();
    switch ($uname['sysname']) {
        case 'Linux':
            return linux_loadavg();
            break;
        case 'FreeBSD':
            return freebsd_loadavg();
            break;
        default:
            return -1;
    }
}
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:17,代码来源:recreate_maps.php


示例6: __construct

 /**
  * @brief	Constroi o objeto de conexão HTTP.
  */
 public function __construct()
 {
     if (self::$userAgent == null) {
         $locale = setlocale(LC_ALL, null);
         if (function_exists('posix_uname')) {
             $uname = posix_uname();
             self::$userAgent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s; %s %s; %s)', PHP_SAPI, PHP_VERSION, $uname['sysname'], $uname['machine'], $locale);
         } else {
             self::$userAgent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s; %s; %s)', PHP_SAPI, PHP_VERSION, PHP_OS, $locale);
         }
     }
     $this->requestHeader = array();
     $this->requestParameter = array();
 }
开发者ID:imastersdev,项目名称:correios,代码行数:17,代码来源:HTTPConnection.php


示例7: createNewSession

 /**
  * Creates a new Request_Session with all the default values.
  * A Session is created at construction.
  *
  * @param float $timeout         How long should we wait for a response?(seconds with a millisecond precision, default: 30, example: 0.01).
  * @param float $connect_timeout How long should we wait while trying to connect? (seconds with a millisecond precision, default: 10, example: 0.01)
  */
 public function createNewSession($timeout = 30.0, $connect_timeout = 30.0)
 {
     if (function_exists('posix_uname')) {
         $uname = posix_uname();
         $user_agent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s %s; %s; %s)', self::CLIENT, PHP_SAPI, PHP_VERSION, $uname['sysname'], $uname['machine']);
     } else {
         $user_agent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s %s; %s)', self::CLIENT, PHP_SAPI, PHP_VERSION, PHP_OS);
     }
     $sess = new Requests_Session($this->endpoint);
     $sess->options['auth'] = $this->moipAuthentication;
     $sess->options['timeout'] = $timeout;
     $sess->options['connect_timeout'] = $connect_timeout;
     $sess->options['useragent'] = $user_agent;
     $this->session = $sess;
 }
开发者ID:moip,项目名称:moip-sdk-php,代码行数:22,代码来源:Moip.php


示例8: getProperty

 /**
  * Retrieve system property. Note: Results of this method are
  * cached!
  *
  * Known property names:
  * <pre>
  * php.version       PHP version
  * php.api           PHP api
  * os.name           Operating system name
  * os.tempdir        System-wide temporary directory
  * host.name         Host name
  * host.arch         Host architecture
  * user.home         Current user's home directory
  * user.name         Current user's name
  * file.separator    File separator ("/" on UNIX)
  * path.separator    Path separator (":" on UNIX)
  * </pre>
  *
  * @param   string name
  * @return  var
  */
 public static function getProperty($name)
 {
     static $prop = [];
     if (!isset($prop[$name])) {
         switch ($name) {
             case 'php.version':
                 $prop[$name] = PHP_VERSION;
                 break;
             case 'php.api':
                 $prop[$name] = PHP_SAPI;
                 break;
             case 'os.name':
                 $prop[$name] = PHP_OS;
                 break;
             case 'os.tempdir':
                 $prop[$name] = self::tempDir();
                 break;
             case 'host.name':
                 $prop[$name] = gethostname();
                 break;
             case 'host.arch':
                 if (extension_loaded('posix')) {
                     $uname = posix_uname();
                     $prop[$name] = $uname['machine'];
                     break;
                 }
                 $prop[$name] = self::_env('HOSTTYPE', 'PROCESSOR_ARCHITECTURE');
                 break;
             case 'user.home':
                 if (extension_loaded('posix')) {
                     $pwuid = posix_getpwuid(posix_getuid());
                     $prop[$name] = $pwuid['dir'];
                     break;
                 }
                 $prop[$name] = str_replace('\\', DIRECTORY_SEPARATOR, self::_env('HOME', 'HOMEPATH'));
                 break;
             case 'user.name':
                 $prop[$name] = get_current_user();
                 break;
             case 'file.separator':
                 return DIRECTORY_SEPARATOR;
             case 'path.separator':
                 return PATH_SEPARATOR;
         }
     }
     return $prop[$name];
 }
开发者ID:johannes85,项目名称:core,代码行数:68,代码来源:System.class.php


示例9: u_syslog

function u_syslog($str)
{
    global $_SYSLOG_FD, $_SYSLOG_MODE;
    if (!$_SYSLOG_MODE) {
        u_openlog('unknown');
    }
    if ($_SYSLOG_MODE == 'syslog') {
        syslog(LOG_DEBUG, $s);
        return TRUE;
    } elseif ($_SYSLOG_MODE == 'file') {
        $uname = posix_uname();
        if (fputs($_SYSLOG_FD, date("M d H:i:s") . " " . $uname['nodename'] . " " . $str . "\n")) {
            return TRUE;
        }
    }
    return FALSE;
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:17,代码来源:syslog.php


示例10: __construct

 /**
  * @private
  */
 private function __construct()
 {
     $system = posix_uname();
     $backtrace = debug_backtrace();
     $starter = array_pop($backtrace);
     unset($backtrace);
     $startFile = isset($starter['file']) ? $starter['file'] : 'Daemon';
     $startFile = $startFile == '-' ? 'Daemon' : $startFile;
     unset($starter);
     $this->fqdn = $system['nodename'];
     $this->hostname = preg_replace('/\\..*/', '', $this->fqdn);
     $this->processName = str_replace(array('.phpt', '.php'), '', $startFile);
     $this->userId = posix_getuid();
     $this->groupId = posix_getgid();
     $this->pid = posix_getpid();
     $this->parentPid = posix_getppid();
     $this->pidPath = sprintf('/var/run/%s', $this->processName);
 }
开发者ID:sgc-fireball,项目名称:libphp,代码行数:21,代码来源:Daemon.php


示例11: getRelease

 /**
  * Returns the distribution
  *
  * @return string string
  */
 public function getRelease()
 {
     switch (strtolower($this->getPlatform())) {
         case "freebsd":
             /**
              * Unfortunately, there's no text file on FreeBSD which tells us the release
              * number. Thus, we hope that "release" within posix_uname() is defined.
              */
             if (function_exists("posix_uname")) {
                 $data = posix_uname();
                 if (array_key_exists("release", $data)) {
                     return $data["release"];
                 }
             }
             break;
         case "darwin":
             /**
              * Mac stores its version number in a public readable plist file, which
              * is in XML format.
              */
             $document = new \DomDocument();
             $document->load("/System/Library/CoreServices/SystemVersion.plist");
             $xpath = new \DOMXPath($document);
             $entries = $xpath->query("/plist/dict/*");
             $previous = "";
             foreach ($entries as $entry) {
                 if (strpos($previous, "ProductVersion") !== false) {
                     return $entry->textContent;
                 }
                 $previous = $entry->textContent;
             }
             break;
         case "linux":
             return $this->getLinuxDistribution();
             break;
         default:
             break;
     }
     return "unknown";
 }
开发者ID:fulcrum3d,项目名称:PartKeepr,代码行数:45,代码来源:OperatingSystem.php


示例12: display

 /**
  * wkhtmltopdf command should be available in the vendor/bin/ folder
  * if composer is used to get the sources from message/wkhtmltopdf in the project vendor/ folder
  * @see \t41\View\Adapter\WebAdapter::display()
  */
 public function display($content = null, $error = false)
 {
     error_reporting(0);
     $html = parent::display($content, $error);
     $unames = posix_uname();
     $ext = $unames['machine'] == 'x86_64' ? 'amd64' : 'i386';
     $bin = Core::$basePath . 'vendor/bin/wkhtmltopdf-' . $ext;
     if (!is_executable($bin)) {
         throw new Exception("Missing or not executable {$bin}");
     }
     if ($this->getParameter('orientation') == PdfAdapter::ORIENTATION_LANDSCAPE) {
         $bin .= ' --orientation Landscape';
     }
     if ($this->getParameter('copies') > 1) {
         $bin .= ' --copies ' . $this->getParameter('copies');
     }
     $dir = '/dev/shm/';
     $key = hash('md5', $html);
     file_put_contents($dir . $key . '.html', $html);
     exec(sprintf("%s %s%s.html %s%s.pdf", $bin, $dir, $key, $dir, $key));
     $doc = $this->getParameter('title') ? str_replace('/', '-', $this->getParameter('title')) . '.pdf' : 'Export.pdf';
     if ($this->getParameter('destination') == 'D') {
         header('Content-Type: application/pdf');
         header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
         header('Pragma: public');
         header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
         // Date in the past
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         header('Content-Disposition: inline; filename="' . $doc . '";');
         header('Content-Length: ' . filesize($dir . $key . '.pdf'));
         echo file_get_contents($dir . $key . '.pdf');
         unlink($dir . $key . '.html');
         unlink($dir . $key . '.pdf');
     } else {
         $pdf = file_get_contents($dir . $key . '.pdf');
         unlink($dir . $key . '.html');
         unlink($dir . $key . '.pdf');
         return $pdf;
     }
 }
开发者ID:crapougnax,项目名称:t41,代码行数:45,代码来源:Pdf2Adapter.php


示例13: __construct

 public function __construct($path = null, array $options = [])
 {
     if (!$path) {
         if (!($path = static::$path)) {
             # Check which version we should use based on the current machine architecture
             $bin = "wkhtmltopdf-";
             if (posix_uname()["machine"][0] == "i") {
                 $bin .= "i386";
             } else {
                 $bin .= "amd64";
             }
             # Start in the directory that we are in
             $path = __DIR__;
             # Move up to the composer vendor directory
             $path .= "/../../..";
             # Add the wkhtmltopdf binary path
             $path .= "/h4cc/" . $bin . "/bin/" . $bin;
             static::$path = $path;
         }
     }
     parent::__construct($path, $options);
 }
开发者ID:duncan3dc,项目名称:tcpdf,代码行数:22,代码来源:Snappy.php


示例14: get_hostname

function get_hostname()
{
    static $host = false;
    if ($host === false) {
        if (function_exists("posix_uname")) {
            $uname = posix_uname();
            $host = $uname["nodename"];
        } else {
            if (file_exists("/etc/farmconfig")) {
                $lines = file("/etc/farmconfig");
                foreach ($lines as $line) {
                    $tmp = explode("=", $line);
                    if ($tmp[0] == "HOST") {
                        $host = trim($tmp[1]);
                        break;
                    }
                }
                if ($host === false) {
                    $host = "localhost";
                }
            } else {
                if (file_exists("/etc/hostname")) {
                    $host = file_get_contents("/etc/hostname");
                    $host = trim($host);
                } else {
                    if (file_exists("/etc/HOSTNAME")) {
                        $host = file_get_contents("/etc/HOSTNAME");
                        $host = trim($host);
                    } else {
                        $host = "localhost";
                    }
                }
            }
        }
    }
    return $host;
}
开发者ID:yashodhank,项目名称:serverfarmer,代码行数:37,代码来源:show-hardware.php


示例15: VERIFY

VERIFY(posix_getpgrp());
VERIFY(posix_getpid());
VERIFY(posix_getppid());
$ret = posix_getpwnam("root");
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
VS(posix_getpwnam(""), false);
VS(posix_getpwnam(-1), false);
$ret = posix_getpwuid(0);
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
VS(posix_getpwuid(-1), false);
$ret = posix_getrlimit();
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
VERIFY(posix_getsid(posix_getpid()));
$tmpfifo = tempnam('/tmp', 'vmmkfifotest');
unlink($tmpfifo);
VERIFY(posix_mkfifo($tmpfifo, 0));
$tmpnod = tempnam('/tmp', 'vmmknodtest');
unlink($tmpnod);
VERIFY(posix_mknod($tmpnod, 0));
VERIFY(posix_setpgid(0, 0));
VERIFY(posix_setsid());
VERIFY(strlen(posix_strerror(1)));
$ret = posix_times();
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
$ret = posix_uname();
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
开发者ID:gangjun911,项目名称:hhvm,代码行数:31,代码来源:ext_posix.php


示例16: __construct

 /**
  * @param array $params  Additional options:
  *   - debug: (boolean) Activate SMTP debug mode?
  *            DEFAULT: false
  *   - mailname: (string) The name of the local mail system (a valid
  *               hostname which matches the reverse lookup)
  *               DEFAULT: Auto-determined
  *   - netdns: (boolean) Use PEAR:Net_DNS2 (true) or the PHP builtin
  *             getmxrr().
  *             DEFAULT: true
  *   - port: (integer) Port.
  *           DEFAULT: Auto-determined
  *   - test: (boolean) Activate test mode?
  *           DEFAULT: false
  *   - timeout: (integer) The SMTP connection timeout (in seconds).
  *              DEFAULT: 10
  *   - verp: (boolean) Whether to use VERP.
  *           If not a boolean, the string value will be used as the VERP
  *           separators.
  *           DEFAULT: false
  *   - vrfy: (boolean) Whether to use VRFY.
  *           DEFAULT: false
  */
 public function __construct(array $params = array())
 {
     /* Try to find a valid mailname. */
     if (!isset($params['mailname']) && function_exists('posix_uname')) {
         $uname = posix_uname();
         $params['mailname'] = $uname['nodename'];
     }
     if (!isset($params['port'])) {
         $params['port'] = getservbyname('smtp', 'tcp');
     }
     $this->_params = array_merge(array('debug' => false, 'mailname' => 'localhost', 'netdns' => true, 'port' => 25, 'test' => false, 'timeout' => 10, 'verp' => false, 'vrfy' => false), $params);
     /* SMTP requires CRLF line endings. */
     $this->sep = "\r\n";
 }
开发者ID:evltuma,项目名称:moodle,代码行数:37,代码来源:Smtpmx.php


示例17: wfHostname

/**
 * Fetch server name for use in error reporting etc.
 * Use real server name if available, so we know which machine
 * in a server farm generated the current page.
 *
 * @return string
 */
function wfHostname()
{
    static $host;
    if (is_null($host)) {
        # Hostname overriding
        global $wgOverrideHostname;
        if ($wgOverrideHostname !== false) {
            # Set static and skip any detection
            $host = $wgOverrideHostname;
            return $host;
        }
        if (function_exists('posix_uname')) {
            // This function not present on Windows
            $uname = posix_uname();
        } else {
            $uname = false;
        }
        if (is_array($uname) && isset($uname['nodename'])) {
            $host = $uname['nodename'];
        } elseif (getenv('COMPUTERNAME')) {
            # Windows computer name
            $host = getenv('COMPUTERNAME');
        } else {
            # This may be a virtual server.
            $host = $_SERVER['SERVER_NAME'];
        }
    }
    return $host;
}
开发者ID:D66Ha,项目名称:mediawiki,代码行数:36,代码来源:GlobalFunctions.php


示例18: _parseChallenge

 /**
  * Parses and verifies the digest challenge*
  *
  * @param  string $challenge The digest challenge
  * @return array             The parsed challenge as an assoc
  *                           array in the form "directive => value".
  * @access private
  */
 function _parseChallenge($challenge)
 {
     $tokens = array();
     while (preg_match('/^([a-z-]+)=("[^"]+(?<!\\\\)"|[^,]+)/i', $challenge, $matches)) {
         // Ignore these as per rfc2831
         if ($matches[1] == 'opaque' or $matches[1] == 'domain') {
             $challenge = substr($challenge, strlen($matches[0]) + 1);
             continue;
         }
         // Allowed multiple "realm" and "auth-param"
         if (!empty($tokens[$matches[1]]) and ($matches[1] == 'realm' or $matches[1] == 'auth-param')) {
             if (is_array($tokens[$matches[1]])) {
                 $tokens[$matches[1]][] = preg_replace('/^"(.*)"$/', '\\1', $matches[2]);
             } else {
                 $tokens[$matches[1]] = array($tokens[$matches[1]], preg_replace('/^"(.*)"$/', '\\1', $matches[2]));
             }
             // Any other multiple instance = failure
         } elseif (!empty($tokens[$matches[1]])) {
             $tokens = array();
             break;
         } else {
             $tokens[$matches[1]] = preg_replace('/^"(.*)"$/', '\\1', $matches[2]);
         }
         // Remove the just parsed directive from the challenge
         $challenge = substr($challenge, strlen($matches[0]) + 1);
     }
     /**
      * Defaults and required directives
      */
     // Realm
     if (empty($tokens['realm'])) {
         $uname = posix_uname();
         $tokens['realm'] = $uname['nodename'];
     }
     // Maxbuf
     if (empty($tokens['maxbuf'])) {
         $tokens['maxbuf'] = 65536;
     }
     // Required: nonce, algorithm
     if (empty($tokens['nonce']) or empty($tokens['algorithm'])) {
         return array();
     }
     return $tokens;
 }
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:52,代码来源:DigestMD5.php


示例19: phorum_email_user

/**
 * function for sending email to users, gets addresses-array and data-array
 */
function phorum_email_user($addresses, $data)
{
    $PHORUM = $GLOBALS['PHORUM'];
    require_once './include/api/mail.php';
    // If we have no from_address in the message data, then generate
    // from_address ourselves, based on the system_email_* settings.
    if (!isset($data['from_address']) || trim($data['from_address']) == '') {
        $from_name = trim($PHORUM['system_email_from_name']);
        if ($from_name != '') {
            // Handle (Quoted-Printable) encoding of the from name.
            // Mail headers cannot contain 8-bit data as per RFC821.
            $from_name = phorum_api_mail_encode_header($from_name);
            $prefix = $from_name . ' <';
            $postfix = '>';
        } else {
            $prefix = $postfix = '';
        }
        $data['from_address'] = $prefix . $PHORUM['system_email_from_address'] . $postfix;
    }
    /*
     * [hook]
     *     email_user_start
     *
     * [description]
     *     This hook is put at the very beginning of 
     *     <literal>phorum_email_user()</literal> and is therefore called for
     *     <emphasis>every</emphasis> email that is sent from Phorum. It is put
     *     before every replacement done in that function so that all data which
     *     is sent to that function can be replaced/changed at will.
     *
     * [category]
     *     Moderation
     *
     * [when]
     *     In the file <filename>email_functions.php</filename> at the start of
     *     <literal>phorum_email_user()</literal>, before any modification of
     *     data.
     *
     * [input]
     *     An array containing:
     *     <ul>
     *     <li>An array of addresses.</li>
     *     <li>An array containing the message data.</li>
     *     </ul>
     *
     * [output]
     *     Same as input.
     *
     * [example]
     *     <hookcode>
     *     function phorum_mod_foo_email_user_start (list($addresses, $data)) 
     *     {
     *         global $PHORUM;
     *
     *         // Add our disclaimer to the end of every email message.
     *         $data["mailmessage"] = $PHORUM["mod_foo"]["email_disclaimer"];
     *
     *         return array($addresses, $data);
     *     }
     *     </hookcode>
     */
    if (isset($PHORUM["hooks"]["email_user_start"])) {
        list($addresses, $data) = phorum_hook("email_user_start", array($addresses, $data));
    }
    // Clear some variables that are meant for use by the email_user_start hook.
    unset($data['mailmessagetpl']);
    unset($data['mailsubjecttpl']);
    unset($data['language']);
    // Extract message body and subject.
    $mailmessage = $data['mailmessage'];
    unset($data['mailmessage']);
    $mailsubject = $data['mailsubject'];
    unset($data['mailsubject']);
    // Replace template variables.
    if (is_array($data) && count($data)) {
        foreach (array_keys($data) as $key) {
            if ($data[$key] === NULL || is_array($data[$key])) {
                continue;
            }
            $mailmessage = str_replace("%{$key}%", $data[$key], $mailmessage);
            $mailsubject = str_replace("%{$key}%", $data[$key], $mailsubject);
        }
    }
    $num_addresses = count($addresses);
    $from_address = $data['from_address'];
    # Try to find a useful hostname to use in the Message-ID.
    $host = "";
    if (isset($_SERVER["HTTP_HOST"])) {
        $host = $_SERVER["HTTP_HOST"];
    } else {
        if (function_exists("posix_uname")) {
            $sysinfo = @posix_uname();
            if (!empty($sysinfo["nodename"])) {
                $host .= $sysinfo["nodename"];
            }
            if (!empty($sysinfo["domainname"])) {
                $host .= $sysinfo["domainname"];
//.........这里部分代码省略.........
开发者ID:sleepy909,项目名称:cpassman,代码行数:101,代码来源:email_functions.php


示例20: backup

 function backup($pWrite = true)
 {
     $timeout = 20 * 60 * 60;
     //20minutes
     @set_time_limit($timeout);
     @ini_set('max_execution_time', $timeout);
     MainWP_Helper::endSession();
     //Cleanup pid files!
     $dirs = MainWP_Helper::getMainWPDir('backup');
     $backupdir = trailingslashit($dirs[0]);
     /** @var $wp_filesystem WP_Filesystem_Base */
     global $wp_filesystem;
     MainWP_Helper::getWPFilesystem();
     $files = glob($backupdir . '*');
     //Find old files (changes > 3 hr)
     foreach ($files as $file) {
         if (MainWP_Helper::endsWith($file, '/index.php') | MainWP_Helper::endsWith($file, '/.htaccess')) {
             continue;
         }
         if (time() - filemtime($file) > 60 * 60 * 3) {
             @unlink($file);
         }
     }
     $fileName = isset($_POST['fileUID']) ? $_POST['fileUID'] : '';
     if ('full' === $_POST['type']) {
         $excludes = isset($_POST['exclude']) ? explode(',', $_POST['exclude']) : array();
         $excludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/uploads/mainwp';
         $uploadDir = MainWP_Helper::getMainWPDir();
         $uploadDir = $uploadDir[0];
         $excludes[] = str_replace(ABSPATH, '', $uploadDir);
         $excludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/object-cache.php';
         if (function_exists('posix_uname')) {
             $uname = @posix_uname();
             if (is_array($uname) && isset($uname['nodename'])) {
                 if (stristr($uname['nodename'], 'hostgator')) {
                     if (!isset($_POST['file_descriptors']) || '0' == $_POST['file_descriptors'] || $_POST['file_descriptors'] > 1000) {
                         $_POST['file_descriptors'] = 1000;
                     }
                     $_POST['file_descriptors_auto'] = 0;
                     $_POST['loadFilesBeforeZip'] = false;
                 }
             }
         }
         $file_descriptors = isset($_POST['file_descriptors']) ? $_POST['file_descriptors'] : 0;
         $file_descriptors_auto = isset($_POST['file_descriptors_auto']) ? $_POST['file_descriptors_auto'] : 0;
         if (1 === (int) $file_descriptors_auto) {
             if (function_exists('posix_getrlimit')) {
                 $result = @posix_getrlimit();
                 if (isset($result['soft openfiles'])) {
                     $file_descriptors = $result['soft openfiles'];
                 }
             }
         }
         $loadFilesBeforeZip = isset($_POST['loadFilesBeforeZip']) ? $_POST['loadFilesBeforeZip'] : true;
         $newExcludes = array();
         foreach ($excludes as $exclude) {
             $newExcludes[] = rtrim($exclude, '/');
         }
         $excludebackup = isset($_POST['excludebackup']) && '1' == $_POST['excludebackup'];
         $excludecache = isset($_POST['excludecache']) && '1' == $_POST['excludecache'];
         $excludezip = isset($_POST['excludezip']) && '1' == $_POST['excludezip'];
         $excludenonwp = isset($_POST['excludenonwp']) && '1' == $_POST['excludenonwp'];
         if ($excludebackup) {
             //Backup buddy
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/uploads/backupbuddy_backups';
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/uploads/backupbuddy_temp';
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/uploads/pb_backupbuddy';
             //ManageWP
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/managewp';
             //InfiniteWP
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/infinitewp';
             //WordPress Backup to Dropbox
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/backups';
             //BackUpWordpress
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/backups';
             //BackWPUp
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/uploads/backwpup*';
             //WP Complete Backup
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/plugins/wp-complete-backup/storage';
             //WordPress EZ Backup
             //This one may be hard to do since they add random text at the end for example, feel free to skip if you need to
             ///backup_randomkyfkj where kyfkj is random
             //Online Backup for WordPress
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/backups';
             //XCloner
             $newExcludes[] = '/administrator/backups';
         }
         if ($excludecache) {
             //W3 Total Cache
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/w3tc-cache';
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/w3tc';
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/cache/config';
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/cache/minify';
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/cache/page_enhanced';
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/cache/tmp';
             //WP Super Cache
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/cache/supercache';
             //Quick Cache
             $newExcludes[] = str_replace(ABSPATH, '', WP_CONTENT_DIR) . '/cache/quick-cache';
             //Hyper Cache
//.........这里部分代码省略.........
开发者ID:jexmex,项目名称:mainwp-child,代码行数:101,代码来源:class-mainwp-child.php



注:本文中的posix_uname函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP post函数代码示例发布时间:2022-05-15
下一篇:
PHP posix_ttyname函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap