@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
// Invalidate only sessions created AFTER the isolated clone's backup proof. No framework/bootstrap.
|
||||
$root=dirname(__DIR__);$dir=$root.'/storage/app/private/investmoz-v2/portal-audit';
|
||||
$link=json_decode(file_get_contents($dir.'/country-https-backup-latest.json'),true,512,JSON_THROW_ON_ERROR);
|
||||
$proof=json_decode(file_get_contents($link['path']),true,512,JSON_THROW_ON_ERROR);$target=$proof['restored_target'];
|
||||
if((int)$target['port']!==55441||!preg_match('/^country_candidate_\d{8}_\d{6}_test$/D',$target['database']))throw new RuntimeException('Isolated clone required');
|
||||
$pdo=new PDO('pgsql:host=127.0.0.1;port=55441;dbname='.$target['database'],'postgres','',[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]);
|
||||
if($pdo->query('SELECT current_database()')->fetchColumn()!==$target['database']||(int)$pdo->query('SELECT inet_server_port()')->fetchColumn()!==55441)throw new RuntimeException('Identity rejected');
|
||||
$stmt=$pdo->prepare('DELETE FROM sessions WHERE last_activity > :at');$stmt->execute(['at'=>strtotime($proof['verified_at'])]);
|
||||
echo json_encode(['result'=>'QA sessions invalidated','qa_sessions_removed'=>$stmt->rowCount(),'active_writes'=>0]).PHP_EOL;
|
||||
Reference in New Issue
Block a user