プロジェクトをリファクタリングしていて、という名前のクラスを見ましたLogger
。これは推奨されておらず、不要であると思います。私はそれの参照を検索し、それを使用する単一のコードフラグメントを見ました:
fCore::registerDebugCallback('Logger::log');
// Enable SQL statement printing
//
$db->enableDebugging(App::env()->get('slowQueryLog'));
$db->registerHookCallback('extracted', 'Logger::queryLogPrepare');
$db->registerHookCallback('run', 'Logger::queryLog');
メソッドがコールバックとして登録されていることがわかります。Logger
これらは不要だと思いますので、クラスを削除できるように削除したいと思います。ただし、適切にテストできる唯一の方法は、上記の部分を削除して展開することです。このコードは大規模な Web サイトで使用されているため、私の仮定が間違っていると、多くの損害が発生します。したがって、テストは簡単ですが、チャンクを削除して何千もの怒りの電子メールを受け取る危険に直面したくないので、皆さんに連絡して質問します。デバッグ用のコールバックを登録する必要がある fllishlib と/またはフック?参考までに、ドキュメントの関連部分を示します。
registerDebugCallback :
/**
* Registers a callback to handle debug messages instead of the default action of calling ::expose() on the message
*
* @param callback $callback A callback that accepts a single parameter, the string debug message to handle
* @return void
*/
registerHookCallback :
/**
* Registers a callback for one of the various query hooks - multiple callbacks can be registered for each hook
*
* The following hooks are available:
* - `'unmodified'`: The original SQL passed to fDatabase, for prepared statements this is called just once before the fStatement object is created
* - `'extracted'`: The SQL after all non-empty strings have been extracted and replaced with ordered sprintf-style placeholders
* - `'run'`: After the SQL has been run
*
* Methods for the `'unmodified'` hook should have the following signature:
*
* - **`$database`**: The fDatabase instance
* - **`&$sql`**: The original, unedited SQL
* - **`&$values`**: The values to be escaped into the placeholders in the SQL
*
* Methods for the `'extracted'` hook should have the following signature:
*
* - **`$database`**: The fDatabase instance
* - **`&$sql`**: The SQL with all strings removed and replaced with `%1$s`-style placeholders
* - **`&$values`**: The values to be escaped into the placeholders in the SQL
*
* The `extracted` hook is the best place to modify the SQL since there is
* no risk of breaking string literals. Please note that there may be empty
* strings (`''`) present in the SQL since some databases treat those as
* `NULL`.
*
* Methods for the `'run'` hook should have the following signature:
*
* - **`$database`**: The fDatabase instance
* - **`$query`**: The (string) SQL or `array(0 => {fStatement object}, 1 => {values array})`
* - **`$query_time`**: The (float) number of seconds the query took
* - **`$result`** The fResult or fUnbufferedResult object, or `FALSE` if no result
*
* @param string $hook The hook to register for
* @param callback $callback The callback to register - see the method description for details about the method signature
* @return void
*/