当前位置: 首页>>代码示例>>PHP>>正文


PHP Lock函数代码示例

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


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

示例1: HandleApprove

function HandleApprove($pagename, $auth='edit') {
  global $ApproveUrlPattern,$WhiteUrlPatterns,$ApprovedUrlPagesFmt,$action;
  Lock(2);
  $page = ReadPage($pagename);
  $text = preg_replace('/[()]/','',$page['text']);
  preg_match_all("/$ApproveUrlPattern/",$text,$match);
  ReadApprovedUrls($pagename);
  $addpat = array();
  foreach($match[0] as $a) {
    if ($action=='approvesites') 
      $a=preg_replace("!^([^:]+://[^/]+).*$!",'$1',$a);
    $addpat[] = $a;
  }
  if (count($addpat)>0) {
    $aname = FmtPageName($ApprovedUrlPagesFmt[0],$pagename);
    $apage = RetrieveAuthPage($aname, $auth);
    if (!$apage) Abort("?cannot edit $aname");
    $new = $apage;
    if (substr($new['text'],-1,1)!="\n") $new['text'].="\n";
    foreach($addpat as $a) {
      foreach((array)$WhiteUrlPatterns as $pat)
        if (preg_match("!^$pat(/|$)!i",$a)) continue 2;
      $urlp = preg_quote($a,'!');
      $WhiteUrlPatterns[] = $urlp;
      $new['text'].="  $a\n";
    }
    $_POST['post'] = 'y';
    PostPage($aname,$apage,$new);
  }
  Redirect($pagename);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:31,代码来源:urlapprove.php

示例2: HandleApprove

function HandleApprove($pagename)
{
    global $ApproveUrlPattern, $WhiteUrlPatterns, $ApprovedUrlPagesFmt, $action;
    Lock(2);
    $page = ReadPage($pagename);
    $text = preg_replace('/[()]/', '', $page['text']);
    preg_match_all("/{$ApproveUrlPattern}/", $text, $match);
    ReadApprovedUrls($pagename);
    $addpat = array();
    foreach ($match[0] as $a) {
        foreach ((array) $WhiteUrlPatterns as $pat) {
            if (preg_match("!^{$pat}(/|\$)!", $a)) {
                continue 2;
            }
        }
        if ($action == 'approvesites') {
            $a = preg_replace("!^([^:]+://[^/]+).*\$!", '$1', $a);
        }
        $addpat[] = $a;
    }
    if (count($addpat) > 0) {
        $aname = FmtPageName($ApprovedUrlPagesFmt[0], $pagename);
        $apage = ReadPage($aname, '');
        $new = $apage;
        if (substr($new['text'], -1, 1) != "\n") {
            $new['text'] .= "\n";
        }
        foreach ($addpat as $pat) {
            $new['text'] .= "  {$pat}\n";
        }
        $_REQUEST['post'] = 'y';
        PostPage($aname, $apage, $new);
    }
    Redirect($pagename);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:35,代码来源:urlapprove.php

示例3: PSS_GetCacheEntry

/**
* Get a cached test result
*/
function PSS_GetCacheEntry($url)
{
    $id = null;
    $cache_lock = Lock("PSS Cache");
    if (isset($cache_lock)) {
        if (is_file('./tmp/pss.cache')) {
            $cache = json_decode(file_get_contents('./tmp/pss.cache'), true);
            // delete stale cache entries
            $now = time();
            $dirty = false;
            foreach ($cache as $cache_key => &$cache_entry) {
                if ($cache_entry['expires'] < $now) {
                    $dirty = true;
                    unset($cache[$cache_key]);
                }
            }
            if ($dirty) {
                file_put_contents('./tmp/pss.cache', json_encode($cache));
            }
            $key = md5($url);
            if (array_key_exists($key, $cache) && array_key_exists('id', $cache[$key])) {
                $id = $cache[$key]['id'];
            }
        }
        Unlock($cache_lock);
    }
    return $id;
}
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:31,代码来源:get_pss_cached_test.php

示例4: TSViewCreate

function TSViewCreate($server, $tsview_name, &$metrics)
{
    $needs_update = false;
    if (!is_dir('./dat')) {
        mkdir('./dat', 0777, true);
    }
    $def = './dat/tsview-' . sha1($tsview_name) . '.json';
    $lock = Lock("TSView {$tsview_name}");
    if (isset($lock)) {
        if (is_file($def)) {
            $current = json_decode(file_get_contents($def), true);
        }
        if (!isset($current) || !is_array($current)) {
            $current = array();
        }
        foreach ($metrics as $metric => $x) {
            if (!array_key_exists($metric, $current)) {
                $needs_update = true;
                $current[$metric] = 1;
            }
        }
        if ($needs_update) {
            $data = array('names' => array());
            foreach ($current as $metric => $x) {
                $data['names'][] = $metric;
            }
            $body = json_encode($data);
            if (http_put_raw("{$server}{$tsview_name}", $body)) {
                file_put_contents($def, json_encode($current));
            }
        }
        Unlock($lock);
    }
}
开发者ID:sethblanchard,项目名称:webpagetest,代码行数:34,代码来源:tsview.inc.php

示例5: CheckIp

/**
* For each IP/Installer pair, keep track of the last 4 checks and if they
* were within the last hour fail the request.
* 
* @param mixed $installer
*/
function CheckIp($installer)
{
    $ok = true;
    $ip = $_SERVER["REMOTE_ADDR"];
    if (isset($ip) && strlen($ip)) {
        $lock = Lock("Installers", true, 5);
        if ($lock) {
            $now = time();
            $file = "./tmp/installers.dat";
            if (gz_is_file($file)) {
                $history = json_decode(gz_file_get_contents($file), true);
            }
            if (!isset($history) || !is_array($history)) {
                $history = array();
            }
            if (isset($history[$ip])) {
                if (isset($history[$ip][$installer])) {
                    $history[$ip][$installer][] = $now;
                    if (count($history[$ip][$installer]) > 10) {
                        array_shift($history[$ip][$installer]);
                    }
                    if (isset($history[$ip]["last-{$installer}"]) && $now - $history[$ip]["last-{$installer}"] < 3600) {
                        $count = 0;
                        foreach ($history[$ip][$installer] as $time) {
                            if ($now - $time < 3600) {
                                $count++;
                            }
                        }
                        if ($count > 4) {
                            $ok = false;
                        }
                    }
                } else {
                    $history[$ip][$installer] = array($now);
                }
            } else {
                $history[$ip] = array($installer => array($now));
            }
            $history[$ip]['last'] = $now;
            if ($ok) {
                $history[$ip]["last-{$installer}"] = $now;
            }
            // prune any agents that haven't connected in 7 days
            foreach ($history as $agent => $info) {
                if ($now - $info['last'] > 604800) {
                    unset($history[$agent]);
                }
            }
            gz_file_put_contents($file, json_encode($history));
            Unlock($lock);
        }
    }
    return $ok;
}
开发者ID:jonas-krummenacher,项目名称:webpagetest,代码行数:60,代码来源:check_installer.php

示例6: HandlePostRename

function HandlePostRename($pagename)
{
    global $RedirectToRenameFmt, $GroupPattern, $WikiWordPattern;
    $newpagename = MakePageName($pagename, stripmagic($_POST['group'] . '.' . $_POST['renametext']));
    if (PageExists($newpagename)) {
        Abort("'{$newpagename}' already exists");
    } else {
        Lock(2);
        $page = RetrieveAuthPage($pagename, "edit");
        if ($page) {
            $ntext = $page['text'];
        } else {
            Abort("cannot get '{$pagename}'");
        }
        $ogroup = FmtPageName('$Group', $pagename);
        $ngroup = FmtPageName('$Group', $newpagename);
        #    Abort('stop for testing');
        if ($_POST['addgroup']) {
            if ($_POST['addgroup'] == 'new') {
                $h = $ogroup;
                $ogroup = $ngroup;
                $ngroup = $h;
            }
            if ($ogroup == $ngroup) {
                $ngroup = $ngroup . '1';
            }
            $ntext = preg_replace("/(\\[[=@].*?[=@]\\])|(\\[\\[[^#].*?\\]\\])|([`:\\/])?\\b(({$GroupPattern}([\\/.]))?{$WikiWordPattern})/e", 'QualifyUnqualifiedLinks($ngroup,$ogroup,"$0")', $ntext);
            #        Abort(str_replace("\n",'<br/>',str_replace("\n\n",'</p><p>',$ntext)));
            #        $page = RetrieveAuthPage($newpagename,"edit");
        }
        $page['text'] = $ntext;
        WritePage($newpagename, $page);
        $page['text'] = str_replace('$RenameText', $newpagename, $RedirectToRenameFmt);
        WritePage($pagename, $page);
    }
    Redirect($pagename);
}
开发者ID:jefmud,项目名称:pmwiki-kit-bootstrap-compass,代码行数:37,代码来源:rename.php

示例7: HandlePostAttr

function HandlePostAttr($pagename, $auth = 'attr') {
  global $PageAttributes, $EnablePostAttrClearSession;
  Lock(2);
  $page = RetrieveAuthPage($pagename, $auth, true);
  if (!$page) { Abort("?unable to read $pagename"); }
  foreach($PageAttributes as $attr=>$p) {
    $v = stripmagic(@$_POST[$attr]);
    if ($v == '') continue;
    if ($v=='clear') unset($page[$attr]);
    else if (strncmp($attr, 'passwd', 6) != 0) $page[$attr] = $v;
    else {
      $a = array();
      preg_match_all('/"[^"]*"|\'[^\']*\'|\\S+/', $v, $match);
      foreach($match[0] as $pw) 
        $a[] = preg_match('/^(@|\\w+:)/', $pw) ? $pw 
                   : crypt(preg_replace('/^([\'"])(.*)\\1$/', '$2', $pw));
      if ($a) $page[$attr] = implode(' ',$a);
    }
  }
  WritePage($pagename,$page);
  Lock(0);
  if (IsEnabled($EnablePostAttrClearSession, 1)) {
    @session_start();
    unset($_SESSION['authid']);
    unset($_SESSION['authlist']);
    $_SESSION['authpw'] = array();
  }
  Redirect($pagename);
  exit;
} 
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:30,代码来源:pmwiki.php

示例8: PSS_TestSubmitted

/**
* Cache the test ID in the case of multiple submits
*/
function PSS_TestSubmitted(&$test)
{
    if (array_key_exists('id', $test) && array_key_exists('url', $test)) {
        $now = time();
        $cache_time = 10080;
        // 7 days (in minutes)
        if (array_key_exists('cache', $_REQUEST) && $_REQUEST['cache'] > 0) {
            $cache_time = (int) $_REQUEST['cache'];
        }
        $expires = $now + $cache_time * 60;
        $entry = array('id' => $test['id'], 'expires' => $expires);
        $key = md5($test['url']);
        // update the cache
        $cache_lock = Lock("PSS Cache");
        if (isset($cache_lock)) {
            if (is_file('./tmp/pss.cache')) {
                $cache = json_decode(file_get_contents('./tmp/pss.cache'), true);
            } else {
                $cache = array();
            }
            // delete stale cache entries
            foreach ($cache as $cache_key => &$cache_entry) {
                if ($cache_entry['expires'] < $now) {
                    unset($cache[$cache_key]);
                }
            }
            $cache[$key] = $entry;
            file_put_contents('./tmp/pss.cache', json_encode($cache));
            Unlock($cache_lock);
        }
    }
}
开发者ID:ceeaspb,项目名称:webpagetest,代码行数:35,代码来源:pss.php

示例9: HandleRss

function HandleRss($pagename)
{
    global $RssMaxItems, $RssSourceSize, $RssDescSize, $RssChannelFmt, $RssChannelDesc, $RssTimeFmt, $RssChannelBuildDate, $RssItemsRDFList, $RssItemsRDFListFmt, $RssItems, $RssItemFmt, $HandleRssFmt, $FmtV;
    $t = ReadTrail($pagename, $pagename);
    $page = RetrieveAuthPage($pagename, 'read', false);
    if (!$page) {
        Abort("?cannot read {$pagename}");
    }
    $cbgmt = $page['time'];
    $r = array();
    for ($i = 0; $i < count($t) && count($r) < $RssMaxItems; $i++) {
        if (!PageExists($t[$i]['pagename'])) {
            continue;
        }
        $page = RetrieveAuthPage($t[$i]['pagename'], 'read', false);
        Lock(0);
        if (!$page) {
            continue;
        }
        $text = MarkupToHTML($t[$i]['pagename'], substr($page['text'], 0, $RssSourceSize));
        $text = entityencode(preg_replace("/<.*?>/s", "", $text));
        preg_match("/^(.{0,{$RssDescSize}}\\s)/s", $text, $match);
        $r[] = array('name' => $t[$i]['pagename'], 'time' => $page['time'], 'desc' => $match[1] . " ...", 'author' => $page['author']);
        if ($page['time'] > $cbgmt) {
            $cbgmt = $page['time'];
        }
    }
    SDV($RssChannelBuildDate, entityencode(gmdate('D, d M Y H:i:s \\G\\M\\T', $cbgmt)));
    SDV($RssChannelDesc, entityencode(FmtPageName('$Group.$Title', $pagename)));
    foreach ($r as $page) {
        $FmtV['$RssItemPubDate'] = gmstrftime($RssTimeFmt, $page['time']);
        $FmtV['$RssItemDesc'] = $page['desc'];
        $FmtV['$RssItemAuthor'] = $page['author'];
        $RssItemsRDFList[] = entityencode(FmtPageName($RssItemsRDFListFmt, $page['name']));
        $RssItems[] = entityencode(FmtPageName($RssItemFmt, $page['name']));
    }
    header("Content-type: text/xml");
    PrintFmt($pagename, $HandleRssFmt);
    exit;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:40,代码来源:rss.php

示例10: array_shift

             array_shift($tests['times']);
         }
         // update the number of high-priority "page loads" that we think are in the queue
         if (array_key_exists('tests', $tests) && $testInfo['priority'] == 0) {
             $tests['tests'] = max(0, $tests['tests'] - $testCount);
         }
         file_put_contents("./tmp/{$location}.tests", json_encode($tests));
     }
     UnlockLocation($lock);
 }
 // see if it is an industry benchmark test
 if (array_key_exists('industry', $ini) && array_key_exists('industry_page', $ini) && strlen($ini['industry']) && strlen($ini['industry_page'])) {
     if (!is_dir('./video/dat')) {
         mkdir('./video/dat', 0777, true);
     }
     $indLock = Lock("Industry Video");
     if (isset($indLock)) {
         // update the page in the industry list
         $ind;
         $data = file_get_contents('./video/dat/industry.dat');
         if ($data) {
             $ind = json_decode($data, true);
         }
         $update = array();
         $update['id'] = $id;
         $update['last_updated'] = $now;
         $ind[$ini['industry']][$ini['industry_page']] = $update;
         $data = json_encode($ind);
         file_put_contents('./video/dat/industry.dat', $data);
         Unlock($indLock);
     }
开发者ID:krishnakanthpps,项目名称:webpagetest,代码行数:31,代码来源:workdone.php

示例11: ImportBenchmarkRun

function ImportBenchmarkRun($benchmark, $epoch, &$test_data)
{
    global $error;
    $lock = Lock("Benchmark {$benchmark} Cron", true, 86400);
    if (isset($lock)) {
        if (!is_dir("./results/benchmarks/{$benchmark}")) {
            mkdir("./results/benchmarks/{$benchmark}", 0777, true);
        }
        if (is_file("./results/benchmarks/{$benchmark}/state.json")) {
            $state = json_decode(file_get_contents("./results/benchmarks/{$benchmark}/state.json"), true);
        } else {
            $state = array('running' => false, 'needs_aggregation' => false, 'runs' => array());
        }
        $state['running'] = true;
        $state['last_run'] = $epoch;
        $state['tests'] = array();
        foreach ($test_data as $test) {
            $test['submitted'] = $epoch;
            $state['tests'][] = $test;
        }
        file_put_contents("./results/benchmarks/{$benchmark}/state.json", json_encode($state));
        Unlock($lock);
        // kick off the collection and aggregation of the results
        $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || isset($_SERVER['HTTP_SSL']) && $_SERVER['HTTP_SSL'] == 'On' ? 'https' : 'http';
        $host = $_SERVER['HTTP_HOST'];
        $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
        $cron = "{$protocol}://{$host}{$uri}/benchmarks/cron.php?benchmark=" . urlencode($benchmark);
        file_get_contents($cron);
    }
}
开发者ID:Pankajchandan,项目名称:WPT-server,代码行数:30,代码来源:import_benchmark.php

示例12: CheckCron

/**
* Send a quick http request locally if we need to process cron events (to each of the cron entry points)
* 
* This only runs events on 15-minute intervals and tries to keep it close to the clock increments (00, 15, 30, 45)
* 
*/
function CheckCron()
{
    // open and lock the cron job file - abandon quickly if we can't get a lock
    $should_run = false;
    $minutes15 = false;
    $minutes60 = false;
    $cron_lock = Lock("Cron Check", false, 1200);
    if (isset($cron_lock)) {
        $last_run = 0;
        if (is_file('./tmp/wpt_cron.dat')) {
            $last_run = file_get_contents('./tmp/wpt_cron.dat');
        }
        $now = time();
        $elapsed = $now - $last_run;
        if (!$last_run) {
            $should_run = true;
            $minutes15 = true;
            $minutes60 = true;
        } elseif ($elapsed > 120) {
            if ($elapsed > 1200) {
                // if it has been over 20 minutes, run regardless of the wall-clock time
                $should_run = true;
            } else {
                $minute = gmdate('i', $now) % 5;
                if ($minute < 2) {
                    $should_run = true;
                    $minute = gmdate('i', $now) % 15;
                    if ($minute < 2) {
                        $minutes15 = true;
                    }
                    $minute = gmdate('i', $now) % 60;
                    if ($minute < 2) {
                        $minutes60 = true;
                    }
                }
            }
        }
        if ($should_run) {
            file_put_contents('./tmp/wpt_cron.dat', $now);
        }
        Unlock($cron_lock);
    }
    // send the cron requests
    if ($should_run) {
        if (is_file('./settings/benchmarks/benchmarks.txt') && is_file('./benchmarks/cron.php')) {
            SendAsyncRequest('/benchmarks/cron.php');
        }
        SendAsyncRequest('/cron/5min.php');
        if (is_file('./jpeginfo/cleanup.php')) {
            SendAsyncRequest('/jpeginfo/cleanup.php');
        }
        if ($minutes15) {
            SendAsyncRequest('/cron/15min.php');
        }
        if ($minutes60) {
            SendAsyncRequest('/cron/hourly.php');
        }
    }
}
开发者ID:nowol79,项目名称:webpagetest-1,代码行数:65,代码来源:getwork.php

示例13: SaveCachedDevToolsRequests

/**
 * @param TestPaths $localPaths Paths for step or run to save the cached data
 * @param array $requests The requests to save
 * @param array $pageData The page data to save
 * @param int $ver Cache version
 */
function SaveCachedDevToolsRequests($localPaths, &$requests, &$pageData, $ver)
{
    $cacheFile = $localPaths->devtoolsRequestsCacheFile($ver);
    $lock = Lock($cacheFile);
    if (isset($lock)) {
        if (gz_is_file($cacheFile)) {
            $cache = json_decode(gz_file_get_contents($cacheFile), true);
        }
        if (!isset($cache) || !is_array($cache)) {
            $cache = array();
        }
        $cache['requests'] = $requests;
        $cache['pageData'] = $pageData;
        gz_file_put_contents($cacheFile, json_encode($cache));
        Unlock($lock);
    }
}
开发者ID:lucasRolff,项目名称:webpagetest,代码行数:23,代码来源:devtools.inc.php

示例14: NotifyUpdate

function NotifyUpdate($pagename, $dir = '')
{
    global $NotifyList, $NotifyListPageFmt, $NotifyFile, $IsPagePosted, $FmtV, $NotifyTimeFmt, $NotifyItemFmt, $SearchPatterns, $NotifySquelch, $NotifyDelay, $Now, $NotifySubjectFmt, $NotifyBodyFmt, $NotifyHeaders, $NotifyParameters;
    $abort = ignore_user_abort(true);
    if ($dir) {
        flush();
        chdir($dir);
    }
    $GLOBALS['EnableRedirect'] = 0;
    ##   Read in the current notify configuration
    $pn = FmtPageName($NotifyListPageFmt, $pagename);
    $npage = ReadPage($pn, READPAGE_CURRENT);
    preg_match_all('/^[\\s*:#->]*(notify[:=].*)/m', $npage['text'], $nlist);
    $nlist = array_merge((array) @$NotifyList, (array) @$nlist[1]);
    if (!$nlist) {
        return;
    }
    ##   make sure other processes are locked out
    Lock(2);
    ##   let's load the current .notifylist table
    $nfile = FmtPageName($NotifyFile, $pagename);
    $nfp = @fopen($nfile, 'r');
    if ($nfp) {
        ##   get our current squelch and delay timestamps
        clearstatcache();
        $sz = filesize($nfile);
        list($nextevent, $firstpost) = explode(' ', rtrim(fgets($nfp, $sz)));
        ##   restore our notify array
        $notify = unserialize(fgets($nfp, $sz));
        fclose($nfp);
    }
    if (!is_array($notify)) {
        $notify = array();
    }
    ##   if this is for a newly posted page, get its information
    if ($IsPagePosted) {
        $page = ReadPage($pagename, READPAGE_CURRENT);
        $FmtV['$PostTime'] = strftime($NotifyTimeFmt, $Now);
        $item = urlencode(FmtPageName($NotifyItemFmt, $pagename));
        if ($firstpost < 1) {
            $firstpost = $Now;
        }
    }
    foreach ($nlist as $n) {
        $opt = ParseArgs($n);
        $mailto = preg_split('/[\\s,]+/', $opt['notify']);
        if (!$mailto) {
            continue;
        }
        if ($opt['squelch']) {
            foreach ($mailto as $m) {
                $squelch[$m] = $opt['squelch'];
            }
        }
        if (!$IsPagePosted) {
            continue;
        }
        if ($opt['link']) {
            $link = MakePageName($pagename, $opt['link']);
            if (!preg_match("/(^|,){$link}(,|\$)/i", $page['targets'])) {
                continue;
            }
        }
        $pats = @(array) $SearchPatterns[$opt['list']];
        if ($opt['group']) {
            $pats[] = FixGlob($opt['group'], '$1$2.*');
        }
        if ($opt['name']) {
            $pats[] = FixGlob($opt['name'], '$1*.$2');
        }
        if ($pats && !MatchPageNames($pagename, $pats)) {
            continue;
        }
        if ($opt['trail']) {
            $trail = ReadTrail($pagename, $opt['trail']);
            for ($i = 0; $i < count($trail); $i++) {
                if ($trail[$i]['pagename'] == $pagename) {
                    break;
                }
            }
            if ($i >= count($trail)) {
                continue;
            }
        }
        foreach ($mailto as $m) {
            $notify[$m][] = $item;
        }
    }
    $nnow = time();
    if ($nnow < $firstpost + $NotifyDelay) {
        $nextevent = $firstpost + $NotifyDelay;
    } else {
        $firstpost = 0;
        $nextevent = $nnow + 86400;
        $mailto = array_keys($notify);
        $subject = FmtPageName($NotifySubjectFmt, $pagename);
        $body = FmtPageName($NotifyBodyFmt, $pagename);
        foreach ($mailto as $m) {
            $msquelch = @$notify[$m]['lastmail'] + (@$squelch[$m] ? $squelch[$m] : $NotifySquelch);
            if ($nnow < $msquelch) {
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:101,代码来源:notify.php

示例15: chdir

<?php

chdir('..');
$MIN_DAYS = 7;
include 'common.inc';
require_once 'archive.inc';
ignore_user_abort(true);
set_time_limit(86400);
// only allow it to run for 1 day
// bail if we are already running
$lock = Lock("Archive 2", false, 86400);
if (!isset($lock)) {
    echo "Archive2 process is already running\n";
    exit(0);
}
$archive_dir = null;
if (array_key_exists('archive_dir', $settings)) {
    $archive_dir = $settings['archive_dir'];
}
$archive2_dir = null;
if (array_key_exists('archive2_dir', $settings)) {
    $archive2_dir = $settings['archive2_dir'];
}
if (array_key_exists('archive2_days', $settings)) {
    $MIN_DAYS = $settings['archive2_days'];
}
$MIN_DAYS = max($MIN_DAYS, 1);
$UTC = new DateTimeZone('UTC');
$now = time();
// Archive each day of archives to long-term storage
if (isset($archive_dir) && strlen($archive_dir) && isset($archive2_dir) && strlen($archive2_dir)) {
开发者ID:Pankajchandan,项目名称:WPT-server,代码行数:31,代码来源:archive2.php


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