Example #1
0
            if ($found) {
                $cmd = sprintf("nohup php %s/update_run.php %s", __DIR__, $found);
                // 実行
                header("HTTP/1.1 202 Accepted");
                if (PHP_OS !== 'WIN32' && PHP_OS !== 'WINNT') {
                    exec($cmd . ' >/dev/null 2>&1 &');
                } else {
                    $fp = popen('start ' . $cmd, 'r');
                    pclose($fp);
                }
                if (is_null($msg)) {
                    // 何も出力しない。なにか文字を返すと不正アプリとみなすWebフック対策
                } elseif ($msg) {
                    $this->sendWebhook($msg, "Update Accepted");
                    echo "{$msg}";
                } else {
                    echo "<h1>Update Accepted</h1>\n";
                }
            } else {
                $msg = "Module Not Found";
                echo "<h1>{$msg}</h1>\n";
                $this->sendWebhook($msg, "Update Failed");
            }
            return $msg;
        }
    }
}
// instance Pico
$update = new Update(ROOT_DIR, ROOT_DIR . 'config/', ROOT_DIR . 'plugins/', ROOT_DIR . 'themes/');
$update->precheck();