2024-10-24 15:36:26 +13:00
< ? php namespace Cybercinch ;
2014-08-08 15:06:11 -05:00
use DCarbone\Helpers\FileHelper ;
/**
* Class UglyQueue
2024-10-24 22:38:37 +13:00
* @ package Cybercinch
2014-08-08 15:06:11 -05:00
*/
2014-10-30 10:54:06 -05:00
class UglyQueue implements \Serializable , \SplSubject , \Countable
2014-08-08 15:06:11 -05:00
{
2014-09-29 16:26:53 -05:00
const QUEUE_READONLY = 0 ;
const QUEUE_READWRITE = 1 ;
2015-09-29 11:35:48 -05:00
/** @var int */
private $_notifyStatus ;
/** @var \SplObserver[] */
private $_observers = array ();
2014-08-08 15:06:11 -05:00
2014-09-29 16:26:53 -05:00
/** @var int */
protected $mode = null ;
2014-08-08 15:06:11 -05:00
/** @var string */
2015-09-29 11:35:48 -05:00
protected $baseDir ;
/** @var string */
protected $name ;
2014-08-08 15:06:11 -05:00
/** @var string */
2015-09-29 11:35:48 -05:00
protected $path ;
2014-08-08 15:06:11 -05:00
/** @var bool */
2015-09-29 11:35:48 -05:00
protected $locked = false ;
2014-08-08 15:06:11 -05:00
/** @var resource */
2015-09-29 11:35:48 -05:00
protected $tmpHandle ;
/** @var string */
protected $queueFile ;
/** @var string */
protected $queueTmpFile ;
/** @var string */
protected $lockFile ;
2014-08-08 15:06:11 -05:00
2015-09-30 08:55:18 -05:00
/** @var string */
protected $serializeFile ;
2014-08-08 15:06:11 -05:00
/**
2015-09-29 11:35:48 -05:00
* @ param string $baseDir
2015-09-29 12:08:32 -05:00
* @ param string $name
2015-09-29 11:35:48 -05:00
* @ param \SplObserver [] $observers
2014-08-08 15:06:11 -05:00
*/
2015-09-29 12:08:32 -05:00
public function __construct ( $baseDir , $name , array $observers = array ())
2014-08-08 15:06:11 -05:00
{
2015-09-30 08:55:18 -05:00
$this -> baseDir = realpath ( $baseDir );
2015-09-29 12:08:32 -05:00
$this -> name = $name ;
2015-09-29 11:35:48 -05:00
$this -> _observers = $observers ;
2014-09-29 16:26:53 -05:00
2015-09-30 08:55:18 -05:00
$path = sprintf ( '%s%s%s' , $baseDir , DIRECTORY_SEPARATOR , $name );
2015-09-29 11:35:48 -05:00
if ( ! file_exists ( $path ) && !@ mkdir ( $path ))
throw new \RuntimeException ( 'Unable to initialize queue directory "' . $path . '". Please check permissions.' );
2014-09-29 16:26:53 -05:00
2015-09-29 11:35:48 -05:00
$this -> path = $path ;
2015-09-30 08:55:18 -05:00
$this -> lockFile = sprintf ( '%s%squeue.lock' , $path , DIRECTORY_SEPARATOR );
$this -> queueFile = sprintf ( '%s%squeue.txt' , $path , DIRECTORY_SEPARATOR );
$this -> queueTmpFile = sprintf ( '%s%squeue.tmp' , $path , DIRECTORY_SEPARATOR );
$this -> serializeFile = sprintf ( '%s%sugly-queue.obj' , $path , DIRECTORY_SEPARATOR );
2014-08-08 15:06:11 -05:00
2015-09-30 15:12:35 -05:00
$this -> initialize ();
2015-09-29 11:35:48 -05:00
}
2014-09-29 16:26:53 -05:00
2015-09-29 11:35:48 -05:00
/**
* Destructor
*/
public function __destruct ()
{
$this -> _populateQueue ();
$this -> unlock ();
file_put_contents ( $this -> path . '/ugly-queue.obj' , serialize ( $this ));
2014-09-29 16:26:53 -05:00
}
/**
* @ return string
*/
2015-09-29 11:35:48 -05:00
public function getName ()
2014-09-29 16:26:53 -05:00
{
2015-09-29 11:35:48 -05:00
return $this -> name ;
}
2014-09-29 16:26:53 -05:00
2015-09-29 11:35:48 -05:00
/**
* @ return int
*/
public function getMode ()
{
return $this -> mode ;
}
2014-09-29 16:26:53 -05:00
2015-09-29 11:35:48 -05:00
/**
* @ return string
*/
public function getPath ()
{
return $this -> path ;
}
2014-09-29 16:26:53 -05:00
2015-09-29 11:35:48 -05:00
/**
* @ return string
*/
public function getBaseDir ()
{
return $this -> baseDir ;
2014-08-08 15:06:11 -05:00
}
/**
2015-09-29 11:35:48 -05:00
* @ return string
2014-08-08 15:06:11 -05:00
*/
2015-09-29 11:35:48 -05:00
public function getQueueFile ()
2014-08-08 15:06:11 -05:00
{
2015-09-29 11:35:48 -05:00
return $this -> queueFile ;
}
/**
* @ return string
*/
public function getQueueTmpFile ()
{
return $this -> queueTmpFile ;
}
/**
* @ return string
*/
public function getLockFile ()
{
return $this -> lockFile ;
2014-08-08 15:06:11 -05:00
}
2015-09-30 08:55:18 -05:00
/**
* @ return string
*/
public function getSerializeFile ()
{
return $this -> serializeFile ;
}
2015-09-30 15:12:35 -05:00
/**
* @ return boolean
*/
public function isLocked ()
{
return $this -> locked ;
}
2014-08-08 15:06:11 -05:00
/**
* @ param int $ttl Time to live in seconds
2014-08-10 11:46:06 -05:00
* @ throws \InvalidArgumentException
2014-08-08 15:06:11 -05:00
* @ return bool
*/
public function lock ( $ttl = 250 )
{
2014-08-10 11:46:06 -05:00
if ( ! is_int ( $ttl ))
2014-09-29 16:26:53 -05:00
throw new \InvalidArgumentException ( 'Argument 1 expected to be integer, "' . gettype ( $ttl ) . '" seen' );
2014-08-10 11:46:06 -05:00
2015-09-29 11:35:48 -05:00
if ( $ttl < 1 )
throw new \InvalidArgumentException ( 'Argument 1 expected to be greater than 0 "' . $ttl . '" seen' );
2014-08-10 11:46:06 -05:00
2014-09-29 16:26:53 -05:00
// If there is currently no lock
2015-09-30 15:12:35 -05:00
if ( $this -> isAlreadyLocked () === false )
2014-09-29 16:26:53 -05:00
return $this -> createLockFile ( $ttl );
2014-08-08 15:06:11 -05:00
// If we make it this far, there is already a lock in place.
2015-09-29 11:35:48 -05:00
$this -> locked = false ;
$this -> _notifyStatus = UglyQueueEnum :: QUEUE_LOCKED_BY_OTHER_PROCESS ;
2014-09-29 16:26:53 -05:00
$this -> notify ();
return false ;
2014-08-08 15:06:11 -05:00
}
/**
2014-08-08 17:27:21 -05:00
* Close this ugly queue , writing out contents to file .
2014-08-08 15:06:11 -05:00
*/
public function unlock ()
{
2015-09-30 15:12:35 -05:00
if ( $this -> isLocked () === true )
2014-08-08 15:06:11 -05:00
{
2015-09-29 11:35:48 -05:00
unlink ( $this -> lockFile );
$this -> locked = false ;
2014-09-29 16:26:53 -05:00
2015-09-29 11:35:48 -05:00
$this -> _notifyStatus = UglyQueueEnum :: QUEUE_UNLOCKED ;
2014-09-29 16:26:53 -05:00
$this -> notify ();
2014-08-08 15:06:11 -05:00
}
}
/**
2014-08-10 11:46:06 -05:00
* @ throws \RuntimeException
2014-08-08 15:06:11 -05:00
* @ return bool
*/
2015-09-30 15:12:35 -05:00
public function isAlreadyLocked ()
2014-08-08 15:06:11 -05:00
{
// First check for lock file
2015-09-29 11:35:48 -05:00
if ( is_file ( $this -> lockFile ))
2014-08-08 15:06:11 -05:00
{
2015-09-29 11:35:48 -05:00
$lock = json_decode ( file_get_contents ( $this -> lockFile ), true );
2014-08-08 15:06:11 -05:00
2015-09-29 11:35:48 -05:00
// If the decoded lock file contains a ttl and born value...
if ( isset ( $lock [ 'ttl' ]) && isset ( $lock [ 'born' ]))
{
$lock_ttl = (( int ) $lock [ 'born' ] + ( int ) $lock [ 'ttl' ]);
2014-08-08 15:06:11 -05:00
2015-09-29 11:35:48 -05:00
// If we're within the TTL of the lock, assume another thread is already processing.
// We'll pick it up on the next go around.
if ( $lock_ttl > time ())
return true ;
}
2014-08-08 15:06:11 -05:00
// Else, remove lock file and assume we're good to go!
2015-09-29 11:35:48 -05:00
unlink ( $this -> lockFile );
2014-08-08 15:06:11 -05:00
return false ;
}
// If no file, assume not locked.
return false ;
}
/**
* @ param int $count
* @ throws \RuntimeException
2014-08-10 14:27:00 -05:00
* @ throws \InvalidArgumentException
2014-08-08 15:06:11 -05:00
* @ return bool | array
*/
2015-09-29 11:35:48 -05:00
public function retrieveItems ( $count = 1 )
2014-08-08 15:06:11 -05:00
{
2014-09-29 16:26:53 -05:00
if ( $this -> mode === self :: QUEUE_READONLY )
2015-09-29 11:35:48 -05:00
throw new \RuntimeException ( 'Queue "' . $this -> name . '" cannot be processed. It was started in Read-Only mode (the user running this process does not have permission to write to the queue directory).' );
2014-08-08 15:06:11 -05:00
// If we don't have a lock, assume issue and move on.
2015-09-29 11:35:48 -05:00
if ( $this -> isLocked () === false )
throw new \RuntimeException ( 'Cannot process queue named "' . $this -> name . '". It is locked by another process.' );
2014-08-10 14:27:00 -05:00
// If non-int valid is passed
if ( ! is_int ( $count ))
2014-09-29 16:26:53 -05:00
throw new \InvalidArgumentException ( 'Argument 1 expected to be integer greater than 0, "' . gettype ( $count ) . '" seen' );
2014-08-10 14:27:00 -05:00
// If negative integer passed
if ( $count <= 0 )
2014-09-29 16:26:53 -05:00
throw new \InvalidArgumentException ( 'Argument 1 expected to be integer greater than 0, "' . $count . '" seen' );
2015-09-29 11:35:48 -05:00
if ( $this -> _notifyStatus !== UglyQueueEnum :: QUEUE_PROCESSING )
2014-09-29 16:26:53 -05:00
{
2015-09-29 11:35:48 -05:00
$this -> _notifyStatus = UglyQueueEnum :: QUEUE_PROCESSING ;
2014-09-29 16:26:53 -05:00
$this -> notify ();
}
2014-08-08 15:06:11 -05:00
// Find number of lines in the queue file
2015-09-29 12:08:32 -05:00
$lineCount = count ( $this );
2014-08-08 15:06:11 -05:00
// If queue line count is 0, assume empty
2014-08-10 13:56:15 -05:00
if ( $lineCount === 0 )
2014-08-08 15:06:11 -05:00
return false ;
// Try to open the file for reading / writing.
2015-09-29 11:35:48 -05:00
$queueFileHandle = fopen ( $this -> queueFile , 'r+' );
2014-08-10 13:56:15 -05:00
if ( $queueFileHandle === false )
2014-08-08 15:06:11 -05:00
$this -> unlock ();
// Get an array of the oldest $count data in the queue
$data = array ();
2014-08-10 13:56:15 -05:00
$start_line = $lineCount - $count ;
2014-08-08 15:06:11 -05:00
$i = 0 ;
2024-10-24 16:26:31 +13:00
while (( $line = fscanf ( $queueFileHandle , " %s \t %[^ \n ] " )) !== false && $i < $lineCount )
2014-08-08 15:06:11 -05:00
{
if ( $i ++ >= $start_line )
{
list ( $key , $value ) = $line ;
2015-09-30 15:12:35 -05:00
$data = array ( $key => $value ) + $data ;
2014-08-08 15:06:11 -05:00
}
}
// If we have consumed the rest of the file
2014-08-10 13:56:15 -05:00
if ( $count >= $lineCount )
2014-08-08 15:06:11 -05:00
{
2014-08-10 13:56:15 -05:00
rewind ( $queueFileHandle );
ftruncate ( $queueFileHandle , 0 );
fclose ( $queueFileHandle );
2014-09-29 16:26:53 -05:00
2015-09-29 11:35:48 -05:00
$this -> _notifyStatus = UglyQueueEnum :: QUEUE_REACHED_END ;
2014-09-29 16:26:53 -05:00
$this -> notify ();
2014-08-08 15:06:11 -05:00
}
// Otherwise, create new queue file minus the processed lines.
else
{
2015-09-29 11:35:48 -05:00
$tmp = fopen ( $this -> queueTmpFile , 'w+' );
2014-08-10 13:56:15 -05:00
rewind ( $queueFileHandle );
2014-08-08 15:06:11 -05:00
$i = 0 ;
2014-08-10 13:56:15 -05:00
while (( $line = fgets ( $queueFileHandle )) !== false && $i < $start_line )
2014-08-08 15:06:11 -05:00
{
if ( $line !== " \n " || $line !== " " )
fwrite ( $tmp , $line );
$i ++ ;
}
2014-08-10 13:56:15 -05:00
fclose ( $queueFileHandle );
2014-08-08 15:06:11 -05:00
fclose ( $tmp );
2015-09-29 11:35:48 -05:00
unlink ( $this -> queueFile );
rename ( $this -> queueTmpFile , $this -> queueFile );
2014-08-08 15:06:11 -05:00
}
return $data ;
}
/**
* @ param string $key
* @ param string | array $value
* @ return bool
* @ throws \RuntimeException
*/
2015-09-29 11:35:48 -05:00
public function addItem ( $key , $value )
2014-08-08 15:06:11 -05:00
{
2014-09-29 16:26:53 -05:00
if ( $this -> mode === self :: QUEUE_READONLY )
2015-09-29 11:35:48 -05:00
throw new \RuntimeException ( 'Cannot add item to queue "' . $this -> name . '" as it is in read-only mode' );
2014-08-08 15:06:11 -05:00
// If we don't have a lock, assume issue and move on.
2015-09-30 15:12:35 -05:00
if ( $this -> isLocked () === false )
2015-09-29 11:35:48 -05:00
throw new \RuntimeException ( 'Cannot add item to queue "' . $this -> name . '". Queue is already locked by another process' );
2014-08-08 15:06:11 -05:00
2015-09-29 11:35:48 -05:00
if ( ! is_resource ( $this -> tmpHandle ))
2014-08-08 15:06:11 -05:00
{
2015-09-29 11:35:48 -05:00
$this -> tmpHandle = fopen ( $this -> queueTmpFile , 'w+' );
if ( $this -> tmpHandle === false )
2014-09-29 16:26:53 -05:00
throw new \RuntimeException ( 'Unable to create "queue.tmp" file.' );
2014-08-08 15:06:11 -05:00
}
if ( is_array ( $value ) || $value instanceof \stdClass )
$value = json_encode ( $value );
return ( bool ) fwrite (
2015-09-29 11:35:48 -05:00
$this -> tmpHandle ,
2014-08-08 15:06:11 -05:00
$key . " \t " . str_replace ( array ( " \r \n " , " \n " ), ' ' , $value )
. " \n " );
}
2015-09-30 15:12:35 -05:00
/**
* @ param array $items
*/
public function addItems ( array $items )
{
foreach ( $items as $k => $v )
{
$this -> addItem ( $k , $v );
}
}
2014-08-08 15:06:11 -05:00
/**
* If there is a tmp queue file , add it ' s contents to the beginning of a new queue file
*
* @ return void
*/
2014-08-10 13:56:15 -05:00
public function _populateQueue ()
2014-08-08 15:06:11 -05:00
{
2015-09-29 11:35:48 -05:00
if ( is_resource ( $this -> tmpHandle ))
2014-08-08 15:06:11 -05:00
{
2015-09-29 11:35:48 -05:00
if ( file_exists ( $this -> queueFile ))
2014-08-08 15:06:11 -05:00
{
2015-09-29 11:35:48 -05:00
$queueFileHandle = fopen ( $this -> queueFile , 'r+' );
2014-08-10 13:56:15 -05:00
while (( $line = fgets ( $queueFileHandle )) !== false )
2014-08-08 15:06:11 -05:00
{
if ( $line !== " \n " && $line !== " " )
2015-09-29 11:35:48 -05:00
fwrite ( $this -> tmpHandle , $line );
2014-08-08 15:06:11 -05:00
}
2014-08-10 13:56:15 -05:00
fclose ( $queueFileHandle );
2015-09-29 11:35:48 -05:00
unlink ( $this -> queueFile );
2014-08-08 15:06:11 -05:00
}
2015-09-29 11:35:48 -05:00
fclose ( $this -> tmpHandle );
rename ( $this -> queueTmpFile , $this -> queueFile );
2014-08-08 15:06:11 -05:00
}
}
2014-08-08 18:09:45 -05:00
/**
* @ param string $key
* @ return bool
* @ throws \RuntimeException
*/
public function keyExistsInQueue ( $key )
{
$key = ( string ) $key ;
// Try to open the file for reading / writing.
2015-09-29 11:35:48 -05:00
$queueFileHandle = fopen ( $this -> queueFile , 'r' );
2014-08-08 18:09:45 -05:00
2014-09-29 17:02:28 -05:00
while (( $line = fscanf ( $queueFileHandle , " %s \t %s \n " )) !== false )
2014-08-08 18:09:45 -05:00
{
2015-09-29 11:35:48 -05:00
if ( $key === $line [ 0 ])
2014-08-08 18:09:45 -05:00
{
2014-08-10 13:56:15 -05:00
fclose ( $queueFileHandle );
2014-08-08 18:09:45 -05:00
return true ;
}
}
2014-08-10 13:56:15 -05:00
fclose ( $queueFileHandle );
2014-08-08 18:09:45 -05:00
return false ;
}
2014-08-10 10:52:59 -05:00
2014-10-30 10:54:06 -05:00
/**
* ( PHP 5 >= 5.1 . 0 )
* Count elements of an object
* @ link http :// php . net / manual / en / countable . count . php
*
* @ return int The custom count as an integer .
*/
public function count ()
{
2015-09-29 11:35:48 -05:00
return ( int ) FileHelper :: getLineCount ( $this -> queueFile );
2014-10-30 10:54:06 -05:00
}
2014-08-11 12:24:05 -05:00
/**
2014-09-29 16:26:53 -05:00
* ( PHP 5 >= 5.1 . 0 )
* String representation of object
* @ link http :// php . net / manual / en / serializable . serialize . php
*
* @ return string the string representation of the object or null
2014-08-11 12:42:17 -05:00
*/
2014-09-29 16:26:53 -05:00
public function serialize ()
2014-08-11 12:42:17 -05:00
{
2015-09-30 15:12:35 -05:00
return serialize (
array (
$this -> baseDir ,
$this -> name ,
$this -> path ,
$this -> queueFile ,
$this -> queueTmpFile ,
$this -> lockFile ,
$this -> serializeFile ,
)
);
2014-08-11 12:24:05 -05:00
}
2014-08-10 10:52:59 -05:00
/**
2014-09-29 16:26:53 -05:00
* ( PHP 5 >= 5.1 . 0 )
* Constructs the object
* @ link http :// php . net / manual / en / serializable . unserialize . php
*
* @ param string $serialized The string representation of the object .
* @ return void
2014-08-10 10:52:59 -05:00
*/
2014-09-29 16:26:53 -05:00
public function unserialize ( $serialized )
2014-08-10 10:52:59 -05:00
{
2014-09-29 16:26:53 -05:00
$data = unserialize ( $serialized );
2015-09-30 15:12:35 -05:00
$this -> baseDir = $data [ 0 ];
$this -> name = $data [ 1 ];
$this -> path = $data [ 2 ];
$this -> queueFile = $data [ 3 ];
$this -> queueTmpFile = $data [ 4 ];
$this -> lockFile = $data [ 5 ];
$this -> serializeFile = $data [ 6 ];
$this -> initialize ();
2014-08-10 10:52:59 -05:00
}
/**
2014-09-29 16:26:53 -05:00
* ( PHP 5 >= 5.1 . 0 )
* Attach an SplObserver
* @ link http :// php . net / manual / en / splsubject . attach . php
*
* @ param \SplObserver $observer The SplObserver to attach .
* @ return void
2014-08-10 10:52:59 -05:00
*/
2014-09-29 16:26:53 -05:00
public function attach ( \SplObserver $observer )
2014-08-10 10:52:59 -05:00
{
2015-09-29 11:35:48 -05:00
if ( ! in_array ( $observer , $this -> _observers ))
$this -> _observers [] = $observer ;
2014-08-10 10:52:59 -05:00
}
/**
2014-09-29 16:26:53 -05:00
* ( PHP 5 >= 5.1 . 0 )
* Detach an observer
* @ link http :// php . net / manual / en / splsubject . detach . php
*
* @ param \SplObserver $observer The SplObserver to detach .
* @ return void
2014-08-10 10:52:59 -05:00
*/
2014-09-29 16:26:53 -05:00
public function detach ( \SplObserver $observer )
2014-08-10 10:52:59 -05:00
{
2015-09-29 11:35:48 -05:00
$idx = array_search ( $observer , $this -> _observers , true );
2014-09-29 16:26:53 -05:00
if ( $idx !== false )
2015-09-29 11:35:48 -05:00
unset ( $this -> _observers [ $idx ]);
2014-08-10 10:52:59 -05:00
}
/**
2014-09-29 16:26:53 -05:00
* ( PHP 5 >= 5.1 . 0 )
* Notify an observer
* @ link http :// php . net / manual / en / splsubject . notify . php
*
* @ return void
2014-08-10 10:52:59 -05:00
*/
2014-09-29 16:26:53 -05:00
public function notify ()
2014-08-10 10:52:59 -05:00
{
2015-09-29 11:35:48 -05:00
foreach ( $this -> _observers as $observer )
2014-09-29 16:26:53 -05:00
{
2015-09-29 11:35:48 -05:00
$observer -> update ( $this );
2014-09-29 16:26:53 -05:00
}
2014-08-10 10:52:59 -05:00
}
2015-09-30 08:55:18 -05:00
2015-09-30 15:12:35 -05:00
/**
* This method is mostly intended to check the " validity " of a re - initialized queue
*
* Could probably stand to be improved .
*
* @ return bool
*/
public function _valid ()
{
return (
$this -> baseDir !== null &&
$this -> name !== null &&
$this -> path !== null &&
$this -> queueFile !== null &&
$this -> queueTmpFile !== null &&
$this -> lockFile !== null &&
$this -> serializeFile !== null
);
}
2015-09-30 08:55:18 -05:00
// --------
/**
* @ param int $ttl seconds to live
* @ return bool
*/
protected function createLockFile ( $ttl )
{
$ok = ( bool ) @ file_put_contents (
$this -> lockFile ,
json_encode ( array ( 'ttl' => $ttl , 'born' => time ())));
if ( $ok !== true )
{
$this -> _notifyStatus = UglyQueueEnum :: QUEUE_FAILED_TO_LOCK ;
$this -> notify ();
return $this -> locked = false ;
}
$this -> locked = true ;
$this -> _notifyStatus = UglyQueueEnum :: QUEUE_LOCKED ;
$this -> notify ();
return true ;
}
2015-09-30 15:12:35 -05:00
/**
* Post - construct initialization method .
*
* Also used post - un - serialization
*/
protected function initialize ()
{
if ( is_readable ( $this -> path ) && is_writable ( $this -> path ))
$this -> mode = self :: QUEUE_READWRITE ;
else if ( is_readable ( $this -> path ))
$this -> mode = self :: QUEUE_READONLY ;
if ( ! file_exists ( $this -> path . '/index.html' ))
{
if ( $this -> mode === self :: QUEUE_READONLY )
throw new \RuntimeException ( 'Cannot initialize queue with name "' . $this -> name . '", the user lacks permission to create files.' );
$html = <<< HTML
< html >
< head >
< title > 403 Forbidden </ title >
</ head >
< body >
< p > Directory access is forbidden .</ p >
</ body >
</ html >
HTML ;
file_put_contents ( $this -> path . '/index.html' , $html );
}
if ( ! file_exists ( $this -> queueFile ))
{
if ( $this -> mode === self :: QUEUE_READONLY )
throw new \RuntimeException ( 'Cannot initialize queue with name "' . $this -> name . '", the user lacks permission to create files.' );
file_put_contents ( $this -> queueFile , '' );
}
$this -> _notifyStatus = UglyQueueEnum :: QUEUE_INITIALIZED ;
$this -> notify ();
}
2014-08-08 15:06:11 -05:00
}