Changeset 868335
- Timestamp:
- 03/03/2014 04:38:12 AM (12 years ago)
- Location:
- wp-time-machine/trunk
- Files:
-
- 2 edited
-
css/wp-time-machine.css (modified) (3 diffs)
-
includes/wpTimeMachineCore.php (modified) (52 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-time-machine/trunk/css/wp-time-machine.css
r662458 r868335 132 132 } 133 133 134 #wpTimeMachine label.offsite_provider { 135 width:auto; 136 } 137 134 138 #wpTimeMachine input { 135 139 width:205px; … … 251 255 } 252 256 253 a.wpTM_checked:hover, 257 a.wpTM_checked:hover, 254 258 a.wpTM_unchecked { 255 259 padding-left:25px; … … 257 261 } 258 262 259 a.wpTM_unchecked:hover, 263 a.wpTM_unchecked:hover, 260 264 a.wpTM_checked { 261 265 padding-left:25px; -
wp-time-machine/trunk/includes/wpTimeMachineCore.php
r863789 r868335 41 41 $wpTimeMachineOptionsStorage['use_post_pub'] = $_GET['use_post_pub']; 42 42 } 43 43 44 44 if (isset($_GET['use_timestamp_dir'])) { 45 45 $wpTimeMachineOptionsStorage['use_timestamp_dir'] = $_GET['use_timestamp_dir']; … … 79 79 } 80 80 } 81 81 82 82 if ( $_GET['set_offsite'] == 1 ) { 83 83 84 84 $wpTimeMachineOptionsStorage['offsite'] = $_GET['offsite']; 85 85 86 86 echo "set offsite to: " . $_GET['offsite']; 87 88 } 89 87 88 } 89 90 90 update_option(adminOptionsName, $wpTimeMachineOptionsStorage); 91 91 92 92 if ( $_GET['ajax_settings_only'] == 1 ) { 93 93 94 94 exit; 95 95 96 96 } 97 97 … … 118 118 119 119 wpTimeMachine_clean( $files ); 120 120 121 121 if ($_GET['clean'] == 1) { 122 122 123 123 exit; 124 124 125 125 } 126 126 127 127 if ($wpTimeMachineOptionsStorage['use_timestamp_dir'] == "true") { 128 128 $timestamp = date("Y-m-d"); … … 149 149 // Wordpress 150 150 wpTimeMachine_logger( $use_log, "--- Wordpress: ". wp_version ); 151 151 152 152 // WP_ALLOW_MULTISITE info if applicable 153 if (WP_ALLOW_MULTISITE) { 153 if (WP_ALLOW_MULTISITE) { 154 154 wpTimeMachine_logger( $use_log, "--- WP_ALLOW_MULTISITE: true" ); 155 155 wpTimeMachine_logger( $use_log, "--- DOMAIN_CURRENT_SITE: ".DOMAIN_CURRENT_SITE ); … … 177 177 } 178 178 wpTimeMachine_logger( $use_log, '--- Current Offsite Provider: '.$offsite ); 179 179 180 180 } 181 181 … … 200 200 echo "#Info {display:none; } "; 201 201 } 202 202 203 203 if ($wpTimeMachineOptionsStorage['show_options'] == "true") { 204 204 echo ".wpTimeMachineOptions {display:block;} "; … … 206 206 echo ".wpTimeMachineOptions {display:none; } "; 207 207 } 208 208 209 209 ?> 210 210 … … 224 224 echo "\n\t\t\"\"\n\t);"; 225 225 } 226 226 227 227 $js_offsite = $wpTimeMachineOptionsStorage['offsite']; 228 228 229 229 ?> 230 230 … … 240 240 241 241 <?php 242 242 243 243 foreach ($offsites as $provider) { 244 244 echo " … … 252 252 break;"; 253 253 } 254 254 255 255 ?> 256 256 257 257 default: 258 258 // need to add error logging for this... or maybe just re-use FTP or Dropbox … … 261 261 262 262 } 263 263 264 264 var use_log_labels = new Array( 265 "<?php echo $wpTimeMachineText['use_log_labels'][0]; ?>", 265 "<?php echo $wpTimeMachineText['use_log_labels'][0]; ?>", 266 266 "<?php echo $wpTimeMachineText['use_log_labels'][1]; ?>" 267 267 ); 268 268 269 269 var format_labels = new Array( 270 "<?php echo $wpTimeMachineText['format_labels'][0]; ?>", 270 "<?php echo $wpTimeMachineText['format_labels'][0]; ?>", 271 271 "<?php echo $wpTimeMachineText['format_labels'][1]; ?>" 272 272 ); 273 273 274 274 var use_post_pub_labels = new Array( 275 "<?php echo $wpTimeMachineText['use_post_pub_labels'][0]; ?>", 275 "<?php echo $wpTimeMachineText['use_post_pub_labels'][0]; ?>", 276 276 "<?php echo $wpTimeMachineText['use_post_pub_labels'][1]; ?>" 277 277 ); 278 278 279 279 var use_timestamp_dir_labels = new Array( 280 "<?php echo $wpTimeMachineText['use_timestamp_dir_labels'][0]; ?>", 280 "<?php echo $wpTimeMachineText['use_timestamp_dir_labels'][0]; ?>", 281 281 "<?php echo $wpTimeMachineText['use_timestamp_dir_labels'][1]; ?>" 282 282 ); 283 283 284 284 var exclude_cache_labels = new Array( 285 "<?php echo $wpTimeMachineText['exclude_cache_labels'][0]; ?>", 285 "<?php echo $wpTimeMachineText['exclude_cache_labels'][0]; ?>", 286 286 "<?php echo $wpTimeMachineText['exclude_cache_labels'][1]; ?>" 287 287 ); 288 288 289 289 var remote_pass_storage_labels = new Array( 290 "<?php echo $wpTimeMachineText['remote_pass_storage_labels'][0]; ?>", 290 "<?php echo $wpTimeMachineText['remote_pass_storage_labels'][0]; ?>", 291 291 "<?php echo $wpTimeMachineText['remote_pass_storage_labels'][1]; ?>" 292 292 ); 293 293 294 294 </script> 295 295 296 296 <script type="text/javascript" src="<?php echo wpcontent_url; ?>/plugins/wp-time-machine/javascript/wp-time-machine.js"></script> 297 297 … … 301 301 302 302 <?php 303 303 304 304 if ($wpTimeMachineOptionsStorage['recent_archive_name'] != "") { 305 305 306 306 echo "<div id=\"RecentInfo\">"; 307 307 echo "<h3>Recent Archive Information:</h3>"; … … 310 310 echo "<p><a href='javascript:;' onclick='jQuery(\"#RecentInfo\").toggle()' class=\"close\">Close this</a></p>"; 311 311 echo "</div>"; 312 312 313 313 } else { 314 314 315 315 echo "<div id=\"RecentInfo\">"; 316 316 echo "<h3>Your Archive Information:</h3>"; … … 318 318 echo "<p><a href='javascript:;' onclick='jQuery(\"#RecentInfo\").toggle()' class=\"close\">Close this</a></p>"; 319 319 echo "</div>"; 320 320 321 321 } 322 322 323 323 ?> 324 324 325 325 <p> 326 326 … … 419 419 420 420 <?php 421 421 422 422 if ($offsite != "") { 423 423 ?> … … 443 443 foreach ($offsites as $provider) { 444 444 echo "<input class=\"rd\" type=\"radio\" name=\"offsite\" value=\"".$provider['offsite_short']."\" id=\"offsite_radio_".$provider['offsite_short']."\"> "; 445 echo "<label for=\"offsite_radio_".$provider['offsite_short']."\">".$provider['offsite_name']."</label> ";445 echo "<label class=\"offsite_provider\" for=\"offsite_radio_".$provider['offsite_short']."\">".$provider['offsite_name']."</label> "; 446 446 } 447 447 448 448 ?> 449 449 … … 458 458 <?php 459 459 } 460 460 461 461 ?> 462 462 … … 478 478 <p id="wpTimeMachine_learn_about_formats" class="help" style="display:none"> 479 479 480 By default File Formats is set to generate all of your archives as ZIP (.zip) files; since that seems to be the most commonly used archive format on most 480 By default File Formats is set to generate all of your archives as ZIP (.zip) files; since that seems to be the most commonly used archive format on most 481 481 operating systems (which means you probably already have the software needed to extract Zip files). That said, tar files (or .tar.gz) provide better 482 compression and therefore take up less disk space and take less time to transfer. 482 compression and therefore take up less disk space and take less time to transfer. 483 483 484 484 <a href="javascript:;" onclick="jQuery(this).parent().hide()" class="close">Close</a> 485 485 486 486 </p> 487 487 488 488 </fieldset> 489 489 … … 509 509 510 510 This feature lets you take advantage of WordPress' ability to add events after a post gets published (or updated). Using this plugin you 511 can force WordPress to start wp Time Machine every time a publish or update event occurs. There is a considerable price worth thinking 512 about: using this feature will add time to publishing (depending on the size of your blog it may add several seconds, or even minutes). 513 511 can force WordPress to start wp Time Machine every time a publish or update event occurs. There is a considerable price worth thinking 512 about: using this feature will add time to publishing (depending on the size of your blog it may add several seconds, or even minutes). 513 514 514 <a href="javascript:;" onclick="jQuery(this).parent().hide()" class="close">Close</a> 515 515 … … 517 517 518 518 </fieldset> 519 519 520 520 <fieldset> 521 521 … … 582 582 583 583 <?php 584 584 585 585 if ($wpTimeMachineOptionsStorage['use_log'] == "true") { 586 586 echo '<a class="full" href="javascript:;" id="use_log" value="true">'.$wpTimeMachineText['use_log_labels'][0].'</a> '; … … 588 588 echo '<a class="full" href="javascript:;" id="use_log" value="false">'.$wpTimeMachineText['use_log_labels'][1].'</a> '; 589 589 } 590 590 591 591 if ( file_exists( wpTimeMachineLog ) ) { 592 592 echo '<a class="full" href="'. wpcontent_url .'/wpTimeMachine_log.txt" target="_blank">'.$wpTimeMachineText['view_log_label'].'</a> '; … … 618 618 619 619 <div id="Info"> 620 621 <p> 622 623 This plugin is pretty simple. You can use Dropbox, Amazon's S3, or an FTP account to store WordPress. Need an account? 624 Visit: <a href="https://www.dropbox.com/" target="_new">Dropbox</a>. Or, for Amazon's S3 visit: 625 <a href="https://s3.amazonaws.com/" target="_new">https://s3.amazonaws.com</a>. If you decide to use an FTP account, 620 621 <p> 622 623 This plugin is pretty simple. You can use Dropbox, Amazon's S3, or an FTP account to store WordPress. Need an account? 624 Visit: <a href="https://www.dropbox.com/" target="_new">Dropbox</a>. Or, for Amazon's S3 visit: 625 <a href="https://s3.amazonaws.com/" target="_new">https://s3.amazonaws.com</a>. If you decide to use an FTP account, 626 626 it makes a lot of sense to use a remote FTP account on a server that isn't shared with this WordPress installation. 627 628 </p> 629 630 <p> 631 627 628 </p> 629 630 <p> 631 632 632 The files that get generated for each archive are: 633 633 634 634 <ol> 635 635 <li>wpTimeMachine-content-files<?php echo $format; ?></li> … … 638 638 <li>wpTimeMachine-Instructions.txt <sup>2</sup></li> 639 639 <li>wpTimeMachine-RestorationScript.sh <sup>3</sup></li> 640 </ol> 641 640 </ol> 641 642 642 <em> 643 643 1: if you're not using .htaccess then no, it won't be created <br /> 644 644 2: if you're ever recovering from a catastrophic WordPress failure, this file will help<br /> 645 645 3: this file is still under development & should be used with caution<br /> 646 </em> 647 646 </em> 647 648 648 <div class="hint"> 649 649 It's a good idea to store the following two items on your own, (in the same place as the files above):<br/> … … 651 651 Or, read about how to use <a href="http://wptimemachine.com/-/wordpress-and-subversion/">Subversion for your WordPress implementation</a>.<br/> 652 652 Your copy of wp-config.php <em>For security purposes this file is not backed up!</em> 653 </div> 654 655 </p> 653 </div> 654 655 </p> 656 656 657 657 <p> … … 663 663 <li><?php echo wpcontent_url . "/plugins/wp-time-machine/cron.php"; ?></li> 664 664 <li><?php echo wpcontent_dir . "/plugins/wp-time-machine/cron.php"; ?></li> 665 </ol> 666 665 </ol> 666 667 667 For example, you might use curl:<br /> 668 668 669 669 <code> 670 670 curl "<?php echo wpcontent_url . "/plugins/wp-time-machine/cron.php"; ?>?generate=1" 671 671 </code> 672 672 673 673 <div class="hint"> 674 674 675 675 Note that it is recommended that you set up a separate cron job to delete the temporary archive files: 676 676 677 677 <code> 678 678 curl "<?php echo wpcontent_url . "/plugins/wp-time-machine/cron.php"; ?>?clean=1" 679 679 </code> 680 680 681 681 </div> 682 682 683 683 There are many ways to use the scripts referenced above ... this is just an example, for more information read this:<br /> 684 684 <a href="http://wptimemachine.com/-/scheduling-wp-time-machine-via-cron/" target="_new">http://wptimemachine.com/-/scheduling-wp-time-machine-via-cron/</a> 685 685 686 686 </p> 687 687 688 688 <p> 689 689 690 Having trouble? Visit the <a href="http://wordpress.org/tags/wp-time-machine?forum_id=10" target="_blank">WordPress forum</a>, and please share 691 this URL: <a href="<?php echo wpcontent_url . "/wpTimeMachine_log.txt"; ?>" target="_new"><?php echo wpcontent_url . "/wpTimeMachine_log.txt"; ?></a> 690 Having trouble? Visit the <a href="http://wordpress.org/tags/wp-time-machine?forum_id=10" target="_blank">WordPress forum</a>, and please share 691 this URL: <a href="<?php echo wpcontent_url . "/wpTimeMachine_log.txt"; ?>" target="_new"><?php echo wpcontent_url . "/wpTimeMachine_log.txt"; ?></a> 692 692 (the log -- if enabled -- contains vital information for trouble shooting).<br /> 693 693 … … 697 697 698 698 <div class="wpTimeMachine_footer"> 699 700 <ul> 699 700 <ul> 701 701 <li class="Twitter"><a href="http://twitter.com/home?status=An awesome WordPress plugin for backups: wp Time Machine: http://wpTimeMachine.com" target="_new">Share on Twitter</a></li> 702 702 <li class="Facebook"><a href="http://www.facebook.com/sharer.php?u=http://wpTimeMachine.com" target="_new">Share on Facebook</a></li> 703 703 <li class="Official"><a href="http://wpTimeMachine.com" target="_new" title="Official website for the wp Time Machine">wpTimeMachine.com</a>, version: <?php echo wpTimeMachineVersion; ?></li> 704 704 </ul> 705 705 706 706 </div> 707 707 708 708 </p> 709 709 710 710 <pre id="output" style="display:none"> 711 711 … … 713 713 714 714 if ($_GET['generate'] == 1) { 715 715 716 716 // store start time & begin logging archive process 717 717 718 718 $start_generate = time(); 719 719 720 720 wpTimeMachine_logger( $use_log, '--- Start to generate archives...' ); 721 721 722 722 @unlink( wpcontent_archive.".tar.gz" ); 723 723 @unlink( wpcontent_archive.".zip" ); 724 724 725 725 // validate referer via nonce 726 726 727 727 check_admin_referer('wpTimeMachine_nonce'); 728 728 729 729 // instructions text file 730 730 … … 734 734 735 735 include( "wpTimeMachineArchiveRestorationScript.php" ); 736 736 737 737 // generate archives 738 739 if ($format == "zip") { 740 $wpcontent_archive = new Archive_Zip( wpcontent_archive.$format ); 741 } else { 742 $wpcontent_archive = new Archive_Tar( wpcontent_archive.$format ); 738 739 if ($format == "zip") { 740 $wpcontent_archive = new Archive_Zip( wpcontent_archive.$format ); 741 } else { 742 $wpcontent_archive = new Archive_Tar( wpcontent_archive.$format ); 743 743 } 744 745 if ($wpTimeMachineOptionsStorage['exclude_cache'] == "true") { 744 745 if ($wpTimeMachineOptionsStorage['exclude_cache'] == "true") { 746 746 $wpTimeMachine_excluded = array ( ".", "..", "upgrade", "cache" ); 747 } else { 748 $wpTimeMachine_excluded = array ( ".", "..", "upgrade" ); 747 } else { 748 $wpTimeMachine_excluded = array ( ".", "..", "upgrade" ); 749 749 } 750 750 751 751 $wpTimeMachine_excluded[] = wpTimeMachineOptionsFile; 752 752 753 753 wpTimeMachine_logger( $use_log, '--- wpTimeMachine-content-files' . $format . ', will contain: ' ); 754 754 755 755 $dh = opendir(wpcontent_dir); 756 756 while (false !== ($filename = readdir($dh))) { 757 757 $wp_content_files[] = $filename; 758 758 } 759 760 foreach ($wp_content_files as $wp_content_file) { 761 if ( ! in_array( $wp_content_file, $wpTimeMachine_excluded ) ) { 762 $wpcontent_archive_files[] = wpcontent_dir . "/" .$wp_content_file; 763 wpTimeMachine_logger( $use_log, '--- add: wp-content/' . $wp_content_file ); 764 } 759 760 foreach ($wp_content_files as $wp_content_file) { 761 if ( ! in_array( $wp_content_file, $wpTimeMachine_excluded ) ) { 762 $wpcontent_archive_files[] = wpcontent_dir . "/" .$wp_content_file; 763 wpTimeMachine_logger( $use_log, '--- add: wp-content/' . $wp_content_file ); 764 } 765 765 } 766 766 767 767 if ($wpcontent_archive->create( $wpcontent_archive_files ) ) { 768 768 769 769 @copy( $_SERVER['DOCUMENT_ROOT'] . "/.htaccess", htaccess_archive ); 770 770 771 771 wpTimeMachine_logger( $use_log, '--- wpTimeMachine-htaccess.txt (copy of .htaccess file)' ); 772 772 773 773 $instructions_handle = fopen(instructions, 'w'); 774 774 fwrite($instructions_handle, $instructions_txt); 775 775 fclose($instructions_handle); 776 776 777 777 wpTimeMachine_logger( $use_log, '--- wpTimeMachine-Instructions.txt (text instructions)' ); 778 778 779 779 $restoration_handle = fopen(restoration, 'w'); 780 780 fwrite($restoration_handle, $restoration_shell_script); 781 781 fclose($restoration_handle); 782 782 783 783 wpTimeMachine_logger( $use_log, '--- wpTimeMachine-RestorationScript.sh (restoration shell script)' ); 784 784 785 785 $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); 786 786 mysql_select_db(DB_NAME, $link); 787 787 788 788 $tables = array(); 789 789 $result = mysql_query("SHOW TABLES"); 790 790 791 791 while ($row = mysql_fetch_row($result)) { 792 792 $tables[] = $row[0]; … … 795 795 foreach ($tables as $table) { 796 796 797 $table_prefix = substr( $table, 0, strlen(wp_table_prefix) ); 797 $table_prefix = substr( $table, 0, strlen(wp_table_prefix) ); 798 798 // if the current $table doesn't start with the wp table prefix skip it 799 if ($table_prefix == wp_table_prefix) { 800 799 if ($table_prefix == wp_table_prefix) { 800 801 801 $result = mysql_query('SELECT * FROM '.$table); 802 802 $num_fields = mysql_num_fields($result); 803 803 804 804 $wpTimeMachine_dump.= 'DROP TABLE IF EXISTS '.$table.';'; 805 805 $row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table)); 806 806 $wpTimeMachine_dump.= "\n\n".$row2[1].";\n\n"; 807 807 808 808 for ($i = 0; $i < $num_fields; $i++) { 809 809 while ($row = mysql_fetch_row($result)) { … … 819 819 } 820 820 $wpTimeMachine_dump.="\n\n\n"; 821 821 822 822 } 823 823 824 824 } 825 825 826 826 $handle = fopen(wpdata_sql, 'w+'); 827 827 fwrite($handle, $wpTimeMachine_dump); … … 833 833 834 834 // start processing the files 835 835 836 836 wpTimeMachine_logger( $use_log, '--- Initiate transfer to ' . $offsite ); 837 837 … … 842 842 843 843 $login_error = false; 844 844 845 845 switch ($offsite) { 846 846 847 847 case "dropbox": 848 848 849 849 $uploader = new DropboxUploader( $POST_remote_user, $POST_remote_pass ); 850 850 851 851 wpTimeMachine_logger( $use_log, '--- Instantiate new DropboxUploader() ' ); 852 852 … … 856 856 $dropbox_dir = "/" . $POST_remote_path ; 857 857 } 858 858 859 859 if ($timestamp != "") { 860 860 $dropbox_dir .= "-" . $timestamp; 861 } 861 } 862 862 863 863 foreach ($files as $i => $file) { … … 867 867 868 868 try { 869 869 870 870 $uploader->upload( $file, $remoteDir = $dropbox_dir ); 871 871 … … 881 881 882 882 } 883 } 883 } 884 884 885 885 $remote_path = $dropbox_dir; … … 889 889 case "aws_s3": 890 890 case "s3": 891 891 892 892 if ($POST_remote_path == "") { 893 893 $bucket = "wpTimeMachine"; … … 895 895 $bucket = $POST_remote_path ; 896 896 } 897 897 898 898 if ($timestamp != "") { 899 899 $bucket .= "-" . $timestamp; 900 } 901 900 } 901 902 902 $bucket = uniqid( $bucket . "-" ); 903 903 904 904 $s3 = new S3( $POST_remote_user, $POST_remote_pass ); 905 905 … … 907 907 908 908 try { 909 909 910 910 $s3->putBucket( $bucket, S3::ACL_PRIVATE ); 911 911 … … 919 919 920 920 } 921 921 922 922 foreach ($files as $i => $file) { 923 923 924 924 if (file_exists($file)) { 925 925 926 926 wpTimeMachine_logger( $use_log, '--- files loop: ' . $file . ' >> ' . $bucket . ' >> ' . baseName( $file ) ); 927 927 928 928 $s3->putObjectFile( $file, $bucket, baseName( $file ), S3::ACL_PRIVATE ); 929 929 930 930 } 931 931 932 932 } 933 933 934 934 $remote_path = $bucket; 935 935 … … 939 939 940 940 include("wpTimeMachineNonSwitch.php4"); 941 941 942 942 break; 943 943 944 944 default: 945 946 wpTimeMachine_logger( $use_log, '--- Error: no offsite set, or recognized.' ); 945 946 wpTimeMachine_logger( $use_log, '--- Error: no offsite set, or recognized.' ); 947 947 948 948 } … … 950 950 951 951 if (! $login_error) { 952 952 953 953 wpTimeMachine_logger( $use_log, '--- Transfer has completed, to remote_path: ' . $remote_path ); 954 954 955 // store info about this archive 955 // store info about this archive 956 956 $wpTimeMachineOptionsStorage['recent_archive_path'] = $remote_path; 957 957 $wpTimeMachineOptionsStorage['recent_archive_format'] = $format; 958 $wpTimeMachineOptionsStorage['recent_archive_duration'] = time() - $wpTimeMachine_start; 958 $wpTimeMachineOptionsStorage['recent_archive_duration'] = time() - $wpTimeMachine_start; 959 959 update_option(adminOptionsName, $wpTimeMachineOptionsStorage); 960 960 961 961 echo "<span id='update'>Your archives are ready, they took about " . $wpTimeMachineOptionsStorage['recent_archive_duration'] . " seconds to create;"; 962 962 echo " and are in your ".$offsite_name." account (in this ".strtolower($remote_path_label).": ".$wpTimeMachineOptionsStorage['recent_archive_path'].").</span>"; 963 963 964 964 } else { 965 965 966 966 wpTimeMachine_logger( $use_log, '--- Transfer not completed' ); 967 967 968 968 echo "<span id='update'>Archiving failed</span>"; 969 969 970 970 } 971 971 972 972 } 973 973 974 974 ?> 975 975 … … 989 989 } // End function wpTimeMachine_init() 990 990 991 function wpTimeMachine_publish_post($offsites) 991 function wpTimeMachine_publish_post($offsites) 992 992 { 993 993 … … 995 995 996 996 shell_exec('curl "http://wptimemachine.com/_wp_/wp-content/plugins/wp-time-machine/cron.php?generate=1"'); 997 997 998 998 wpTimeMachine_logger( $use_log, '--- wpTimeMachine_publish_post: success!' ); 999 999 1000 1000 } catch (Exception $e) { 1001 1001 1002 1002 $error = $e->getMessage(); 1003 1003 wpTimeMachine_logger( $use_log, '--- wpTimeMachine_publish_post: Error: '.$error ); … … 1005 1005 } 1006 1006 1007 function wpTimeMachine_enqueue_scripts() 1007 function wpTimeMachine_enqueue_scripts() 1008 1008 { 1009 1009 1010 1010 wp_deregister_script( 'jquery-form' ); 1011 1011 wp_register_script( 'jquery-form', wpcontent_url . '/plugins/wp-time-machine/javascript/jquery.form.js' ); 1012 1012 wp_enqueue_script( 'jquery-form' ); 1013 1013 1014 1014 wp_register_script( 'jquery.validate', wpcontent_url . '/plugins/wp-time-machine/javascript/jquery.validate.js' ); 1015 1015 wp_enqueue_script( 'jquery.validate' ); 1016 1016 1017 1017 wp_register_script( 'jquery.simplemodal-1.3.5.min', wpcontent_url . '/plugins/wp-time-machine/javascript/jquery.simplemodal-1.3.5.min.js' ); 1018 1018 wp_enqueue_script( 'jquery.simplemodal-1.3.5.min' ); 1019 1019 1020 } 1020 } 1021 1021 1022 1022 function wpTimeMachine_head() 1023 { 1024 1023 { 1024 1025 1025 echo '<link type="text/css" rel="stylesheet" href="' . wpcontent_url . '/plugins/wp-time-machine/css/wp-time-machine.css" />' . "\n"; 1026 1026 … … 1031 1031 1032 1032 if ($use_log != "true") return; 1033 1033 1034 1034 if (wpTimeMachine_apache_log == "true") error_log( $message ); 1035 1035 … … 1050 1050 @unlink( $file ); 1051 1051 } 1052 1052 1053 1053 // the only file that is $format specific is the wp-content archive 1054 // ...so we need to ensure that either format gets deleted 1054 // ...so we need to ensure that either format gets deleted 1055 1055 @unlink( wpcontent_archive.".tar.gz" ); 1056 1056 @unlink( wpcontent_archive.".zip" ); … … 1064 1064 1065 1065 $wpTimeMachineOptionsStorage = get_option(adminOptionsName); 1066 1066 1067 1067 $option_dump = ""; 1068 1068 … … 1080 1080 foreach ($wpTimeMachineOptionsStorage as $key => $option) { 1081 1081 $wpTimeMachineOptions[$key] = $option; 1082 1082 1083 1083 $option_dump .= "$"."wpTimeMachineOptionsStorage['" . $key . "'] = \"" . $option . "\";" . "\n"; 1084 1084 1085 1085 } 1086 1086 } … … 1093 1093 fwrite($od_handle, $option_dump); 1094 1094 fclose($od_handle); 1095 1095 1096 1096 return $wpTimeMachineOptions; 1097 1097 … … 1123 1123 // Hook to kick off wp Time Machine after publish event hook fires 1124 1124 1125 function wpTimeMachine_post_pub($offsites) 1125 function wpTimeMachine_post_pub($offsites) 1126 1126 { 1127 1127 1128 1128 $wpTimeMachineOptionsStorage = wpTimeMachine_getAdminOptions(); 1129 1129 1130 1130 if ($wpTimeMachineOptionsStorage['use_post_pub'] == "false") { 1131 1131 return; … … 1135 1135 1136 1136 shell_exec('curl "http://wptimemachine.com/_wp_/wp-content/plugins/wp-time-machine/cron.php?generate=1"'); 1137 1137 1138 1138 wpTimeMachine_logger( $use_log, '--- wpTimeMachine_post_pub: success!' ); 1139 1139 1140 1140 } catch (Exception $e) { 1141 1141 1142 1142 $error = $e->getMessage(); 1143 1143 1144 1144 wpTimeMachine_logger( $use_log, '--- wpTimeMachine_post_pub: Error: '.$error ); 1145 1145 1146 1146 } 1147 1147 }
Note: See TracChangeset
for help on using the changeset viewer.