sm:sync::syncFile

sm:sync::syncFile

Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wp-stateless.4.1.2

do_action('sm:sync::syncFile') is found 13 times:

  • /lib/classes/compatibility/ewww.php line 40
           */
          public function pre_optimization( $file, $type, $fullsize ) {
            // wp_stateless_file_name filter will remove the basedir from the path and prepend with root dir.
            $name = apply_filters( 'wp_stateless_file_name', $file );
            do_action( 'sm:sync::syncFile', $name, $file, true, array( 'ephemeral' => false, 'download' => true, 'use_root' => true ) );
          }
    
          /**
           * If image size not exist then upload it to GS.
           *
           * @param $file
    
  • /lib/classes/compatibility/ewww.php line 53
           */
          public function post_optimization( $file, $type, $fullsize ) {
            // wp_stateless_file_name filter will remove the basedir from the path and prepend with root dir.
            $name = apply_filters( 'wp_stateless_file_name', $file );
            do_action( 'sm:sync::syncFile', $name, $file, true, array( 'use_root' => true ) );
    
    
            // if($fullsize && file_exists($file . '.bak'))
            //     do_action( 'sm:sync::syncFile', $name . '.bak', $file . '.bak', true);
    
            if( file_exists( $file . '.webp' ) ) {
    
  • /lib/classes/compatibility/ewww.php line 57
            do_action( 'sm:sync::syncFile', $name, $file, true, array( 'use_root' => true ) );
    
    
            // if($fullsize && file_exists($file . '.bak'))
            //     do_action( 'sm:sync::syncFile', $name . '.bak', $file . '.bak', true);
    
            if( file_exists( $file . '.webp' ) ) {
              add_filter( 'upload_mimes', array( $this, 'add_webp_mime' ), 10, 2 );
              do_action( 'sm:sync::syncFile', $name . '.webp', $file . '.webp', true, array( 'use_root' => true ) );
              remove_filter( 'upload_mimes', array( $this, 'add_webp_mime' ), 10 );
            }
    
  • /lib/classes/compatibility/ewww.php line 61
            //     do_action( 'sm:sync::syncFile', $name . '.bak', $file . '.bak', true);
    
            if( file_exists( $file . '.webp' ) ) {
              add_filter( 'upload_mimes', array( $this, 'add_webp_mime' ), 10, 2 );
              do_action( 'sm:sync::syncFile', $name . '.webp', $file . '.webp', true, array( 'use_root' => true ) );
              remove_filter( 'upload_mimes', array( $this, 'add_webp_mime' ), 10 );
            }
          }
    
        }
    
    
  • /lib/classes/compatibility/imagify.php line 199
              if (file_exists($backup_path)) {
                $overwrite = apply_filters('imagify_backup_overwrite_backup', false, $file_path, $backup_path);
                // wp_stateless_file_name filter will remove the basedir from the path and prepend with root dir.
                $name = apply_filters('wp_stateless_file_name', $backup_path);
                do_action('sm:sync::syncFile', $name, $backup_path, $overwrite);
              }
            }
          }
    
          /**
           * Restore backup file from GCS if not exist.
    
  • /lib/classes/compatibility/imagify.php line 215
            if (!file_exists($backup_path)) {
              $upload_dir = wp_upload_dir();
              $name = str_replace(trailingslashit($upload_dir['basedir']), '', $backup_path);
              $name = apply_filters('wp_stateless_file_name', $name);
              do_action('sm:sync::syncFile', $name, $backup_path, true);
            }
          }
    
          /**
           * Check if backup exists in GCS.
           * @param $return
    
  • /lib/classes/compatibility/imagify.php line 252
              add_filter('upload_mimes', array($this, 'add_webp_mime'), 10, 2);
              /**
               * Media already on GCS, so only replacing data on it. For webp format adding path and status to wp_stateless_files table
               */
              do_action('sm:sync::syncFile', $name, $file, true, array('use_root' => true, 'skip_db' => (substr($name, -4) == "webp" ? false : true)));
              remove_filter('upload_mimes', array($this, 'add_webp_mime'), 10);
            }
          }
    
          /**
           * @param $return
    
  • /lib/classes/compatibility/imagify.php line 274
              $attachment_id = $this->getProperties($this->getProperties($this->getProperties($process)['data'])['media'])['id'];
    
              $full_size_path = $file->get_path();
              $name = apply_filters('wp_stateless_file_name', basename($full_size_path), true, $attachment_id);
              do_action('sm:sync::syncFile', $name, $full_size_path, true, ['download' => true]);
              // error_log("\n\ndo_action( 'sm:sync::syncFile', $name, $full_size_path, true, ['download' => true] );");
            } catch (\Throwable $th) {
              //throw $th;
            }
            return $return;
          }
    
  • /lib/classes/compatibility/imagify.php line 275
     
              $full_size_path = $file->get_path();
              $name = apply_filters('wp_stateless_file_name', basename($full_size_path), true, $attachment_id);
              do_action('sm:sync::syncFile', $name, $full_size_path, true, ['download' => true]);
              // error_log("\n\ndo_action( 'sm:sync::syncFile', $name, $full_size_path, true, ['download' => true] );");
            } catch (\Throwable $th) {
              //throw $th;
            }
            return $return;
          }
    
    
  • /lib/classes/compatibility/shortpixel.php line 292
              }
    
              $absolutePath = trailingslashit($backup_path) . basename($metadata['file']);
              $name = apply_filters('wp_stateless_file_name', SHORTPIXEL_BACKUP . '/' . $fullSubDir . basename($metadata['file']));
              do_action('sm:sync::syncFile', $name, $absolutePath, $force, $args);
    
              foreach ((array) $metadata['sizes'] as $image_size => $data) {
                $absolutePath = trailingslashit($backup_path) . $data['file'];
                $name = apply_filters('wp_stateless_file_name', SHORTPIXEL_BACKUP . '/' . $fullSubDir . $data['file']);
    
                do_action('sm:sync::syncFile', $name, $absolutePath, $force, $args);
    
  • /lib/classes/compatibility/shortpixel.php line 298
              foreach ((array) $metadata['sizes'] as $image_size => $data) {
                $absolutePath = trailingslashit($backup_path) . $data['file'];
                $name = apply_filters('wp_stateless_file_name', SHORTPIXEL_BACKUP . '/' . $fullSubDir . $data['file']);
    
                do_action('sm:sync::syncFile', $name, $absolutePath, $force, $args);
              }
            }
          }
    
          /**
           * Sync from sync tab
    
  • /lib/classes/compatibility/wp-smush.php line 211
                $gs_name = $gs_dir . '/' . basename($data['file']);
                // Path of backup image
                $backup_path = $base_dir . '/' . basename($data['file']);
                // Sync backup image with GCS
                do_action('sm:sync::syncFile', apply_filters('wp_stateless_file_name', $gs_name), $backup_path);
                delete_transient('sm-wp-smush-backup-exists-' . $attachment_id);
              }
            }
          }
    
          /**
    
  • /lib/classes/sync/class-non-library-sync.php line 120
          $file_path = trim($item, '/');
          $basedir = ud_get_stateless_media()->is_mode('stateless') ? ud_get_stateless_media()->get_gs_path() : $upload_dir['basedir'];
          $fullsizepath = $basedir . '/' . $file_path;
    
          do_action('sm:sync::syncFile', $file_path, $fullsizepath, true, ['remove_from_queue' => true, 'manual_sync' => true]);
    
          $this->log(sprintf(__('%1$s (ID %2$s) was successfully synchronised in %3$s seconds.', ud_get_stateless_media()->domain), esc_html(get_the_title($file_path)), $file_path, timer_stop()));
    
          parent::task($item);
          return false;
        } catch (FatalException $e) {
    

See this hook used in plugins: