Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
wp-content
/
plugins
/
wpml-string-translation
/
classes
/
MO
/
File
:
FailureHooksFactory.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace WPML\ST\MO\File; use SitePress; use WPML\ST\MO\Generate\Process\ProcessFactory; use function WPML\Container\make; use WPML\ST\MO\Scan\UI\Factory as UiFactory; class FailureHooksFactory implements \IWPML_Backend_Action_Loader { /** * @return FailureHooks|null * @throws \WPML\Auryn\InjectionException */ public function create() { /** @var SitePress $sitepress */ global $sitepress; if ( $sitepress->is_setup_complete() && $this->hasRanPreGenerateViaUi() ) { $inBackground = true; return make( FailureHooks::class, [ ':status' => ProcessFactory::createStatus( $inBackground ), ':singleProcess' => ProcessFactory::createSingle( $inBackground ), ] ); } return null; } /** * @return bool * @throws \WPML\Auryn\InjectionException */ private function hasRanPreGenerateViaUi() { $uiPreGenerateStatus = ProcessFactory::createStatus( false ); return $uiPreGenerateStatus->isComplete() || UiFactory::isDismissed() || ! ProcessFactory::createSingle()->getPagesCount(); } }