WC_WCCOM_Site_Installation_Manager::can_run_installation
Check if the installation can be run.
Метод класса: WC_WCCOM_Site_Installation_Manager{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->can_run_installation( $run_until_step, $state );
- $run_until_step(строка) (обязательный)
- Run until this step.
- $state(WC_WCCOM_Site_Installation_State) (обязательный)
- Installation state.
Код WC_WCCOM_Site_Installation_Manager::can_run_installation() WC WCCOM Site Installation Manager::can run installation WC 11.0.1
protected function can_run_installation( $run_until_step, $state ) {
if ( $state->get_last_step_status() === \WC_WCCOM_Site_Installation_State::STEP_STATUS_IN_PROGRESS ) {
throw new Installer_Error( Installer_Error_Codes::INSTALLATION_ALREADY_RUNNING );
}
if ( $state->get_last_step_status() === \WC_WCCOM_Site_Installation_State::STEP_STATUS_FAILED ) {
throw new Installer_Error( Installer_Error_Codes::INSTALLATION_FAILED );
}
if ( $state->get_last_step_name() === self::STEPS[ count( self::STEPS ) - 1 ] ) {
throw new Installer_Error( Installer_Error_Codes::ALL_INSTALLATION_STEPS_RUN );
}
if ( array_search( $state->get_last_step_name(), self::STEPS, true ) >= array_search(
$run_until_step,
self::STEPS,
true
) ) {
throw new Installer_Error( Installer_Error_Codes::REQUESTED_STEP_ALREADY_RUN );
}
if ( ! is_writable( WP_CONTENT_DIR ) ) {
throw new Installer_Error( Installer_Error_Codes::FILESYSTEM_REQUIREMENTS_NOT_MET );
}
}