RabbitMq.php
/**
     * Checks if backup file exist and connection estableshed and restores data to queue 
     * @return int count of restored messages
     */
Checks if backup file exist and connection estableshed and restores data to queue
@return int count of restored messages
Checks if backup file exist and connection estableshed and restores data to queue @return int count of restored messages
public function restoreFromBackupFile()
    {
        if (!$this->isConnected() || empty($this->file) || !is_file($this->file) || filesize($this->file) == 0) {
            return 0;
        }
        $newFileName = $this->file.'_'.date('Ymdhis');
        if (!rename($this->file, $newFileName)) {
            return 0;
        }
        if ($fp = fopen($newFileName, "r")) {
            $count = 0;
            while (($data = fgets($fp)) !== false) {
                $this->publish($data);
                $count++;
            }
            fclose($fp);
            unlink($newFileName);
            return $count;
        }
    }
public function restoreFromBackupFile ( ) { if ( ! $ this -> isConnected ( ) || empty ( $ this -> file ) || ! is_file ( $ this -> file ) || filesize ( $ this -> file ) == 0 ) { return 0 ; } $ newFileName = $ this -> file . '_' . date ( 'Ymdhis' ) ; if ( ! rename ( $ this -> file , $ newFileName ) ) { return 0 ; } if ( $ fp = fopen ( $ newFileName , " r " ) ) { $ count = 0 ; while ( ( $ data = fgets ( $ fp ) ) !== false ) { $ this -> publish ( $ data ) ; $ count ++ ; } fclose ( $ fp ) ; unlink ( $ newFileName ) ; return $ count ; } }
Checks if backup file exist and connection estableshed and restores data to queue
 @return int count of restored messages
Checks if backup file exist and connection estableshed and restores data to queue @return int count of restored messages