gdwpm_make_update

The Google Drive WP Media gdwpm make update function.

Description

gdwpm_make_update(); 

Usage

  1. if ( !function_exists( 'gdwpm_make_update' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-drive-wp-media/google-drive-wp-media.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gdwpm_make_update(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/google-drive-wp-media.php  
  1. function gdwpm_make_update() { 
  2. $gdwpm_old_version = get_option('gdwpm_version');  
  3. if($gdwpm_old_version != VERSI_GDWPM) { 
  4. update_option('gdwpm_version', VERSI_GDWPM); 
  5. $gdwpm_dummy_fol_old = get_option('gdwpm_dummy_folder');  
  6. if(!is_array($gdwpm_dummy_fol_old)) { 
  7. $gdwpm_dummy_fol = array('status'=>'checked', 'dirname'=>'gdwpm_images', 'dirlist'=>array('gdwpm_images'), 'pattern'=>'2', 'pref'=>'checked'); 
  8. update_option('gdwpm_dummy_folder', $gdwpm_dummy_fol); 
  9. }else{ 
  10. //cek folder  
  11. foreach($gdwpm_dummy_fol_old['dirlist'] as $dir) { 
  12. $upload_dir = wp_upload_dir(); 
  13. $targetDir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $dir; 
  14. if (file_exists($targetDir)) { 
  15. //savety 1st, rename only.. delete manually 
  16. @rename($targetDir . '/gdwpmrw.php', $targetDir . '/gdwpmrw.php-GDWPM-delete-manually'); //unlink($targetDir . '/gdwpmrw.php'); 
  17. @rename($targetDir . '/.htaccess', $targetDir . '/.htaccess-GDWPM-delete-manually');//unlink($targetDir . '/.htaccess'); 
  18. @rename($targetDir . '/index.php', $targetDir . '/index.php-GDWPM-delete-manually'); 
  19. @rename($upload_dir['basedir'] . DIRECTORY_SEPARATOR . $dir, $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $dir . '-GDWPM-delete-manually'); 
  20. $gdwpm_dummy_fol_old['pattern'] = '1'; 
  21. update_option('gdwpm_dummy_folder', $gdwpm_dummy_fol_old);