Plugin Directory

Changeset 2997269


Ignore:
Timestamp:
11/16/2023 06:32:01 PM (2 years ago)
Author:
andreamk
Message:

Staging version 1.5.7.1

Location:
duplicator/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • duplicator/trunk/classes/package/class.pack.php

    r2968781 r2997269  
    12071207
    12081208            $file_name = basename($glob_full_path);
     1209            if ($file_name === 'index.php') {
     1210                continue;
     1211            }
     1212
    12091213            // skip all active packages
    12101214            foreach ($active_files as $c_nameHash) {
     
    16911695            $dir = DUP_Settings::getSsdirTmpPath() . "/*";
    16921696            foreach (glob($dir) as $file) {
     1697                if (basename($file) === 'index.php') {
     1698                    continue;
     1699                }
    16931700                @unlink($file);
    16941701            }
  • duplicator/trunk/classes/utilities/class.u.php

    r2929695 r2997269  
    595595        SnapIO::chmod($path_ssdir, 'u+rwx,go+rx');
    596596        SnapIO::dirWriteCheckOrMkdir(DUP_Settings::getSsdirTmpPath(), 'u+rwx');
     597        SnapIO::createSilenceIndex(DUP_Settings::getSsdirTmpPath());
    597598
    598599        //--------------------------------
    599600        //FILE CREATION & HARDEN PROCESS
    600601        //index.php, .htaccess, robots.txt
    601         self::setupBackupDirIndexFile();
     602        SnapIO::createSilenceIndex(DUP_Settings::getSsdirPath());
    602603        self::setupBackupDirRobotsFile();
    603604        self::setupBackupDirHtaccess();
    604605        self::performHardenProcesses();
     606        // For old installations
     607        SnapIO::createSilenceIndex(DUP_Settings::getSsdirInstallerPath());
    605608
    606609        return true;
     
    641644        } catch (Exception $ex) {
    642645            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 directory
    648      *
    649      * @return void
    650      */
    651     protected static function setupBackupDirIndexFile()
    652     {
    653         try {
    654             $fileName = DUP_Settings::getSsdirPath() . '/index.php';
    655             if (!file_exists($fileName)) {
    656                 $fileContent = <<<HTACCESS
    657 <?php
    658 // 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());
    666646        }
    667647    }
  • duplicator/trunk/define.php

    r2990955 r2997269  
    1212
    1313if (function_exists('plugin_dir_url')) {
    14     define('DUPLICATOR_VERSION', '1.5.7');
     14    define('DUPLICATOR_VERSION', '1.5.7.1');
    1515    define('DUPLICATOR_PLUGIN_URL', plugin_dir_url(__FILE__));
    1616    define('DUPLICATOR_SITE_URL', get_site_url());
  • duplicator/trunk/duplicator.php

    r2990955 r2997269  
    55 * Plugin URI: https://duplicator.com/
    66 * 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
    88 * Requires at least: 4.0
    99 * Tested up to: 6.4
  • duplicator/trunk/installer/dup-installer/main.installer.php

    r2990955 r2997269  
    3535}
    3636
    37 define('DUPX_VERSION', '1.5.7');
     37define('DUPX_VERSION', '1.5.7.1');
    3838define('DUPX_INIT', str_replace('\\', '/', dirname(__FILE__)));
    3939define('DUPX_ROOT', preg_match('/^[\\\\\/]?$/', dirname(DUPX_INIT)) ? '/' : dirname(DUPX_INIT));
  • duplicator/trunk/src/Core/MigrationMng.php

    r2968781 r2997269  
    1010use DUP_CTRL_Tools;
    1111use DUP_Settings;
     12use DUP_Util;
    1213use Duplicator\Libs\Snap\SnapWP;
    1314use Duplicator\Libs\Snap\SnapIO;
     
    4647    {
    4748        add_action('admin_init', array(__CLASS__, 'adminInit'));
     49        add_action(self::HOOK_FIRST_LOGIN_AFTER_INSTALL, function ($migrationData) {
     50            DUP_Util::initSnapshotDirectory();
     51        });
    4852        add_action(self::HOOK_FIRST_LOGIN_AFTER_INSTALL, array(__CLASS__, 'removeFirstLoginOption'));
    4953        add_action(self::HOOK_FIRST_LOGIN_AFTER_INSTALL, array(__CLASS__, 'renameInstallersPhpFiles'));
     
    359363        wp_mkdir_p($ssdInstallerPath);
    360364        SnapIO::emptyDir($ssdInstallerPath);
     365        SnapIO::createSilenceIndex($ssdInstallerPath);
    361366
    362367        $filesToMove = array(
  • duplicator/trunk/src/Libs/Snap/SnapIO.php

    r2881201 r2997269  
    918918
    919919    /**
     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
     938INDEXPHP;
     939            return (file_put_contents($path, $fileContent) !== false);
     940        }
     941
     942        return true;
     943    }
     944
     945    /**
    920946     * from wordpress function wp_is_stream
    921947     *
  • duplicator/trunk/views/tools/diagnostics/information.php

    r2773665 r2997269  
    4747    }
    4848}
     49
     50$remove_response = '';
     51if (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}
    4970?>
    50 
    5171
    5272<form id="dup-settings-form" action="<?php echo admin_url('admin.php?page=duplicator-tools&tab=diagnostics&section=info'); ?>" method="post">
     
    5575
    5676    <?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 
    7377    if (! empty($remove_response)) {
    7478        echo "<div id='message' class='notice notice-success is-dismissible dup-wpnotice-box'><p>" . esc_html($remove_response) . "</p></div>";
    7579    }
    7680
    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';
    8185    ?>
     86   
    8287</form>
Note: See TracChangeset for help on using the changeset viewer.