Cleaners
5 years ago
Exceptions
5 years ago
Cancel.php
2 years ago
CancelUpdate.php
2 years ago
Cloning.php
2 years ago
CloningProcess.php
2 years ago
Data.php
2 years ago
Database.php
2 years ago
Delete.php
2 years ago
Directories.php
2 years ago
Files.php
2 years ago
Finish.php
1 year ago
Job.php
2 years ago
JobExecutable.php
2 years ago
Logs.php
3 years ago
PreserveDataFirstStep.php
3 years ago
PreserveDataSecondStep.php
2 years ago
ProcessLock.php
2 years ago
Scan.php
2 years ago
SearchReplace.php
2 years ago
TotalStepsAreNumberOfTables.php
5 years ago
Updating.php
2 years ago
Data.php
69 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Backend\Modules\Jobs; |
| 4 | |
| 5 | use WPStaging\Core\WPStaging; |
| 6 | use WPStaging\Framework\CloningProcess\Data\CleanThirdPartyConfigs; |
| 7 | use WPStaging\Framework\CloningProcess\Data\CopyWpConfig; |
| 8 | use WPStaging\Framework\CloningProcess\Data\Job as DataJob; |
| 9 | use WPStaging\Framework\CloningProcess\Data\ResetIndexPhp; |
| 10 | use WPStaging\Framework\CloningProcess\Data\UpdateSiteUrlAndHome; |
| 11 | use WPStaging\Framework\CloningProcess\Data\UpdateTablePrefix; |
| 12 | use WPStaging\Framework\CloningProcess\Data\UpdateWpConfigConstants; |
| 13 | use WPStaging\Framework\CloningProcess\Data\UpdateWpConfigTablePrefix; |
| 14 | use WPStaging\Framework\CloningProcess\Data\UpdateWpOptionsTablePrefix; |
| 15 | use WPStaging\Framework\CloningProcess\Data\UpdateStagingOptionsTable; |
| 16 | use WPStaging\Framework\Utils\Strings; |
| 17 | |
| 18 | /** |
| 19 | * Class Data |
| 20 | * @package WPStaging\Backend\Modules\Jobs |
| 21 | */ |
| 22 | class Data extends DataJob |
| 23 | { |
| 24 | /** |
| 25 | * Initialize |
| 26 | */ |
| 27 | public function initialize() |
| 28 | { |
| 29 | parent::initialize(); |
| 30 | $this->getTables(); |
| 31 | } |
| 32 | |
| 33 | protected function initializeSteps() |
| 34 | { |
| 35 | $this->steps = [ |
| 36 | CopyWpConfig::class, // Copy wp-config.php from the staging site if it is located outside of root one level up or copy default wp-config.php if production site uses bedrock or any other boilerplate solution that stores wp default config data elsewhere. |
| 37 | UpdateSiteUrlAndHome::class, |
| 38 | UpdateStagingOptionsTable::class, |
| 39 | UpdateTablePrefix::class, |
| 40 | UpdateWpConfigTablePrefix::class, |
| 41 | ResetIndexPhp::class, // This is needed if live site is located in subfolder. @see: https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory |
| 42 | UpdateWpOptionsTablePrefix::class, // This is important when custom folders are used |
| 43 | UpdateWpConfigConstants::class, |
| 44 | CleanThirdPartyConfigs::class, // Remove or use dummy config files for hosting like Flywheel etc |
| 45 | ]; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Get a list of tables to copy |
| 50 | */ |
| 51 | protected function getTables() |
| 52 | { |
| 53 | $strings = new Strings(); |
| 54 | $this->tables = []; |
| 55 | foreach ($this->options->tables as $table) { |
| 56 | $this->tables[] = $this->options->prefix . $strings->strReplaceFirst(WPStaging::getTablePrefix(), null, $table); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Calculate total steps in this job and assign it to $this->options->totalSteps |
| 62 | * @return void |
| 63 | */ |
| 64 | protected function calculateTotalSteps() |
| 65 | { |
| 66 | $this->options->totalSteps = 8; |
| 67 | } |
| 68 | } |
| 69 |