Changeset 188582
- Timestamp:
- 12/31/2009 11:17:05 PM (16 years ago)
- Location:
- cdn-tools
- Files:
-
- 3 edited
- 4 copied
-
tags/0.99 (copied) (copied from cdn-tools/trunk)
-
tags/0.99/cdn_classes/cloudfiles/loader.php (copied) (copied from cdn-tools/trunk/cdn_classes/cloudfiles/loader.php) (5 diffs)
-
tags/0.99/cdntools.php (copied) (copied from cdn-tools/trunk/cdntools.php) (14 diffs)
-
tags/0.99/readme.txt (copied) (copied from cdn-tools/trunk/readme.txt) (3 diffs)
-
trunk/cdn_classes/cloudfiles/loader.php (modified) (5 diffs)
-
trunk/cdntools.php (modified) (14 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cdn-tools/tags/0.99/cdn_classes/cloudfiles/loader.php
r182426 r188582 10 10 private $conn = null; 11 11 12 function __construct($authname,$authkey ) {12 function __construct($authname,$authkey,$use_servicenet=False) { 13 13 $this->authname = $authname; 14 14 $this->authkey = $authkey; … … 17 17 $this->upload_path = $wpuploadinfo['basedir']; 18 18 $this->uploads_use_yearmonth_folders = get_option('uploads_use_yearmonth_folders'); 19 $this->authconn( );19 $this->authconn($use_servicenet); 20 20 21 21 } 22 22 23 public function authconn( ) {23 public function authconn($use_servicenet) { 24 24 $auth = new CF_Authentication($this->authname,$this->authkey); 25 25 try { … … 31 31 return false; 32 32 } 33 $this->conn = new CF_Connection($auth );33 $this->conn = new CF_Connection($auth,$servicenet=$use_servicenet); 34 34 } 35 35 … … 51 51 } 52 52 53 public function attachment_upload($filepath ) {53 public function attachment_upload($filepath,$keep_logs=False) { 54 54 $file = str_replace($this->upload_path.'/','',$filepath); 55 55 if($this->uploads_use_yearmonth_folders) { … … 63 63 //need try/catch blocks here, all possible exceptions! 64 64 $wp_uploads = $this->conn->create_container($container_name); 65 $wp_uploads->log_retention($keep_logs); 65 66 $object = $wp_uploads->create_object($object_name); 66 67 try { -
cdn-tools/tags/0.99/cdntools.php
r182426 r188582 5 5 Description: CDN Tools is a plugin designed to help you drastically speed up your blog's load time by loading content onto a distribution network. You can use a commercial CDN or just load some of your larger JS libraries for free from Google's servers! At this time Cloud Files is the only supported CDN. 6 6 Author: Paul Kehrer 7 Version: 0.9 87 Version: 0.99 8 8 Author URI: http://langui.sh/ 9 9 */ … … 28 28 set_time_limit(90); //90 seconds max... 29 29 30 define('CDNTOOLS_VERSION','0.9 8');30 define('CDNTOOLS_VERSION','0.99'); 31 31 32 32 $dir_array = explode('/',dirname(__FILE__)); … … 52 52 private $cdntools_authkey = null; 53 53 private $cdntools_adminscripts = null; 54 private $cndtools_sideload_uploads = null; 54 private $cdntools_sideload_uploads = null; 55 private $cdntools_logretention = null; 56 private $cdntools_servicenet = null; 55 57 private $cdntools_baseuris = array(); 56 58 private $uploaded_file_path = null; … … 98 100 $this->cdntools_adminscripts = get_option('cdntools_adminscripts'); 99 101 $this->cdntools_sideload_uploads = get_option('cdntools_sideload_uploads'); 102 $this->cdntools_logretention = get_option('cdntools_logretention'); 103 $this->cdntools_servicenet = get_option('cdntools_servicenet'); 100 104 $this->cdntools_advanced_options = get_option('cdntools_advanced_options'); 101 105 $wp_upload_dir = wp_upload_dir(); … … 238 242 $file_to_upload = $this->uploaded_file_path; 239 243 } 240 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );241 $return_array = $cdn_loader->attachment_upload($file_to_upload );244 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 245 $return_array = $cdn_loader->attachment_upload($file_to_upload, $this->cdntools_logretention); 242 246 if (!is_array($return_array)) { 243 247 return $return_array; … … 253 257 error_reporting(E_ERROR | E_WARNING | E_PARSE); 254 258 ini_set('display_errors',1); 255 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );259 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 256 260 $upload_return = $this->cdn_attachment_upload($_POST['post_id'],$_POST['path']); 257 261 if ($upload_return !== true) { … … 328 332 } 329 333 } 330 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );334 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 331 335 foreach($files_to_delete as $path) { 332 336 $cdn_loader->attachment_delete($path); … … 436 440 } 437 441 if( is_array($filestoload) ) { 438 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );442 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 439 443 $returndata = $cdn_loader->load_js_files($filestoload); 440 444 if ( $returndata[0] != '' && is_array($returndata[1]) ) { … … 447 451 448 452 function cdn_remove_container($container_name) { 449 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );453 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 450 454 $cdn_loader->remove_container($container_name); 451 455 unset($this->cdntools_baseuris[$container_name]); … … 464 468 register_setting( 'cdn-options-group', 'cdntools_adminscripts', 'absint' ); 465 469 register_setting( 'cdn-options-group', 'cdntools_sideload_uploads', 'absint' ); 470 register_setting( 'cdn-options-group', 'cdntools_logretention', 'absint' ); 471 register_setting( 'cdn-options-group', 'cdntools_servicenet', 'absint' ); 466 472 register_setting( 'cdn-options-group', 'cdntools_advanced_options', 'absint' ); 467 473 register_setting( 'cdn-options-group', 'cdntools_prefix', 'wp_filter_nohtml_kses' ); … … 532 538 delete_option('cdntools_adminscripts'); 533 539 delete_option('cdntools_sideload_uploads'); 540 delete_option('cdntools_logretention'); 541 delete_option('cdntools_servicenet'); 534 542 delete_option('cdntools_advanced_options'); 535 543 delete_option('cdntools_prefix'); … … 542 550 $this->cdntools_adminscripts = null; 543 551 $this->cdntools_sideload_uploads = null; 552 $this->cdntools_logretention = null; 553 $this->cdntools_servicenet = null; 544 554 $this->cdntools_advanced_options = null; 545 555 } … … 645 655 <td colspan="2">Check this to enable side loading of uploads to your CDN. Uploads will also be kept locally in the event that you wish to turn off the CDN/remove this plugin. Once you configure your CDN you probably want to turn this on.</td> 646 656 </tr> 657 <tr style="<?php echo $advanced_display; ?>"> 658 <th>Enable CDN Log Retention:</th> 659 <?php 660 $logretentioncheck = ($this->cdntools_logretention)?'checked="checked"':''; 661 ?> 662 <td><input type="checkbox" name="cdntools_logretention" value="1" <?php echo $logretentioncheck; ?> /></td> 663 </tr> 664 <tr style="<?php echo $advanced_display; ?>"> 665 <td colspan="2">Check this to enable CDN log retention. If enabled, logs will be periodically (at unpredictable intervals) compressed and uploaded to a ".CDN_ACCESS_LOGS" container in the form of "container_name.YYYYMMDDHH-XXXX.gz". After enabling or disabling this option, you will need to re-upload your attachments to Cloud Files (click the "Load Attachments" button below).</td> 666 </tr> 667 <tr style="<?php echo $advanced_display; ?>"> 668 <th>Enable Servicenet Connection:</th> 669 <?php 670 $servicenetcheck = ($this->cdntools_servicenet)?'checked="checked"':''; 671 ?> 672 <td><input type="checkbox" name="cdntools_servicenet" value="1" <?php echo $servicenetcheck; ?> /></td> 673 </tr> 674 <tr style="<?php echo $advanced_display; ?>"> 675 <td colspan="2">Check this to enable the Servicenet connection to Cloud Files. If enabled, traffic to Cloud Files will use Rackspace's internal network to upload data to Cloud Files. This internal connection will almost always be faster than non-servicenet connections, and bandwidth on servicenet is free. However, servicenet connections will only work if this blog is hosted on a server that is hosted by Rackspace or Slicehost. <b>Rackspace Cloud Sites does not currently support the servicenet.</b></td> 676 </tr> 647 677 <!--tr style="<?php echo $advanced_display; ?>"> 648 678 <th>Load wp-admin Javascripts:</th> … … 651 681 ?> 652 682 <td><input type="checkbox" name="cdntools_adminscripts" value="1" <?php echo $adminupcheck; ?> /></td> 653 </tr -->683 </tr> 654 684 <tr style="<?php echo $advanced_display; ?>"> 655 685 <td colspan="2">Check this if you want the wp-admin javascript files to be put on your CDN. Typically you will want to leave this unchecked.</td> 656 </tr >686 </tr--> 657 687 <tr style="<?php echo $advanced_display; ?>"> 658 688 <th>CDN Container Prefix:</th> -
cdn-tools/tags/0.99/readme.txt
r182426 r188582 4 4 Tags: cdn, sideload, speed, content, distribution, performance, cloudfiles, files, media, accelerator, cloud 5 5 Requires at least: 2.8 6 Tested up to: 2.9 7 Stable tag: 0.9 86 Tested up to: 2.9.1 7 Stable tag: 0.99 8 8 9 9 CDN Tools is a plugin designed to help you drastically speed up your blog's load time by loading data onto a content distribution network (CDN). … … 42 42 43 43 == Changelog == 44 = 0.99 = 45 * Log retention support (in advanced options) 46 * Servicenet flag (in advanced options) 47 * Both these features were added courtesy of John Dickinson 44 48 45 49 = 0.98 = … … 49 53 50 54 = 0.97 - 12/9/2009 = 51 * Initial sideload AJAX used an absolute path with the siteurl. This should have been a relative path or the adminurl to accommodate situations w ere FORCE_SSL_ADMIN is defined. Thanks to John for identifying the bug.55 * Initial sideload AJAX used an absolute path with the siteurl. This should have been a relative path or the adminurl to accommodate situations where FORCE_SSL_ADMIN is defined. Thanks to John for identifying the bug. 52 56 53 57 = 0.96 - 12/4/2009 = -
cdn-tools/trunk/cdn_classes/cloudfiles/loader.php
r182426 r188582 10 10 private $conn = null; 11 11 12 function __construct($authname,$authkey ) {12 function __construct($authname,$authkey,$use_servicenet=False) { 13 13 $this->authname = $authname; 14 14 $this->authkey = $authkey; … … 17 17 $this->upload_path = $wpuploadinfo['basedir']; 18 18 $this->uploads_use_yearmonth_folders = get_option('uploads_use_yearmonth_folders'); 19 $this->authconn( );19 $this->authconn($use_servicenet); 20 20 21 21 } 22 22 23 public function authconn( ) {23 public function authconn($use_servicenet) { 24 24 $auth = new CF_Authentication($this->authname,$this->authkey); 25 25 try { … … 31 31 return false; 32 32 } 33 $this->conn = new CF_Connection($auth );33 $this->conn = new CF_Connection($auth,$servicenet=$use_servicenet); 34 34 } 35 35 … … 51 51 } 52 52 53 public function attachment_upload($filepath ) {53 public function attachment_upload($filepath,$keep_logs=False) { 54 54 $file = str_replace($this->upload_path.'/','',$filepath); 55 55 if($this->uploads_use_yearmonth_folders) { … … 63 63 //need try/catch blocks here, all possible exceptions! 64 64 $wp_uploads = $this->conn->create_container($container_name); 65 $wp_uploads->log_retention($keep_logs); 65 66 $object = $wp_uploads->create_object($object_name); 66 67 try { -
cdn-tools/trunk/cdntools.php
r182426 r188582 5 5 Description: CDN Tools is a plugin designed to help you drastically speed up your blog's load time by loading content onto a distribution network. You can use a commercial CDN or just load some of your larger JS libraries for free from Google's servers! At this time Cloud Files is the only supported CDN. 6 6 Author: Paul Kehrer 7 Version: 0.9 87 Version: 0.99 8 8 Author URI: http://langui.sh/ 9 9 */ … … 28 28 set_time_limit(90); //90 seconds max... 29 29 30 define('CDNTOOLS_VERSION','0.9 8');30 define('CDNTOOLS_VERSION','0.99'); 31 31 32 32 $dir_array = explode('/',dirname(__FILE__)); … … 52 52 private $cdntools_authkey = null; 53 53 private $cdntools_adminscripts = null; 54 private $cndtools_sideload_uploads = null; 54 private $cdntools_sideload_uploads = null; 55 private $cdntools_logretention = null; 56 private $cdntools_servicenet = null; 55 57 private $cdntools_baseuris = array(); 56 58 private $uploaded_file_path = null; … … 98 100 $this->cdntools_adminscripts = get_option('cdntools_adminscripts'); 99 101 $this->cdntools_sideload_uploads = get_option('cdntools_sideload_uploads'); 102 $this->cdntools_logretention = get_option('cdntools_logretention'); 103 $this->cdntools_servicenet = get_option('cdntools_servicenet'); 100 104 $this->cdntools_advanced_options = get_option('cdntools_advanced_options'); 101 105 $wp_upload_dir = wp_upload_dir(); … … 238 242 $file_to_upload = $this->uploaded_file_path; 239 243 } 240 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );241 $return_array = $cdn_loader->attachment_upload($file_to_upload );244 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 245 $return_array = $cdn_loader->attachment_upload($file_to_upload, $this->cdntools_logretention); 242 246 if (!is_array($return_array)) { 243 247 return $return_array; … … 253 257 error_reporting(E_ERROR | E_WARNING | E_PARSE); 254 258 ini_set('display_errors',1); 255 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );259 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 256 260 $upload_return = $this->cdn_attachment_upload($_POST['post_id'],$_POST['path']); 257 261 if ($upload_return !== true) { … … 328 332 } 329 333 } 330 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );334 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 331 335 foreach($files_to_delete as $path) { 332 336 $cdn_loader->attachment_delete($path); … … 436 440 } 437 441 if( is_array($filestoload) ) { 438 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );442 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 439 443 $returndata = $cdn_loader->load_js_files($filestoload); 440 444 if ( $returndata[0] != '' && is_array($returndata[1]) ) { … … 447 451 448 452 function cdn_remove_container($container_name) { 449 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey );453 $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet); 450 454 $cdn_loader->remove_container($container_name); 451 455 unset($this->cdntools_baseuris[$container_name]); … … 464 468 register_setting( 'cdn-options-group', 'cdntools_adminscripts', 'absint' ); 465 469 register_setting( 'cdn-options-group', 'cdntools_sideload_uploads', 'absint' ); 470 register_setting( 'cdn-options-group', 'cdntools_logretention', 'absint' ); 471 register_setting( 'cdn-options-group', 'cdntools_servicenet', 'absint' ); 466 472 register_setting( 'cdn-options-group', 'cdntools_advanced_options', 'absint' ); 467 473 register_setting( 'cdn-options-group', 'cdntools_prefix', 'wp_filter_nohtml_kses' ); … … 532 538 delete_option('cdntools_adminscripts'); 533 539 delete_option('cdntools_sideload_uploads'); 540 delete_option('cdntools_logretention'); 541 delete_option('cdntools_servicenet'); 534 542 delete_option('cdntools_advanced_options'); 535 543 delete_option('cdntools_prefix'); … … 542 550 $this->cdntools_adminscripts = null; 543 551 $this->cdntools_sideload_uploads = null; 552 $this->cdntools_logretention = null; 553 $this->cdntools_servicenet = null; 544 554 $this->cdntools_advanced_options = null; 545 555 } … … 645 655 <td colspan="2">Check this to enable side loading of uploads to your CDN. Uploads will also be kept locally in the event that you wish to turn off the CDN/remove this plugin. Once you configure your CDN you probably want to turn this on.</td> 646 656 </tr> 657 <tr style="<?php echo $advanced_display; ?>"> 658 <th>Enable CDN Log Retention:</th> 659 <?php 660 $logretentioncheck = ($this->cdntools_logretention)?'checked="checked"':''; 661 ?> 662 <td><input type="checkbox" name="cdntools_logretention" value="1" <?php echo $logretentioncheck; ?> /></td> 663 </tr> 664 <tr style="<?php echo $advanced_display; ?>"> 665 <td colspan="2">Check this to enable CDN log retention. If enabled, logs will be periodically (at unpredictable intervals) compressed and uploaded to a ".CDN_ACCESS_LOGS" container in the form of "container_name.YYYYMMDDHH-XXXX.gz". After enabling or disabling this option, you will need to re-upload your attachments to Cloud Files (click the "Load Attachments" button below).</td> 666 </tr> 667 <tr style="<?php echo $advanced_display; ?>"> 668 <th>Enable Servicenet Connection:</th> 669 <?php 670 $servicenetcheck = ($this->cdntools_servicenet)?'checked="checked"':''; 671 ?> 672 <td><input type="checkbox" name="cdntools_servicenet" value="1" <?php echo $servicenetcheck; ?> /></td> 673 </tr> 674 <tr style="<?php echo $advanced_display; ?>"> 675 <td colspan="2">Check this to enable the Servicenet connection to Cloud Files. If enabled, traffic to Cloud Files will use Rackspace's internal network to upload data to Cloud Files. This internal connection will almost always be faster than non-servicenet connections, and bandwidth on servicenet is free. However, servicenet connections will only work if this blog is hosted on a server that is hosted by Rackspace or Slicehost. <b>Rackspace Cloud Sites does not currently support the servicenet.</b></td> 676 </tr> 647 677 <!--tr style="<?php echo $advanced_display; ?>"> 648 678 <th>Load wp-admin Javascripts:</th> … … 651 681 ?> 652 682 <td><input type="checkbox" name="cdntools_adminscripts" value="1" <?php echo $adminupcheck; ?> /></td> 653 </tr -->683 </tr> 654 684 <tr style="<?php echo $advanced_display; ?>"> 655 685 <td colspan="2">Check this if you want the wp-admin javascript files to be put on your CDN. Typically you will want to leave this unchecked.</td> 656 </tr >686 </tr--> 657 687 <tr style="<?php echo $advanced_display; ?>"> 658 688 <th>CDN Container Prefix:</th> -
cdn-tools/trunk/readme.txt
r182426 r188582 4 4 Tags: cdn, sideload, speed, content, distribution, performance, cloudfiles, files, media, accelerator, cloud 5 5 Requires at least: 2.8 6 Tested up to: 2.9 7 Stable tag: 0.9 86 Tested up to: 2.9.1 7 Stable tag: 0.99 8 8 9 9 CDN Tools is a plugin designed to help you drastically speed up your blog's load time by loading data onto a content distribution network (CDN). … … 42 42 43 43 == Changelog == 44 = 0.99 = 45 * Log retention support (in advanced options) 46 * Servicenet flag (in advanced options) 47 * Both these features were added courtesy of John Dickinson 44 48 45 49 = 0.98 = … … 49 53 50 54 = 0.97 - 12/9/2009 = 51 * Initial sideload AJAX used an absolute path with the siteurl. This should have been a relative path or the adminurl to accommodate situations w ere FORCE_SSL_ADMIN is defined. Thanks to John for identifying the bug.55 * Initial sideload AJAX used an absolute path with the siteurl. This should have been a relative path or the adminurl to accommodate situations where FORCE_SSL_ADMIN is defined. Thanks to John for identifying the bug. 52 56 53 57 = 0.96 - 12/4/2009 =
Note: See TracChangeset
for help on using the changeset viewer.