Repo for the search and displace core module including the interface to select files and search and displace operations to run on them.
https://searchanddisplace.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.2 KiB
53 lines
1.2 KiB
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Support\Carbon;
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
|
class AnalyzeOperationPerformance
|
|
{
|
|
/**
|
|
* Create the event listener.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the event.
|
|
*
|
|
* @param object $event
|
|
* @return void
|
|
*/
|
|
public function handle($event)
|
|
{
|
|
$redis = Redis::connection();
|
|
|
|
$remainingFiles = $redis->get('analyze_performance_remaining_files');
|
|
$remainingFiles -= 1;
|
|
|
|
if ($remainingFiles === 0) {
|
|
$startedAt = $redis->get('analyze_performance_time');
|
|
$endedAt = Carbon::now()->format('U');
|
|
$directoryPath = $redis->get('analyze_performance_path');
|
|
|
|
if ( ! $directoryPath || ! $startedAt) {
|
|
return;
|
|
}
|
|
|
|
$data = 'Time elapsed in seconds: ' . ($endedAt - $startedAt) . "\n";
|
|
|
|
file_put_contents($directoryPath . '/sd_analyze_performance.txt', $data);
|
|
|
|
return;
|
|
}
|
|
|
|
$redis->set('analyze_performance_remaining_files', $remainingFiles);
|
|
}
|
|
}
|