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