Ignore:
Timestamp:
Nov 24, 2014 4:27:40 PM (10 years ago)
Author:
dungnv
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/helpers/lockfile_helper.php

    r619 r620  
    33if ( ! function_exists('createLockFile'))
    44{
    5         function createLockFile ($lockFilePrefix, $maxReach, $timeToUnlock, $colSep = '|', $lockFilePath = '')
     5        function createLockFile ($lockFilePrefix, $maxReach, $timeToUnlock, $lockFilePath = '', $checkLockOnly = 0, $colSep = '|')
    66        {
    77                $currentTimeStamp = time();
     
    2424                $timeDiffMin = $lastTimeLock != '' ? dateDifference(date('Y-m-d H:i:s',$currentTimeStamp), date('Y-m-d H:i:s',$lastTimeLock), '%i') : 0;
    2525       
    26                 if ($lockCount < $maxReach && $timeDiffMin < $timeToUnlock) {
     26                if ($lockCount < $maxReach && $timeDiffMin < $timeToUnlock && $checkLockOnly == 0) {
    2727                        $lockCount ++;
    2828                        $isLocked = $lockCount < $maxReach ? 0:1;
     
    3737                $lockTime = ($isLocked == 1) ? $lastTimeLock : $currentTimeStamp;
    3838                $content = $lockCount . $colSep . $lockTime . $colSep . $isLocked;
    39                 if($ready == 1) {
     39               
     40                if($ready == 1 && $checkLockOnly == 0) {
    4041                        $fh = fopen ($filePath,'w');
    4142                        fwrite ($fh, $content);
     
    4344                }
    4445       
    45                 return $lockCount;
     46                return $isLocked;
    4647        }
    4748}
Note: See TracChangeset for help on using the changeset viewer.