a-blog cms PHP API Reference

PageGenerationService
in package
implements PageGenerationListenerInterface

Table of Contents

Interfaces

PageGenerationListenerInterface

Properties

$pages  : array<string|int, Page>
$pool  : ProcessPool

Methods

addEntryPage()  : void
エントリーページを追加
addPage()  : void
ページを追加
onPageGenerationError()  : void
エラー時の処理
onPageGenerationStart()  : bool
開始時の処理
onPageGenerationSuccess()  : void
成功時の処理
requestStop()  : void
停止を要求する
run()  : array<int, PageGenerationResult>
ページを生成
buildSessionIniOptions()  : array<int, string>
セッションを引き継ぐ子プロセスへ渡す PHP ini オプションを組み立てる
getSessionSaveHandler()  : string
親プロセスの実効セッション保存ハンドラを取得
getSessionSavePath()  : string
親プロセスの実効セッション保存先パスを取得
useDatabaseSession()  : bool
DB セッション(PHP_SESSION_USE_DB)を利用しているかどうか
buildEnv()  : array<string, string>
子プロセスに渡す環境変数を組み立てる
getConsoleScriptPath()  : string
console.phpスクリプトのパスを取得
getPhpBinPath()  : string
phpの実行パスを取得

Properties

Methods

addEntryPage()

エントリーページを追加

public addEntryPage(string $url, string $destinationPathname, int $entryId[, string|null $userAgent = null ][, bool $withSession = false ]) : void
Parameters
$url : string
$destinationPathname : string
$entryId : int
$userAgent : string|null = null
$withSession : bool = false

addPage()

ページを追加

public addPage(string $url, string $destinationPathname[, string|null $userAgent = null ][, bool $withSession = false ]) : void
Parameters
$url : string
$destinationPathname : string
$userAgent : string|null = null
$withSession : bool = false

onPageGenerationStart()

開始時の処理

public onPageGenerationStart(Page $page) : bool
Parameters
$page : Page
Return values
bool

buildSessionIniOptions()

セッションを引き継ぐ子プロセスへ渡す PHP ini オプションを組み立てる

protected buildSessionIniOptions(Page $page) : array<int, string>

共有ホスティングでは Web SAPI と CLI が異なる php.ini(=異なる session.save_path)を 読み込むことがあり、セッション ID を引き継いでも子プロセスが別ディレクトリを参照して 匿名セッションに落ちる。親プロセスの実効値を -d で伝播し、同じ保存先を参照させる。

Parameters
$page : Page
Return values
array<int, string>

getSessionSaveHandler()

親プロセスの実効セッション保存ハンドラを取得

protected getSessionSaveHandler() : string
Return values
string

getSessionSavePath()

親プロセスの実効セッション保存先パスを取得

protected getSessionSavePath() : string

ini_get ではなく session_save_path で取得する。Hook や Session\Engine(SESSION_SAVE_PATH)が 実行時に変更した保存先も含めた「親が実際に使っている値」を伝播するため。

Return values
string

useDatabaseSession()

DB セッション(PHP_SESSION_USE_DB)を利用しているかどうか

protected useDatabaseSession() : bool
Return values
bool

buildEnv()

子プロセスに渡す環境変数を組み立てる

private buildEnv(Page $page) : array<string, string>

proc_open に環境変数を渡すと親プロセスの環境変数は引き継がれないため、現在の環境変数を ベースにする。子プロセスには HTTP リクエストが無く $_SERVER['SCRIPT_NAME'] から 設置ディレクトリを復元できないため、解決済みの DIR_OFFSET を引き渡す。

Parameters
$page : Page
Return values
array<string, string>

getConsoleScriptPath()

console.phpスクリプトのパスを取得

private getConsoleScriptPath() : string
Return values
string

getPhpBinPath()

phpの実行パスを取得

private getPhpBinPath() : string
Return values
string

        
On this page

Search results