Changeset 2997269
- Timestamp:
- 11/16/2023 06:32:01 PM (2 years ago)
- Location:
- duplicator/trunk
- Files:
-
- 8 edited
-
classes/package/class.pack.php (modified) (2 diffs)
-
classes/utilities/class.u.php (modified) (2 diffs)
-
define.php (modified) (1 diff)
-
duplicator.php (modified) (1 diff)
-
installer/dup-installer/main.installer.php (modified) (1 diff)
-
src/Core/MigrationMng.php (modified) (3 diffs)
-
src/Libs/Snap/SnapIO.php (modified) (1 diff)
-
views/tools/diagnostics/information.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
duplicator/trunk/classes/package/class.pack.php
r2968781 r2997269 1207 1207 1208 1208 $file_name = basename($glob_full_path); 1209 if ($file_name === 'index.php') { 1210 continue; 1211 } 1212 1209 1213 // skip all active packages 1210 1214 foreach ($active_files as $c_nameHash) { … … 1691 1695 $dir = DUP_Settings::getSsdirTmpPath() . "/*"; 1692 1696 foreach (glob($dir) as $file) { 1697 if (basename($file) === 'index.php') { 1698 continue; 1699 } 1693 1700 @unlink($file); 1694 1701 } -
duplicator/trunk/classes/utilities/class.u.php
r2929695 r2997269 595 595 SnapIO::chmod($path_ssdir, 'u+rwx,go+rx'); 596 596 SnapIO::dirWriteCheckOrMkdir(DUP_Settings::getSsdirTmpPath(), 'u+rwx'); 597 SnapIO::createSilenceIndex(DUP_Settings::getSsdirTmpPath()); 597 598 598 599 //-------------------------------- 599 600 //FILE CREATION & HARDEN PROCESS 600 601 //index.php, .htaccess, robots.txt 601 self::setupBackupDirIndexFile();602 SnapIO::createSilenceIndex(DUP_Settings::getSsdirPath()); 602 603 self::setupBackupDirRobotsFile(); 603 604 self::setupBackupDirHtaccess(); 604 605 self::performHardenProcesses(); 606 // For old installations 607 SnapIO::createSilenceIndex(DUP_Settings::getSsdirInstallerPath()); 605 608 606 609 return true; … … 641 644 } catch (Exception $ex) { 642 645 DUP_Log::Trace("Unable create file htaccess {$fileName} msg:" . $ex->getMessage()); 643 }644 }645 646 /**647 * Attempts to create an index.php file in the backups directory648 *649 * @return void650 */651 protected static function setupBackupDirIndexFile()652 {653 try {654 $fileName = DUP_Settings::getSsdirPath() . '/index.php';655 if (!file_exists($fileName)) {656 $fileContent = <<<HTACCESS657 <?php658 // silence;659 HTACCESS;660 if (file_put_contents($fileName, $fileContent) === false) {661 throw new Exception('Can\'t create .haccess');662 }663 }664 } catch (Exception $ex) {665 DUP_Log::Trace("Unable create index.php {$fileName} msg:" . $ex->getMessage());666 646 } 667 647 } -
duplicator/trunk/define.php
r2990955 r2997269 12 12 13 13 if (function_exists('plugin_dir_url')) { 14 define('DUPLICATOR_VERSION', '1.5.7 ');14 define('DUPLICATOR_VERSION', '1.5.7.1'); 15 15 define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__)); 16 16 define('DUPLICATOR_SITE_URL', get_site_url()); -
duplicator/trunk/duplicator.php
r2990955 r2997269 5 5 * Plugin URI: https://duplicator.com/ 6 6 * Description: Migrate and backup a copy of your WordPress files and database. Duplicate and move a site from one location to another quickly. 7 * Version: 1.5.7 7 * Version: 1.5.7.1 8 8 * Requires at least: 4.0 9 9 * Tested up to: 6.4 -
duplicator/trunk/installer/dup-installer/main.installer.php
r2990955 r2997269 35 35 } 36 36 37 define('DUPX_VERSION', '1.5.7 ');37 define('DUPX_VERSION', '1.5.7.1'); 38 38 define('DUPX_INIT', str_replace('\\', '/', dirname(__FILE__))); 39 39 define('DUPX_ROOT', preg_match('/^[\\\\\/]?$/', dirname(DUPX_INIT)) ? '/' : dirname(DUPX_INIT)); -
duplicator/trunk/src/Core/MigrationMng.php
r2968781 r2997269 10 10 use DUP_CTRL_Tools; 11 11 use DUP_Settings; 12 use DUP_Util; 12 13 use Duplicator\Libs\Snap\SnapWP; 13 14 use Duplicator\Libs\Snap\SnapIO; … … 46 47 { 47 48 add_action('admin_init', array(__CLASS__, 'adminInit')); 49 add_action(self::HOOK_FIRST_LOGIN_AFTER_INSTALL, function ($migrationData) { 50 DUP_Util::initSnapshotDirectory(); 51 }); 48 52 add_action(self::HOOK_FIRST_LOGIN_AFTER_INSTALL, array(__CLASS__, 'removeFirstLoginOption')); 49 53 add_action(self::HOOK_FIRST_LOGIN_AFTER_INSTALL, array(__CLASS__, 'renameInstallersPhpFiles')); … … 359 363 wp_mkdir_p($ssdInstallerPath); 360 364 SnapIO::emptyDir($ssdInstallerPath); 365 SnapIO::createSilenceIndex($ssdInstallerPath); 361 366 362 367 $filesToMove = array( -
duplicator/trunk/src/Libs/Snap/SnapIO.php
r2881201 r2997269 918 918 919 919 /** 920 * Create an empty index.php file in dir. 921 * 922 * @param string $dir Dir where create index.php 923 * 924 * @return bool true on success, false on failure 925 */ 926 public static function createSilenceIndex($dir) 927 { 928 if (!is_dir($dir)) { 929 return false; 930 } 931 932 $path = self::trailingslashit($dir) . 'index.php'; 933 if (!file_exists($path)) { 934 $fileContent = <<<INDEXPHP 935 <?php 936 // silence 937 938 INDEXPHP; 939 return (file_put_contents($path, $fileContent) !== false); 940 } 941 942 return true; 943 } 944 945 /** 920 946 * from wordpress function wp_is_stream 921 947 * -
duplicator/trunk/views/tools/diagnostics/information.php
r2773665 r2997269 47 47 } 48 48 } 49 50 $remove_response = ''; 51 if (isset($_POST['remove-options'])) { 52 if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'duplicator_settings_page')) { 53 wp_die(__('Security check failed.', 'duplicator')); 54 } 55 56 $remove_options = sanitize_text_field($_POST['remove-options']); 57 $action_result = DUP_Settings::DeleteWPOption($remove_options); 58 switch ($remove_options) { 59 case 'duplicator_settings': 60 $remove_response = __('Plugin settings reset.', 'duplicator'); 61 break; 62 case 'duplicator_ui_view_state': 63 $remove_response = __('View state settings reset.', 'duplicator'); 64 break; 65 case 'duplicator_package_active': 66 $remove_response = __('Active package settings reset.', 'duplicator'); 67 break; 68 } 69 } 49 70 ?> 50 51 71 52 72 <form id="dup-settings-form" action="<?php echo admin_url('admin.php?page=duplicator-tools&tab=diagnostics§ion=info'); ?>" method="post"> … … 55 75 56 76 <?php 57 if (isset($_POST['remove-options'])) {58 $remove_options = sanitize_text_field($_POST['remove-options']);59 $action_result = DUP_Settings::DeleteWPOption($remove_options);60 switch ($remove_options) {61 case 'duplicator_settings':62 $remove_response = __('Plugin settings reset.', 'duplicator');63 break;64 case 'duplicator_ui_view_state':65 $remove_response = __('View state settings reset.', 'duplicator');66 break;67 case 'duplicator_package_active':68 $remove_response = __('Active package settings reset.', 'duplicator');69 break;70 }71 }72 73 77 if (! empty($remove_response)) { 74 78 echo "<div id='message' class='notice notice-success is-dismissible dup-wpnotice-box'><p>" . esc_html($remove_response) . "</p></div>"; 75 79 } 76 80 77 include_once 'inc.data.php';78 include_once 'inc.settings.php';79 include_once 'inc.validator.php';80 include_once 'inc.phpinfo.php';81 include_once 'inc.data.php'; 82 include_once 'inc.settings.php'; 83 include_once 'inc.validator.php'; 84 include_once 'inc.phpinfo.php'; 81 85 ?> 86 82 87 </form>
Note: See TracChangeset
for help on using the changeset viewer.