HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/panomity.de/vr.panomity.com/api/generate-pois.php
<?php
/**
 * Batch: POIs für alle sichtbaren Szenen über GPUQ erzeugen (CLI).
 * Usage: php generate-pois.php [--force] [--pano=ID]
 */

if (PHP_SAPI !== 'cli') {
    die("CLI only\n");
}

require_once __DIR__ . '/gpuq_client.php';

$force = in_array('--force', $argv, true);
$onlyPano = null;
foreach ($argv as $arg) {
    if (preg_match('/^--pano=(\d+)$/', $arg, $m)) {
        $onlyPano = (int)$m[1];
    }
}

$db = new SQLite3(__DIR__ . '/../admin/data/vrm.db');
$db->busyTimeout(15000);

$panos = [];
$res = $db->query("SELECT id FROM panos WHERE visible = 1 AND (type = 'pano' OR type = '' OR type IS NULL) ORDER BY position, id");
while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
    if ($onlyPano === null || (int)$row['id'] === $onlyPano) {
        $panos[] = (int)$row['id'];
    }
}

$hasTable = (bool)$db->querySingle("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='pano_pois'");

$cfg = gpuq_config();
foreach ($panos as $panoId) {
    if (!$force && $hasTable) {
        $cnt = (int)$db->querySingle('SELECT COUNT(*) FROM pano_pois WHERE pano_id = ' . $panoId);
        if ($cnt > 0) {
            echo "p$panoId: $cnt POIs vorhanden, übersprungen\n";
            continue;
        }
    }
    $t0 = microtime(true);
    $jobId = gpuq_submit('vr_pois', (string)($cfg['pois_exec_url'] ?? 'https://vr.panomity.com/api/gpuq-pois-exec.php'), [
        '_gpuq_secret' => (string)($cfg['self_exec_secret'] ?? ''),
        'pano_id' => $panoId,
    ], 'normal', 300);
    if ($jobId === null) {
        echo "p$panoId: SUBMIT-FEHLER\n";
        continue;
    }
    $job = gpuq_wait($jobId, 280, 1.5);
    $dt = round(microtime(true) - $t0, 1);
    if (($job['status'] ?? '') === 'completed') {
        $pois = $job['result']['pois'] ?? [];
        echo "p$panoId: " . count($pois) . " POIs ({$dt}s): " . implode(', ', array_map(fn($p) => $p['label'], $pois)) . "\n";
    } else {
        echo "p$panoId: FEHLER ({$dt}s): " . ($job['message'] ?? '?') . "\n";
    }
}
echo "Fertig.\n";