Plugin Directory

Changeset 3432115


Ignore:
Timestamp:
01/04/2026 02:04:25 PM (3 months ago)
Author:
davidfcarr
Message:

zip files fix

Location:
quick-playground/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • quick-playground/trunk/api.php

    r3431953 r3432115  
    144144    $clone['post_count'] = count($clone['posts']);
    145145    $clone = qckply_zip_images($profile,$clone);
    146     $clone['post_count_with_images'] = count($clone['posts']);
     146    $clone['post_count_with_images'] = is_array($clone['posts']) ? count($clone['posts']) : 'error';
    147147    $clone = qckply_posts_related($clone);
    148148    $clone = qckply_get_menu_data($clone);
  • quick-playground/trunk/blueprint-builder.php

    r3431953 r3432115  
    180180$clone = qckply_zip_images($profile,$clone,true);
    181181
    182 printf('<h2>Zip images Test</h2><p>%s</p><pre>%s</pre>',$clone['images_zip'],var_export($clone['added_images'],true));
     182printf('<h2>Zip Images Test</h2><p>%s</p><pre>%s</pre><pre>%s</pre>',$clone['images_zip'],var_export($clone['added_images'],true),var_export($clone['not_found'],true));
    183183foreach($clone['posts'] as $post) {
    184184    if($post->post_type == 'attachment')
    185185    printf('<h3>Post ID %d: %s</h3><div>%s</div>',intval($post->ID),esc_html($post->post_title),wp_kses_post($post->guid));
    186186}
     187
     188printf('<p>Quickplay Directories:</p><pre>%s</pre><p>WP Directories</p><pre>%s</pre>',var_export($qckply_directories,true),var_export(wp_get_upload_dir(),true));
    187189
    188190echo '</div>';
  • quick-playground/trunk/makeBlueprintItem.php

    r3431953 r3432115  
    5656function qckply_makeZipImagesItem($profile) {
    5757    $qckply_directories = qckply_get_directories();
    58     $path = trailingslashit($qckply_directories['uploads_url']).$profile.'_images.zip';
     58    $path = trailingslashit($qckply_directories['site_uploads_url']).$profile.'_images.zip';
    5959    return qckply_makeBlueprintItem('importWordPressFiles', array("wordPressFilesZip"=>array('resource'=>'url','url'=>$path)));
    6060}
  • quick-playground/trunk/quick-playground.php

    r3432092 r3432115  
    44 * Plugin URI:  https://quickplayground.com
    55 * Description: Preview your content in different themes or test plugins using WordPress Playground. Quickly create Theme and Plugin demo, testing, and staging websites.
    6  * Version:     1.0.6
     6 * Version:     1.0.7
    77 * Author:      David F. Carr
    88*  License:     GPL2
  • quick-playground/trunk/readme.txt

    r3432092 r3432115  
    99Tested up to: 6.9
    1010
    11 Stable tag: 1.0.6
     11Stable tag: 1.0.7
    1212
    1313License: GPLv2 or later 
     
    9797== Changelog ==
    9898
     99= 1.0.7 =
     100
     101* Fix for zip images function, multisite
     102
    99103= 1.0.4 =
    100104
  • quick-playground/trunk/utility.php

    r3431953 r3432115  
    10461046    $qckply_directories = qckply_get_directories();
    10471047    $get_all_attachments = get_option('qckply_get_all_attachments',false);
    1048     $qckply_uploads = $qckply_directories['uploads'];
     1048    $qckply_uploads = $qckply_directories['site_uploads'];
    10491049    $upload = wp_get_upload_dir();
    10501050    $att_ids = [];
     
    11301130
    11311131    if ($zip->open($zip_filepath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== TRUE) {
     1132        error_log(sprintf('<p>Zip creation failed for %s</p>',$zip_filepath));
    11321133        return false; // Zip file creation failed
    11331134    }
     
    11351136    // Add each image file to zip with /wp-content/uploads relative path
    11361137    $added = [];
     1138    $notfound = [];
    11371139    foreach ($all_images as $file_path) {
     1140        if(empty($file_path))
     1141            continue;
    11381142        if(strpos($file_path,$base_dir) === false) {
    11391143            $file_path = $base_dir . $file_path;
    11401144        }
    11411145        if (!file_exists($file_path) || in_array($file_path, $added)) {
     1146            $notfound[] = 'not found '.$file_path;
    11421147            //if($debug) printf('<p>skipping %s</p>',$file_path);
    11431148            continue;
     
    11501155
    11511156        //if($debug) printf('<p>adding %s</p>',$file_path);
    1152         $zip->addFile($file_path, $relative_path);
     1157        $result = $zip->addFile($file_path, $relative_path);
     1158        if(!$result)
     1159        error_log(sprintf('<p>file path %s<br />relative %s<br />%s</p>',$file_path,$relative_path,var_export($result,true)));
     1160
    11531161    }
    11541162
    11551163    if (!$zip->close()) {
     1164        if (method_exists($zip, 'getStatusString')) error_log('zip status text: ' . $zip->getStatusString());
    11561165        return false; // Failed to close zip
    11571166    }
     
    11731182    }
    11741183    $clone['added_images'] = $added;
     1184    $clone['not_found'] = $notfound;
    11751185    $clone['images_zip'] = sprintf(
    11761186        __('Images zipped successfully! %d files added. Zip file: %s', 'quick-playground'),
Note: See TracChangeset for help on using the changeset viewer.