Changeset 729295
- Timestamp:
- 06/21/2013 08:27:21 AM (13 years ago)
- Location:
- amazon-s3-uploads/trunk
- Files:
-
- 4 edited
-
asssu.php (modified) (3 diffs)
-
plugin/asssu/__init.php (modified) (7 diffs)
-
plugin/asssu/forms.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
amazon-s3-uploads/trunk/asssu.php
r728976 r729295 6 6 Author URI: https://profiles.google.com/117859515361389646005 7 7 Description: Moves your uploads to Amazon S3 via cron jobs. 8 Version: 1.9. 18 Version: 1.9.2 9 9 */ 10 10 … … 14 14 register_activation_hook(__FILE__, 'activation_hook'); 15 15 function activation_hook() { 16 global $asssu;16 $asssu = new \asssu\Asssu(); 17 17 $asssu->activation_hook(); 18 18 } … … 20 20 register_deactivation_hook(__FILE__, 'deactivation_hook'); 21 21 function deactivation_hook() { 22 global $asssu;22 $asssu = new \asssu\Asssu(); 23 23 $asssu->deactivation_hook(); 24 24 } -
amazon-s3-uploads/trunk/plugin/asssu/__init.php
r728997 r729295 42 42 43 43 public static 44 $version = '1.9. 1';44 $version = '1.9.2'; 45 45 46 46 public … … 68 68 # na kano prepare 69 69 $this->config = $this->db->wpdb->get_row('SELECT * FROM '.$this->db->table.' WHERE site_url like "'.$this->site_url.'"', ARRAY_A); 70 $this->config['is_active'] = $this->config['is_active'] === '1'; 70 71 ob_end_clean(); 71 72 $this->check_version(); … … 74 75 $this->cron_integration = new AsssuCronIntegration($this); 75 76 $this->file_managment_integration = new AsssuFileManagmentIntegration($this); 77 $this->file_plugins_integration = new AsssuPluginsManagmentIntegration($this); 76 78 } 77 79 } … … 126 128 127 129 $this->db->create(); 130 $this->config['version'] = '1.9.1'; 128 131 $this->config['access_key'] = $old_config['asssu_access_key']; 129 132 $this->config['secret_key'] = $old_config['asssu_secret_key']; … … 136 139 } 137 140 138 //function upgrade_1_9_1() {139 //$this->config['version'] = '1.9.2';140 //$this->db->save_config();141 //return $this->config['version'];142 //}141 function upgrade_1_9_1() { 142 $this->config['version'] = '1.9.2'; 143 $this->db->save_config(); 144 return $this->config['version']; 145 } 143 146 144 147 function convert_to_s3_path($path, $stream_wrapper_format=true) { 145 $s3_path = $this->config['bucket_subdir'].'/'.trim(str_replace($this->wp_upload_dir['basedir'], '', $path), '/'); 148 if (strpos($path, 's3://') === 0) 149 return $path; 150 $s3_path = trim(str_replace($this->wp_upload_dir['basedir'], '', $path), '/'); 151 if (!empty($this->config['bucket_subdir'])) 152 $s3_path = trim($this->config['bucket_subdir'].'/'.$s3_path, '/'); 146 153 if ($stream_wrapper_format) 147 154 $s3_path = sprintf('s3://%s/%s', $this->config['bucket_name'], $s3_path); … … 277 284 function __construct($asssu) { 278 285 $this->asssu = $asssu; 286 // add_filter('upload_dir', array($this, 'upload_dir')); 279 287 add_filter('wp_handle_upload_prefilter', array($this, 'wp_handle_upload_prefilter')); 280 288 add_filter('wp_delete_file', array($this, 'wp_delete_file')); 289 } 290 291 function upload_dir($args) { 292 $client = $this->asssu->get_s3_client(); 293 $args['path'] = $this->asssu->convert_to_s3_path($args['path']); 294 $args['basedir'] = $this->asssu->convert_to_s3_path($args['basedir']); 295 return $args; 281 296 } 282 297 … … 340 355 @ unlink($s3_path); 341 356 return $file; 357 } 358 } 359 360 class AsssuPluginsManagmentIntegration { 361 362 function __construct($asssu) { 363 $this->asssu = $asssu; 364 // add_filter('bp_core_avatar_upload_path', array($this, 'bp_core_avatar_upload_path')); 365 // add_filter('bp_core_avatar_folder_dir', array($this, 'bp_core_avatar_folder_dir')); 366 } 367 368 function bp_core_avatar_upload_path($basedir) { 369 $client = $this->asssu->get_s3_client(); 370 return $this->asssu->convert_to_s3_path($basedir); 371 } 372 373 function bp_core_avatar_folder_dir($avatar_folder_dir) { 374 $client = $this->asssu->get_s3_client(); 375 return $this->asssu->convert_to_s3_path($avatar_folder_dir); 342 376 } 343 377 } -
amazon-s3-uploads/trunk/plugin/asssu/forms.php
r728976 r729295 16 16 $options = array(); 17 17 $options['initial'] = $this->asssu->config; 18 unset($options['initial']['is_active']);19 18 } 20 19 parent::__construct($data, $files, $options); … … 37 36 require_once __DIR__.'/../../lib/aws-sdk-php/aws-autoloader.php'; 38 37 39 // the connection40 38 // for some reason this does not throw exception 41 39 // when you try to connect with wrong credentials -
amazon-s3-uploads/trunk/readme.txt
r728762 r729295 5 5 Requires at least: 3.5.1 6 6 Tested up to: 3.5.1 7 Stable tag: 1.9. 17 Stable tag: 1.9.2 8 8 License: GPLv2.1 9 9
Note: See TracChangeset
for help on using the changeset viewer.