PluginProbe
SQLite Object Cache / 1.6.0
SQLite Object Cache v1.6.0
1.6.5 trunk 0.1.7 1.0.0 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4.0 1.4.1 1.5.1 1.5.4 1.5.5 1.5.6 1.5.7 All 30 releases
sqlite-object-cache / includes / lib / class-sqlite-backup-exclusion.php

class-sqlite-backup-exclusion.php in SQLite Object Cache 1.6.0, at includes/lib/class-sqlite-backup-exclusion.php

90 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main plugin class file.
4 *
5 * @package WordPress Plugin Template/Includes
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 /**
13 * Backup file exclusion filters.
14 *
15 * Only make one instance of this, please.
16 */
17 class SQLite_Backup_Exclusion {
18 public function __construct() {
19 global $wp_object_cache;
20 if ( method_exists( $wp_object_cache, 'sqlite_files' ) ) {
21 add_filter( 'updraftplus_exclude_file', array( $this, 'updraftplus_exclude_file' ), 10, 2 );
22 add_filter( 'backwpup_file_exclude', array( $this, 'backwpup_file_exclude' ), 10, 1 );
23 add_filter( 'wpstg_clone_excluded_files', array( $this, 'wpstg_clone_excluded_files' ), 10, 1 );
24 add_filter( 'wpstg_push_excluded_files', array( $this, 'wpstg_clone_excluded_files' ), 10, 1 );
25 }
26 }
27
28
29
30 /**
31 * Filter for Updraft Plus backup exclusion
32 *
33 * @param $filter
34 * @param $file
35 *
36 * @return bool|mixed
37 */
38 function updraftplus_exclude_file( $filter, $file ) {
39 global $wp_object_cache;
40 if ( method_exists( $wp_object_cache, 'sqlite_files' ) ) {
41 foreach ( $wp_object_cache->sqlite_files() as $sqlite_file ) {
42 if ( basename( $sqlite_file ) === basename( $file ) ) {
43 return true;
44 }
45 }
46 }
47
48 return $filter;
49 }
50
51 /**
52 * Filter for BackWPUp backup exclusion
53 *
54 * @param string $list Comma-separated list of files to skip.
55 *
56 * @return string Comma-separated list of files to skip.
57 */
58 public function backwpup_file_exclude( $list ) {
59 global $wp_object_cache;
60 $files = array();
61 $files [] = $list;
62 if ( method_exists( $wp_object_cache, 'sqlite_files' ) ) {
63 foreach ( $wp_object_cache->sqlite_files() as $file ) {
64 $files [] = basename( $file );
65 }
66 }
67
68 return implode( ',', $files );
69 }
70
71 /**
72 * Filter for WP STAGING cloning and pushing exclusion
73 *
74 * @param array $files
75 *
76 * @return array
77 */
78 public function wpstg_clone_excluded_files( $files ) {
79 global $wp_object_cache;
80 if ( method_exists( $wp_object_cache, 'sqlite_files' ) ) {
81 foreach ( $wp_object_cache->sqlite_files() as $file ) {
82 $files [] = basename( $file );
83 }
84 }
85
86 return $files;
87 }
88
89 }
90