Plugin Directory

Changeset 2012719


Ignore:
Timestamp:
01/15/2019 02:20:55 PM (7 years ago)
Author:
fullmoonfriday
Message:

0.6.5 Add plugin backup local support

Location:
wps-backup
Files:
59 added
9 edited

Legend:

Unmodified
Added
Removed
  • wps-backup/trunk/README.txt

    r2010665 r2012719  
    33Tags: tools, user, support, backup, database, mysqli, migrate
    44Requires at least: 3.0.1
    5 Tested up to: 5.0.2
    6 Stable tag: 5.0.2
     5Tested up to: 5.0.3
     6Stable tag: 5.0.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4949== Changelog ==
    5050
    51 = 0.6.4 =
    52 1. Remove old tables after restoration
    53 
     51= 0.6.5 =
     521. Added support for local plugin backup
    5453
    5554= 0.6.3 =
  • wps-backup/trunk/includes/data_actions/generate_backup.php

    r1980143 r2012719  
    11<?php
    22
    3     //if user is admin
    4 
    5 
    6 
    7 
    8 // function to call a generation of the database
    9 
    10 // function to do the generation of the database
    11 
    12 // function to download the generated database
    133
    144?>
     
    3222        }
    3323    } else {
    34                     echo "You haven't any backups yet." . "<br/>";
     24        echo "You haven't any backups yet." . "<br/>";
    3525    }
    3626
    37 /**
    38  * generate backup mysql
    39  *
    40  * @since 1.0
    41  * @return void
    42  */
    4327
    44 function deliver_mysql_backup(){
    45 
    46 }
  • wps-backup/trunk/includes/data_actions/restore_backup.php

    r1980143 r2012719  
    11<?php
    22
    3 // upload form to upload a saved database
    43
    5 // restore the database function
    6 
    7 // reload the website
    84?>
    95
  • wps-backup/trunk/includes/data_actions/restore_backup_remote.php

    r2003439 r2012719  
    7070$remote_storage = load_remote_storage();
    7171$remote_storage = json_decode( $remote_storage['body'] );
    72 
    73 if( count($remote_storage) <= 0 ){
    74     echo "You have not setup your WPS cloud backups yet.";
     72$fail_response = "You have not setup your WPS cloud backups yet.";
     73if( $remote_storage ){
     74    if( count( $remote_storage ) <= 0 ){
     75        echo $fail_response;
     76    } else {
     77        foreach($remote_storage as $key => $value){
     78            ?>
     79            <p>
     80            <form action="" method="post">
     81                <input type="hidden" name="WPS-action" value="get-url-database-backups"/>
     82                <input type="hidden" name="url_required" value="<?php echo $value->url ?>"/>
     83                 <?php // wp_nonce_field( 'wpsc_generate_mysqli_backup_nonce', 'wpsc_generate_mysqli_backup_nonce' ); ?>
     84                <input type="submit" value="View backups" >
     85            </form>
     86            <?php echo $value->url ?>
     87            </p>
     88            <?php
     89        }
     90    }
     91} else {
     92    echo $fail_response;
    7593}
    7694
    77 foreach($remote_storage as $key => $value){
    78         ?>
    79         <p>
    80         <form action="" method="post">
    81             <input type="hidden" name="WPS-action" value="get-url-database-backups"/>
    82             <input type="hidden" name="url_required" value="<?php echo $value->url ?>"/>
    83              <?php // wp_nonce_field( 'wpsc_generate_mysqli_backup_nonce', 'wpsc_generate_mysqli_backup_nonce' ); ?>
    84             <input type="submit" value="View backups" >
    85         </form>
    86         <?php echo $value->url ?>
    87         </p>
    88         <?php
    89        
    90 }
    9195
     96
  • wps-backup/trunk/includes/data_actions/wpsc_class_data_management.php

    r2010665 r2012719  
    33
    44class WPS_data_management {
     5
     6
     7
     8    /**
     9     * generate backup plugins
     10     *
     11     * @since 1.0
     12     * @return void
     13     */
     14
     15    public function wpsc_generate_plugins_backup( $destination ){
     16        $ready = false;
     17        $site_url = substr( explode(".", site_url('','https') )[0] , 8);
     18
     19       
     20
     21        // $dirpath = $dirpath.'/plugins';
     22     //     $ready = WPS_file_util::create_dir($dirpath);
     23        // var_dump($dirpath);
     24
     25        // return;
     26        if($destination == 'local'){
     27
     28            $dirpath = $this->setup_directory_for_writing('plugins','local');
     29
     30            WPS_file_util::delete_files($dirpath."/");
     31            $ready = WPS_file_util::create_dir($dirpath);
     32
     33            $source = WP_CONTENT_DIR.'/plugins/';
     34            self::recurse_copy( $source , $dirpath."/original");
     35
     36            $zip_name = time() ."-". $site_url.'_plugins_backup.zip';
     37
     38            // zip them to the original location
     39            $sourcePath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/plugins/local/original";
     40            $outZipPath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/plugins/local/".$zip_name;
     41            WPS_file_util::zipDir( $sourcePath , $outZipPath );
     42
     43            $ready = true;
     44
     45        }
     46        if( $destination == 'remote' ){
     47
     48            $dirpath = $this->setup_directory_for_writing('plugins','remote');
     49
     50            // $dirpath = $dirpath.'/remote';
     51            WPS_file_util::delete_files($dirpath."/");
     52            $ready = WPS_file_util::create_dir($dirpath);
     53
     54            $source = WP_CONTENT_DIR.'/plugins/';
     55            self::recurse_copy( $source , $dirpath."/original");
     56
     57            $zip_name = time() ."-". $site_url.'_plugins_backup.zip';
     58
     59            // zip them to the original location
     60            $sourcePath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/plugins/remote/original";
     61            $outZipPath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/plugins/remote/".$zip_name;
     62            WPS_file_util::zipDir( $sourcePath , $outZipPath );
     63
     64            $ready = true;
     65
     66        }
     67
     68        return $ready;
     69    }
     70
     71
     72    // get current backup file from dirory options
     73
     74    public static function get_current_local_backup( $backup_type ){
     75        $output = "";
     76        $filtered = array();
     77        $dirpath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/".$backup_type."/local";
     78        // WPS_file_util::create_dir($dirpath);
     79        //to do
     80            //ensure html silence is golden is added
     81            // html page
     82        if( is_dir( $dirpath ) ){
     83            foreach (scandir($dirpath) as $file) {
     84                $files[$file] = filemtime($dirpath . '/' . $file);
     85            }
     86            foreach ( $files as $key => $file ){
     87                if ( strpos( $key, $backup_type .'_backup' ) !== false ){
     88                    $filtered[] = $key;
     89                }
     90            }
     91            return $filtered;
     92        }
     93        return false;
     94    }
     95
     96    /**
     97     * Copy directory content
     98     *
     99     * @since 1.0
     100     * @return void
     101     */
     102
     103
     104    static function recurse_copy($src,$dst) {
     105
     106        // check if the parent is the same as the new directory, this causes feedback loops
     107            //this is not used at the moment
     108        // $parent =  explode('/', $src )[ ( count( explode('/', $src ) ) - 1)] ;
     109        // $child_parent = explode('/', $dst )[ ( count( explode('/', $dst ) ) - 2)];
     110
     111        $dir = opendir($src);
     112        @mkdir($dst);
     113        while(false !== ( $file = readdir($dir)) ) {
     114            if (( $file != '.' ) && ( $file != '..' )) {
     115                if ( is_dir($src . '/' . $file) ) {
     116                    // if($child_parent != $parent){ //stop from copying into itself
     117                        self::recurse_copy($src . '/' . $file, $dst . '/' . $file);
     118                    // }
     119                }
     120                else {
     121                    copy($src . '/' . $file,$dst . '/' . $file);
     122                }
     123            }
     124        }
     125        closedir($dir);
     126    }
     127
    5128
    6129    /**
     
    82205
    83206
    84     public function setup_directory_for_writing(){
     207    public function setup_directory_for_writing($backup_dir = 'database' , $destination = 'remote'){
    85208
    86209        $dirpath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE;
     
    90213        $dirpath = $dirpath.'/temp';
    91214        $ready = WPS_file_util::create_dir($dirpath);
     215        $dirpath = $dirpath.'/'.$backup_dir;
     216        $ready = WPS_file_util::create_dir($dirpath);
     217        $dirpath = $dirpath.'/'.$destination;
     218        $ready = WPS_file_util::create_dir($dirpath);
    92219        if($ready){
    93220            return $dirpath;   
     
    97224    }
    98225
     226   
     227
    99228
    100229    /**
     
    106235
    107236    public function setup_directory_for_restoring(){
     237
     238        //delete previous folder
    108239        $target = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER.'/temp/restore/';     
    109240        if($target){
    110241            WPS_file_util::delete_files($target);
    111242        }
     243
     244
    112245        if( $dirpath = $this->setup_directory_for_writing() ){
    113246            $dirpath = $dirpath.'/restore';
     
    129262
    130263    static function get_directory_for_restoring(){
    131         $target = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER.'/temp/restore/';     
     264        $target = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER.'/temp/database/remote/restore/';     
    132265        return $target;
    133266    }
     
    212345    public function write_file_to_directory( $dirpath , $sqlScript ){
    213346
    214         $site_url = site_url('','https');
    215         $site_url = explode(".",$site_url)[0];
    216         $site_url = substr( $site_url , 8);
     347        $site_url = substr( explode(".", site_url('','https') )[0]  , 8);
    217348
    218349        $backup_file_name = time() . "-" . $site_url. '_backup.sql';
     
    225356
    226357    /**
    227      * Write zip and delete original
     358     * Write zip and delete original - only used for single files to be zipped for db backup
    228359     *
    229360     * @since 1.0
     
    233364    public function zip_backup_directory( $dirpath , $backup_file_name ){
    234365
    235         $site_url = site_url('','https');
    236         $site_url = explode(".",$site_url)[0];
    237         $site_url = substr( $site_url , 8);
     366        $site_url = substr( explode(".", site_url('','https') )[0] , 8);
    238367
    239368        if ( class_exists( 'ZipArchive' ) ) {
    240             $zip_name = time() ."-". $site_url.'_backup.zip';
     369            $zip_name = time() ."-". $site_url.'_backup.zip';   
    241370            $zip = new ZipArchive();
    242371            $archive = $zip->open($dirpath."/" . $zip_name, ZipArchive::CREATE);
     
    283412    /**
    284413     * Unzip our directory
     414     *                  optionl $dst   
    285415     * @param
    286416     * @param
     
    290420
    291421
    292     public function unzip_file( $dirpath , $filename ){
     422    public function unzip_file( $dirpath , $filename , $dst ){
     423
     424        if( $dst == '' ){
     425            $output_dst = $dirpath;
     426        } else {
     427            $output_dst = $dst;
     428        }
     429
    293430        $zip = new ZipArchive;
    294431        $section = $zip->open($dirpath . $filename );
    295         $extract = $zip->extractTo($dirpath);
     432        $extract = $zip->extractTo( $output_dst );
    296433        $extract =  $zip->close();
    297434        return $extract;
    298435    }
     436
     437
     438    /**
     439     * Advanced unzip - prevent over write, alternative destination
     440     * @param
     441     * @param
     442     * @since 1.0
     443     * @return true if file was unzipped
     444     */
     445
     446    // public function unzip_file_advanced( $dirpath , $filename , $dst ){
     447 //     $zip = new ZipArchive;
     448    //  $section = $zip->open($dirpath . $filename );
     449    //  $extract = $zip->extractTo($dst);
     450    //  $extract =  $zip->close();
     451    //  return $extract;
     452    // }
    299453
    300454
     
    322476        global $wpdb;
    323477
    324        
     478
    325479        $tables = array();
    326480        $sql = "SHOW TABLES";
     
    360514            }
    361515
    362 
    363 
    364516            if ( substr( trim( $line ), - 1, 1) == ';') {
    365517                $result = $wpdb->query( $sql );
     
    407559        }
    408560    }
     561
     562
     563     /*
     564     * PHP delete function that deals with directories recursively, deletes the directory as well,
     565     * This is a modified version for the ensuring that the wps backups are not removed
     566     */
     567    static function delete_files( $dirname , $parent = '' ) {
     568        $parent_path = '';
     569        $current_path = '';
     570
     571        //stop the parent being deleted if it passed when called
     572        if( $parent != '' ){
     573            $parent_path = pathInfo( $parent )['dirname'];
     574            $current_path = pathInfo( $dirname )['dirname'];
     575        }
     576
     577        $do_not_delete = false;
     578        $directory_array = explode('/', $dirname );
     579        if( in_array ( 'wps-complete', $directory_array ) || in_array ( 'wps-backup', $directory_array ) ){
     580            $do_not_delete = true;
     581        }
     582
     583        if ( is_dir( $dirname ) ){
     584
     585            $dir_handle = opendir($dirname);
     586                if (!$dir_handle || $do_not_delete){
     587                    return false;
     588                }
     589
     590                while($file = readdir($dir_handle)) {
     591                    if ($file != "." && $file != "..") {
     592                        if (!is_dir($dirname."/".$file)){
     593                            unlink($dirname."/".$file);
     594                        } else {
     595                            self::delete_files($dirname.'/'.$file , '');
     596                        }
     597                    }
     598                }
     599            closedir($dir_handle);
     600
     601            //options to avoid deleting the parent
     602            if( $parent == '' ){
     603                    rmdir($dirname);
     604            }
     605            if( $parent == '' ){
     606                if( $parent_path != $current_path){
     607                    rmdir($dirname);
     608                }
     609            }
     610            return true;
     611        }
     612    }
     613
    409614}
    410615
  • wps-backup/trunk/includes/data_actions/wpsc_data_management.php

    r2008527 r2012719  
    2020        wp_die( __( 'Nonce verification failed.', 'wps' ), __( 'Error', 'wps' ), array( 'response' => 403 ) );
    2121    }
     22
    2223
    2324    $sqlScript = "";
     
    7980    }
    8081       
     82    $dirpath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/database/local";
     83    WPS_file_util::delete_files($dirpath);
     84// return;
    8185    if(!empty($sqlScript)){
    8286        $dirpath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE;
     
    8488        $dirpath = $dirpath.'/'.WPS_BU_PLUGIN_FOLDER;
    8589        WPS_file_util::create_dir($dirpath);
     90        $dirpath = $dirpath.'/temp';
     91        WPS_file_util::create_dir($dirpath);
     92        $dirpath = $dirpath.'/database';
     93        WPS_file_util::create_dir($dirpath);
     94        $dirpath = $dirpath.'/local';
     95        WPS_file_util::create_dir($dirpath);
    8696        //to do
    8797            //ensure html silence is golden is added
     
    150160    }
    151161
    152     $dirpath = WP_CONTENT_DIR . '/' . WPS_PLUGIN_DIR_STORAGE . '/' . WPS_BU_PLUGIN_FOLDER;
     162    $dirpath = WP_CONTENT_DIR . '/' . WPS_PLUGIN_DIR_STORAGE . '/' . WPS_BU_PLUGIN_FOLDER .'/temp/database/local';
     163
     164    // var_dump( file_exists( $dirpath ) );
     165
    153166    $sql = '';
    154167    $error = '';
     
    156169    if (file_exists($dirpath)) {
    157170        $zip = new ZipArchive;
    158         $zip->open($dirpath . "/" . $backup_file );
     171        $ready = $zip->open($dirpath . "/" . $backup_file );
     172        // var_dump($dirpath . "/" . $backup_file);
    159173        $zip->extractTo($dirpath.'/');
    160174        $zip->close();
     
    220234    $output = "";
    221235    $filtered = array();
    222     $dirpath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE;
    223     WPS_file_util::create_dir($dirpath);
    224     $dirpath = $dirpath.'/'.WPS_BU_PLUGIN_FOLDER;
    225     WPS_file_util::create_dir($dirpath);
     236    $dirpath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/database/local";
     237    // WPS_file_util::create_dir($dirpath);
    226238    //to do
    227239        //ensure html silence is golden is added
    228240        // html page
    229 
    230     foreach (scandir($dirpath) as $file) {
    231         $files[$file] = filemtime($dirpath . '/' . $file);
     241    if( is_dir( $dirpath ) ){
     242        foreach (scandir($dirpath) as $file) {
     243            $files[$file] = filemtime($dirpath . '/' . $file);
     244        }
     245        foreach ( $files as $key => $file ){
     246            if ( strpos( $key, '_backup' ) !== false ){
     247                $filtered[] = $key;
     248            }
     249        }
     250        return $filtered;
    232251    }
    233     foreach ( $files as $key => $file ){
    234         if ( strpos( $key, '_backup' ) !== false ){
    235             $filtered[] = $key;
    236         }
    237     }
    238     return $filtered;
     252    return false;
    239253}
  • wps-backup/trunk/includes/wpsc_backup_functions.php

    r2010665 r2012719  
    259259    $data_management = new WPS_data_management;
    260260    $dirpath = WPS_data_management::get_directory_for_restoring();
     261    var_dump($dirpath);
    261262    $files = WPS_data_management::get_file_type_from_directory( $dirpath , 'zip');
    262263    $file_name = $files[0];
     
    293294add_action('WPS_action_restore-downloaded-cloud-backup','wpsc_restore_completed_db_download');
    294295
     296
     297//generate local backup
     298
     299function wpsc_generate_local_plugin_backup( ){
     300    // nonce
     301    // wpsc_generate_local_plugin_backup_nonce
     302
     303    $data_management = new WPS_data_management;
     304    $backup = $data_management->wpsc_generate_plugins_backup( $_POST['destination'] );
     305
     306    //redirect after generation
     307        // false - message try again
     308        // true redirect to self with success message
     309
     310    // if( current_user_can('manage_options')  ){
     311    //  $url =  admin_url( 'admin.php?page=wpsc_backup&tab=data_remote_files&url='.$_POST['url_required'] );
     312    // } else {
     313        $url =  admin_url( 'admin.php?page=wpsc_backup&tab=plugins_backup&wps_message=plugins_backed_up' );
     314       
     315    // }
     316    wp_safe_redirect( $url );
     317}
     318add_action('WPS_action_generate-local-plugin-backup','wpsc_generate_local_plugin_backup');
     319
     320
     321function wpsc_restore_local_plugin_backup( ){
     322    // nonce
     323    // wpsc_generate_local_plugin_backup_nonce
     324
     325    $src = WP_CONTENT_DIR.'/plugins';
     326    $dirpath = WP_CONTENT_DIR.'/wpsc_complete/backups/old_plugins';
     327    WPS_data_management::recurse_copy($src,$dirpath);
     328    WPS_data_management::delete_files( $src , $src );
     329
     330    //extract the zip to a restore directory
     331    $sourcePath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/plugins/local/";
     332    $file_name = WPS_data_management::get_current_local_backup( 'plugins' );
     333
     334    $restorePath = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/plugins/local/restore/";
     335    WPS_file_util::delete_files( $restorePath );
     336    WPS_file_util::create_dir($restorePath);
     337    $unzip = WPS_data_management::unzip_file( $sourcePath , $file_name[0] , $restorePath );
     338
     339    //copy the extracted folder into the plugins directory
     340    $copySource = WP_CONTENT_DIR.'/'.WPS_PLUGIN_DIR_STORAGE.'/'.WPS_BU_PLUGIN_FOLDER."/temp/plugins/local/restore/original/";
     341    $resource = scandir( $copySource );
     342    foreach( $resource as $dir ){
     343        if( substr($dir,0,1) != '.' ){
     344            WPS_file_util::recurse_copy( $copySource.$dir , $src."/".$dir );
     345        }
     346    }
     347
     348    // if( current_user_can('manage_options')  ){
     349        $url =  admin_url( 'admin.php?page=wpsc_backup&tab=plugins_restore&wps_message=plugins_restored' );
     350    // } else {
     351        // $url =  admin_url( 'admin.php?page=wpsc_backup&tab=data_remote_files&WPS_message=error' );
     352    // }
     353    wp_safe_redirect( $url );
     354}
     355add_action('WPS_action_restore-local-plugin-backup','wpsc_restore_local_plugin_backup');
     356
     357
     358
  • wps-backup/trunk/includes/wpsc_backup_page.php

    r2008527 r2012719  
    2121$_GET['tab'] = isset( $_GET['tab'] ) ? $_GET['tab'] : 'data_backup';
    2222
     23
     24/*
     25*  Build the settings page funciton that runs everything
     26*
     27*
     28*/
     29
     30
     31function wpsc_bu_settings_page() {
     32   global $pagenow;
     33
     34        switch( $_GET['tab'] ){
     35            case 'wpsc_bu_plugins':
     36            case 'plugins_backup':
     37                    wpsc_bu_admin_tabs('wpsc_bu_plugins');
     38                    wpsc_backup_sub_tabs( 'plugins_backup' );
     39                break;
     40            case 'plugins_restore':
     41                    wpsc_bu_admin_tabs('wpsc_bu_plugins');
     42                    wpsc_backup_sub_tabs( 'plugins_restore' );
     43            break;
     44             case 'plugins_remote':
     45                    wpsc_bu_admin_tabs('wpsc_bu_plugins');
     46                    wpsc_backup_sub_tabs( 'plugins_remote' );
     47            break;
     48
     49            case 'admin_menu':
     50                    wpsc_bu_admin_tabs($_GET['tab']);
     51                break;
     52            case 'admin_toolbar':
     53                    wpsc_bu_admin_tabs($_GET['tab']);
     54                break;
     55
     56            case 'data_backup':
     57                    wpsc_bu_admin_tabs('wpsc_database');
     58                    wpsc_backup_sub_tabs( 'data_backup' );
     59                break;
     60            case 'data_restore':
     61                    wpsc_bu_admin_tabs('wpsc_database');
     62                    wpsc_backup_sub_tabs( 'data_restore' );
     63                break;
     64            case 'data_remote':
     65                    wpsc_bu_admin_tabs('wpsc_database');
     66                    wpsc_backup_sub_tabs( 'data_remote' );
     67                break;
     68               
     69            case 'data_remote_files':
     70                    wpsc_bu_admin_tabs('wpsc_database');
     71                    wpsc_backup_sub_tabs( 'data_remote_files' );
     72                break;
     73             case 'data_restore_cloud_db':
     74                    wpsc_bu_admin_tabs('wpsc_database');
     75                    wpsc_backup_sub_tabs( 'data_restore_cloud_db' );
     76                break;
     77            case 'restore_data_restore_cloud_db':
     78                    wpsc_bu_admin_tabs('wpsc_database');
     79                    wpsc_backup_sub_tabs( 'restore_data_restore_cloud_db' );
     80                break;
     81               
     82               
     83               
     84         default:
     85            wpsc_bu_admin_tabs($_GET['tab']);
     86            wpsc_backup_sub_tabs( $_GET['tab'] );
     87       }
     88}
     89
    2390//call the setting page to be built
    2491wpsc_bu_settings_page();
     
    34101function wpsc_bu_admin_tabs( $current = 'wpsc_database' ) {
    35102    $tabs = array(  'wpsc_database' => 'Database',
     103                    'wpsc_bu_plugins' => 'Plugins',
    36104                    'wpsc_instructions' => 'Instructions'
    37105                );
     
    67135    switch( $current ){
    68136
     137        //database
    69138        case 'data_actions':
    70139                $tabs['data_backup'] = 'Local Backup';
     
    94163                // $tabs['data_setup'] = 'Setup';
    95164            break;
     165
     166        //plugins
     167            case 'plugins_backup':
     168                $tabs['plugins_backup'] = 'Local Backup';
     169                $tabs['plugins_restore'] = 'Local Restore';
     170                $tabs['plugins_remote'] = 'Cloud Backups';
     171                // $tabs['data_setup'] = 'Setup';
     172            break;
     173            case 'plugins_restore':
     174                $tabs['plugins_backup'] = 'Local Backup';
     175                $tabs['plugins_restore'] = 'Local Restore';
     176                $tabs['plugins_remote'] = 'Cloud Backups';
     177                // $tabs['data_setup'] = 'Setup';
     178            break;
     179             case 'plugins_remote':
     180                $tabs['plugins_backup'] = 'Local Backup';
     181                $tabs['plugins_restore'] = 'Local Restore';
     182                $tabs['plugins_remote'] = 'Cloud Backups';
     183                // $tabs['data_setup'] = 'Setup';
     184            break;
     185        case 'plugins_remote_files':
     186                $tabs['plugins_backup'] = 'Local Backup';
     187                $tabs['plugins_restore'] = 'Local Restore';
     188                $tabs['plugins_remote_files'] = 'Cloud File Backups: '.$_GET['url'];
     189                $tabs['plugins_remote'] = 'Cloud Backups';
     190                // $tabs['data_setup'] = 'Setup';
     191            break;
     192            //downlaod
     193        case 'plugins_restore_cloud_db':
     194                $tabs['plugins_backup'] = 'Local Backup';
     195                $tabs['plugins_restore'] = 'Local Restore';
     196                $tabs['plugins_restore_cloud_plugins'] = 'Restoration Progress: Download';
     197                $tabs['plugins_remote'] = 'Cloud Backups';
     198                // $tabs['data_setup'] = 'Setup';
     199            break;
     200            //restore
     201        case 'restore_plugins_restore_cloud_db':
     202                $tabs['plugins_backup'] = 'Local Backup';
     203                $tabs['plugins_restore'] = 'Local Restore';
     204                $tabs['restore_plugins_restore_cloud_plugins'] = 'Restoration Progress: Restore';
     205                $tabs['plugins_remote'] = 'Cloud Backups';
     206                // $tabs['data_setup'] = 'Setup';
     207            break;
     208
     209        //others
     210
    96211        case 'wpsc_instructions':
    97212            break;
     
    113228}
    114229
    115 wpsc_backup_sub_tabs( $_GET['tab'] );
     230// wpsc_backup_sub_tabs( $_GET['tab'] );
    116231
    117232
     
    152267       
    153268   
    154       default:
     269     
     270    //plugins
     271    case 'wpsc_bu_plugins':
     272    case 'plugins_backup':
     273            include "data_actions/plugins_backup.php";
     274        break;
     275    case 'plugins_restore_cloud_db':
     276            include "data_actions/restore_cloud_plugins_backup.php";
     277        break;
     278    case 'plugins_remote_files':
     279           include "data_actions/plugins_restore_backup_files_list.php";
     280        break;
     281    case 'plugins_restore':
     282           include "data_actions/plugins_restore_backup.php";
     283        break;
     284    case 'plugins_remote':
     285           include "data_actions/plugins_restore_backup_remote.php";
     286        break;
     287
     288
     289       default:
    155290          // include "wpsc_menu_tab.php";
     291
     292
    156293}
    157294
     
    169306
    170307
    171 /*
    172 *  Build the settings page
    173 *
    174 *
    175 */
    176 
    177 
    178 function wpsc_bu_settings_page() {
    179    global $pagenow;
    180 
    181         switch( $_GET['tab'] ){
    182             case 'admin_menu':
    183                     wpsc_bu_admin_tabs($_GET['tab']);
    184                 break;
    185             case 'admin_toolbar':
    186                     wpsc_bu_admin_tabs($_GET['tab']);
    187                 break;
    188          default:
    189             wpsc_bu_admin_tabs($_GET['tab']);
    190        }
    191 }
    192 
     308
     309
  • wps-backup/trunk/wps_backup.php

    r2010665 r2012719  
    66Description: Backup migrate your WordPress websites locally and with our cloud API
    77Author: WPScomplete.com
    8 Version: 0.6.4
     8Version: 0.6.5
    99Author URI: https://wpscomplete.com
    1010*/
Note: See TracChangeset for help on using the changeset viewer.