Plugin Directory

Changeset 987060


Ignore:
Timestamp:
09/11/2014 07:49:12 AM (12 years ago)
Author:
trillamar
Message:

optimized file cached video using sym links

Location:
secure-html5-video-player/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • secure-html5-video-player/trunk/sh5vp-functions.php

    r985103 r987060  
    19881988    }
    19891989    if ($secure_html5_video_player_serve_method == 'dynamic') {
     1990        file_get_contents("{$plugin_dir}/prepvideo.php?k=" . urlencode($access_key) . "&onlyclean=1&file=" . urlencode($file . '.' . $ext));
    19901991        return $dynamic_url;
    19911992    }
     
    19992000    $sh5vp_cache_index = $sh5vp_cache . 'index.php';
    20002001    if (!file_exists($sh5vp_cache_index)) {
    2001         $fp = fopen($sh5vp_cache_index, 'w');
    2002         fwrite($fp, "<?php \n// Silence is golden.\n?>");
    2003         fclose($fp);
     2002        secure_html5_video_player_write_silence_file($sh5vp_cache_index);
    20042003    }
    20052004   
     
    20272026   
    20282027    if (!file_exists($video_cache_dir_index)) {
    2029         $fp = fopen($video_cache_dir_index, 'w');
    2030         fwrite($fp, "<?php \n// Silence is golden.\n?>");
    2031         fclose($fp);
     2028        secure_html5_video_player_write_silence_file($video_cache_dir_index);
    20322029    }
    20332030    if (!file_exists($video_cache_dir_index2)) {
    2034         $fp = fopen($video_cache_dir_index2, 'w');
    2035         fwrite($fp, "<?php \n// Silence is golden.\n?>");
    2036         fclose($fp);
     2031        secure_html5_video_player_write_silence_file($video_cache_dir_index2);
    20372032    }
    20382033
    20392034    if (!file_exists($video_cache) || abs(filesize($video_orig) - filesize($video_cache)) > 512) {
    2040         copy($video_orig, $video_cache);
    2041     }
    2042    
    2043     secure_html5_video_player_footer_cleanup();
     2035        file_get_contents("{$plugin_dir}/prepvideo.php?k=" . urlencode($access_key) . "&file=" . urlencode($file . '.' . $ext));
     2036    }
     2037   
    20442038    if (file_exists($video_cache)) {
    20452039        return content_url() . '/sh5vp_cache/' . $date_str . '/' . $access_key . '/' . $filename_normalized_ext;
     
    20472041    return $dynamic_url;
    20482042}
     2043endif;
     2044
     2045
     2046
     2047if ( !function_exists('secure_html5_video_player_write_silence_file') ):
     2048function secure_html5_video_player_write_silence_file($filepath) {
     2049    $fp = fopen($filepath, 'w');
     2050    fwrite($fp, "<?php \n// Silence is golden.\n?>");
     2051    fclose($fp);
     2052}
    20492053endif;
    20502054
     
    20832087    date_default_timezone_set($script_tz);
    20842088
     2089    $secure_html5_video_player_serve_method = get_option('secure_html5_video_player_serve_method');
    20852090    $sh5vp_cache = secure_html5_video_player_parent_path_with_file(__FILE__, 'wp-config.php', 10) . '/wp-content/sh5vp_cache/';
    20862091    $sh5vp_cache_ls = scandir($sh5vp_cache);
    20872092    foreach ($sh5vp_cache_ls as $currdir) {
    2088         if ($currdir != $date_str
    2089         && $currdir != $date_str_yesterday
    2090         && $currdir != '.'
     2093        if ($currdir != '.'
    20912094        && $currdir != '..'
    20922095        && $currdir != 'index.php'
    2093         && is_numeric($currdir)) {
    2094             secure_html5_video_player_rrmdir($sh5vp_cache . $currdir);
     2096        && is_numeric($currdir)
     2097        && ($secure_html5_video_player_serve_method == 'dynamic'
     2098            || $currdir != $date_str && $currdir != $date_str_yesterday)) {
     2099            secure_html5_video_player_rrmdir($sh5vp_cache . $currdir);         
    20952100        }       
    20962101    }
Note: See TracChangeset for help on using the changeset viewer.