BackUpWordPress - Version 3.6.3

Version Description

= 3.4 =

  • This version introduces a major refactoring of the code responsible for the core backup engine. We made sure to write unit tests for the new code, and we have tested it on several user's sites. It fixes a lot of old bugs, and Windows users should see major improvements to reliability.

= 3.3.4 =

  • WordPress 4.4 compatibility.

= 3.3.1 =

  • Fixes a bug that would prevent downloading backups since 3.3.0 - please update.

= 3.2.5 =

  • Security fixes related to add_query_arg

= 3.2.1 =

  • Important bug fixes. Please upgrade to this version to avoid incomplete or broken backups.

= 3.1.3 =

  • Fixes backwards compatibility for add-ons and avoids a Fatal Error. Please upgrade straight to this version before upgrading your add-ons.

= 3.0.4 =

  • Fixes a few minor bugs. Immediate update is recommended.

= 3.0.2 =

  • Important: we have dropped support for PHP 5.2, you will not be able to activate BackUpWordPress on a server running PHP versions older than PHP 5.3.29

= 3.0.1 =

  • This is a critical update. Fixes a bug in the core backup library. Please update immediately.
Download this release

Release Info

Developer sambulance
Plugin Icon 128x128 BackUpWordPress
Version 3.6.3
Comparing to
See all releases

Code changes from version 3.6.2 to 3.6.3

Files changed (99) hide show
  1. admin/actions.php +3 -5
  2. admin/extensions.php +132 -96
  3. admin/menu.php +22 -0
  4. admin/page.php +6 -7
  5. admin/schedule-form-excludes.php +20 -16
  6. admin/schedule-form.php +2 -2
  7. admin/schedule-sentence.php +8 -7
  8. admin/schedule-settings.php +5 -1
  9. assets/hmbkp.css +3 -18
  10. assets/hmbkp.js +1 -16
  11. assets/hmbkp.min.css +1 -1
  12. assets/hmbkp.min.js +1 -24
  13. backupwordpress.php +1 -1
  14. classes/backup/class-backup-engine-database-mysqldump.php +2 -2
  15. classes/backup/class-backup-engine-database.php +2 -2
  16. classes/backup/class-backup-engine-file-zip.php +4 -2
  17. classes/backup/class-backup-engine-file.php +4 -4
  18. classes/backup/class-backup-engine.php +19 -12
  19. classes/backup/class-backup-status.php +7 -1
  20. classes/backup/class-backup.php +3 -1
  21. classes/class-email-service.php +4 -4
  22. classes/class-excludes.php +43 -21
  23. classes/class-notices.php +2 -2
  24. classes/class-path.php +12 -15
  25. classes/class-plugin.php +1 -1
  26. classes/class-requirement.php +64 -42
  27. classes/class-requirements.php +3 -8
  28. classes/class-site-size.php +23 -14
  29. composer.lock +15 -15
  30. functions/core.php +0 -4
  31. functions/interface.php +1 -1
  32. languages/backupwordpress.pot +85 -87
  33. readme.txt +13 -3
  34. vendor/autoload.php +1 -1
  35. vendor/composer/ClassLoader.php +7 -5
  36. vendor/composer/LICENSE +1 -1
  37. vendor/composer/autoload_real.php +24 -17
  38. vendor/composer/installed.json +66 -66
  39. vendor/ifsnop/mysqldump-php/src/Ifsnop/Mysqldump/Mysqldump.php +75 -16
  40. vendor/symfony/finder/.gitignore +0 -3
  41. vendor/symfony/finder/Iterator/DateRangeFilterIterator.php +1 -1
  42. vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php +2 -1
  43. vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php +5 -0
  44. vendor/symfony/finder/Iterator/SortableIterator.php +2 -2
  45. vendor/symfony/finder/README.md +0 -14
  46. vendor/symfony/finder/Tests/BsdFinderTest.php +0 -34
  47. vendor/symfony/finder/Tests/Comparator/ComparatorTest.php +0 -64
  48. vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php +0 -63
  49. vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php +0 -107
  50. vendor/symfony/finder/Tests/Expression/ExpressionTest.php +0 -71
  51. vendor/symfony/finder/Tests/Expression/GlobTest.php +0 -50
  52. vendor/symfony/finder/Tests/Expression/RegexTest.php +0 -146
  53. vendor/symfony/finder/Tests/FakeAdapter/DummyAdapter.php +0 -57
  54. vendor/symfony/finder/Tests/FakeAdapter/FailingAdapter.php +0 -45
  55. vendor/symfony/finder/Tests/FakeAdapter/NamedAdapter.php +0 -57
  56. vendor/symfony/finder/Tests/FakeAdapter/UnsupportedAdapter.php +0 -44
  57. vendor/symfony/finder/Tests/FinderTest.php +0 -745
  58. vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat +0 -0
  59. vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat +0 -0
  60. vendor/symfony/finder/Tests/Fixtures/A/a.dat +0 -0
  61. vendor/symfony/finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy +0 -0
  62. vendor/symfony/finder/Tests/Fixtures/copy/A/B/ab.dat.copy +0 -0
  63. vendor/symfony/finder/Tests/Fixtures/copy/A/a.dat.copy +0 -0
  64. vendor/symfony/finder/Tests/Fixtures/dolor.txt +0 -2
  65. vendor/symfony/finder/Tests/Fixtures/ipsum.txt +0 -2
  66. vendor/symfony/finder/Tests/Fixtures/lorem.txt +0 -2
  67. vendor/symfony/finder/Tests/Fixtures/one/a +0 -0
  68. vendor/symfony/finder/Tests/Fixtures/one/b/c.neon +0 -0
  69. vendor/symfony/finder/Tests/Fixtures/one/b/d.neon +0 -0
  70. vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat +0 -0
  71. vendor/symfony/finder/Tests/Fixtures/with space/foo.txt +0 -0
  72. vendor/symfony/finder/Tests/GlobTest.php +0 -25
  73. vendor/symfony/finder/Tests/GnuFinderTest.php +0 -34
  74. vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php +0 -46
  75. vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php +0 -74
  76. vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php +0 -83
  77. vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php +0 -66
  78. vendor/symfony/finder/Tests/Iterator/FilePathsIteratorTest.php +0 -72
  79. vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php +0 -73
  80. vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php +0 -86
  81. vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php +0 -54
  82. vendor/symfony/finder/Tests/Iterator/FilterIteratorTest.php +0 -51
  83. vendor/symfony/finder/Tests/Iterator/Iterator.php +0 -55
  84. vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php +0 -98
  85. vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php +0 -21
  86. vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php +0 -134
  87. vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php +0 -70
  88. vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php +0 -83
  89. vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php +0 -110
  90. vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php +0 -59
  91. vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php +0 -69
  92. vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php +0 -183
  93. vendor/symfony/finder/Tests/PhpFinderTest.php +0 -45
  94. vendor/symfony/finder/Tests/Shell/CommandTest.php +0 -165
  95. vendor/symfony/process/ExecutableFinder.php +2 -2
  96. vendor/symfony/process/Pipes/AbstractPipes.php +1 -3
  97. vendor/symfony/process/Pipes/UnixPipes.php +1 -1
  98. vendor/symfony/process/Pipes/WindowsPipes.php +8 -3
  99. vendor/symfony/process/Tests/ProcessTest.php +1 -1
admin/actions.php CHANGED
@@ -233,9 +233,7 @@ function edit_schedule_submit() {
233
  $schedule = new Scheduled_Backup( sanitize_text_field( $_POST['hmbkp_schedule_id'] ) );
234
  $site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() );
235
 
236
- $errors = array();
237
-
238
- $settings = array();
239
 
240
  if ( isset( $_POST['hmbkp_schedule_type'] ) ) {
241
 
@@ -372,7 +370,7 @@ function edit_schedule_submit() {
372
  // Remove any old backups in-case max backups was reduced
373
  $schedule->delete_old_backups();
374
 
375
- if ( $errors ) {
376
  foreach ( $errors as $error ) {
377
  add_settings_error( $error );
378
  }
@@ -380,7 +378,7 @@ function edit_schedule_submit() {
380
 
381
  $redirect = remove_query_arg( array( 'hmbkp_panel', 'action' ), wp_get_referer() );
382
 
383
- if ( $errors ) {
384
  $redirect = wp_get_referer();
385
  }
386
 
233
  $schedule = new Scheduled_Backup( sanitize_text_field( $_POST['hmbkp_schedule_id'] ) );
234
  $site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() );
235
 
236
+ $errors = $settings = array();
 
 
237
 
238
  if ( isset( $_POST['hmbkp_schedule_type'] ) ) {
239
 
370
  // Remove any old backups in-case max backups was reduced
371
  $schedule->delete_old_backups();
372
 
373
+ if ( ! empty( $errors ) ) {
374
  foreach ( $errors as $error ) {
375
  add_settings_error( $error );
376
  }
378
 
379
  $redirect = remove_query_arg( array( 'hmbkp_panel', 'action' ), wp_get_referer() );
380
 
381
+ if ( ! empty( $errors ) ) {
382
  $redirect = wp_get_referer();
383
  }
384
 
admin/extensions.php CHANGED
@@ -1,165 +1,201 @@
1
  <?php
2
-
3
  namespace HM\BackUpWordPress;
4
-
5
  ?>
6
 
7
  <div class="wrap">
8
-
9
  <h1>
10
-
11
- <a class="page-title-action" href="<?php echo esc_url( get_settings_url() ); ?>"><?php _e( '&larr; Backups', 'backupwordpress' ); ?></a>
12
-
13
- <?php _e( 'BackUpWordPress Extensions', 'backupwordpress' ); ?>
14
-
15
  </h1>
16
 
17
  <div class="wp-filter">
18
- <p><?php _e( 'Extend BackUpWordPress by installing extensions. Extensions allows you to pick and choose the exact features you need whilst also supporting us, the developers, so we can continue working on BackUpWordPress.', 'backupwordpress' ); ?></p>
19
  </div>
20
 
21
  <?php
22
  $extensions_data = Extensions::get_instance()->get_edd_data();
23
 
24
- // Sort by title
25
  usort( $extensions_data, function( $a, $b ) {
26
  return strcmp( $b->title->rendered, $a->title->rendered );
27
  });
28
 
29
- $installed_plugins = array_reduce( get_plugins(), function( $carry, $item ) {
30
- $carry[ strtolower( $item['Name'] ) ] = $item['Version'];
31
- return $carry;
32
- }, array() );
33
-
 
 
 
 
 
 
 
 
 
 
 
34
  ?>
35
 
36
- <h3><?php _e( 'Remote Storage', 'backupwordpress' ); ?></h3>
37
 
38
- <p><?php _e( 'It\'s important to store your backups somewhere other than on your site. Using the extensions below you can easily push your backups to one or more Cloud providers.', 'backupwordpress' ); ?></p>
39
 
40
  <div class="wp-list-table widefat plugin-install">
41
-
42
  <div id="the-list">
43
 
44
  <?php $first = true; ?>
45
 
46
- <?php foreach ( $extensions_data as $extension ) : ?>
47
 
48
- <div class="plugin-card plugin-card-<?php echo esc_attr( $extension->slug ); ?>">
 
49
 
50
- <div class="plugin-card-top">
 
51
 
52
- <div class="name column-name">
 
53
 
54
- <h4>
 
 
55
 
 
 
 
 
56
  <a href="<?php echo esc_url( $extension->link ); ?>" class="thickbox">
57
-
58
  <?php echo esc_html( $extension->title->rendered ); ?>
59
-
60
- <img src="<?php echo esc_url( $extension->featured_image_url ); ?>" class="plugin-icon" alt="">
61
-
62
  </a>
63
-
64
- </h4>
65
-
66
  </div>
67
 
68
  <div class="action-links">
69
-
70
  <ul class="plugin-action-buttons">
71
 
72
- <li>
73
- <?php if ( in_array( strtolower( $extension->title->rendered ), array_keys( $installed_plugins ) ) ) : ?>
74
-
75
- <span class="button button-disabled" title="<?php _e( 'This extension is already installed', 'backupwordpress' ); ?>"><?php _e( 'Installed', 'backupwordpress' ); ?></span>
76
-
77
- <?php else : ?>
78
-
79
- <a class="install-now button-primary" data-slug="<?php echo esc_attr( $extension->slug ); ?>" href="<?php echo esc_url( $extension->link ); ?>" aria-label="Install <?php echo esc_attr( $extension->title->rendered ); ?> now" data-name="<?php echo esc_attr( $extension->title->rendered ); ?>"><?php printf( __( 'Buy Now &dollar;%s', 'backupwordpress' ), $extension->edd_price ); ?></a>
80
-
81
- <?php endif; ?>
82
-
83
- </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  <li>
86
-
87
- <a href="<?php echo esc_url( $extension->link ); ?>" class="thickbox" aria-label="<?php printf( __( 'More information about %s', 'backupwordpress' ), esc_attr( $extension->title->rendered ) ) ; ?>" data-title="<?php echo esc_attr( $extension->title->rendered ); ?>"><?php _e( 'More Details', 'backupwordpress' ); ?></a>
88
-
 
 
 
 
89
  </li>
90
-
91
  </ul>
92
-
93
  </div>
94
 
95
  <div class="desc column-description">
96
-
97
  <p><?php echo wp_kses_post( $extension->content->rendered ); ?></p>
98
-
99
  </div>
100
-
101
  </div>
102
 
103
  <?php
104
-
105
  $style = $first === true ? 'background-color:aliceblue;' : '';
106
-
107
  $first = false;
108
-
109
  ?>
110
 
111
  <div class="plugin-card-bottom" style="<?php echo esc_attr( $style ); ?>">
112
-
113
  <div class="vers column-rating">
114
-
115
- <div>
116
-
117
- <?php esc_html_e( sprintf( __( 'Plugin version %s', 'backupwordpress' ), $extension->_edd_sl_version ) ); ?>
118
-
119
- </div>
120
-
121
- <div>
122
-
123
- <?php
124
-
125
- $text = '';
126
-
127
- if ( in_array( strtolower( $extension->title->rendered ), array_keys( $installed_plugins ) ) ) {
128
-
129
- $current_version = $installed_plugins[ strtolower( $extension->title->rendered ) ];
130
-
131
- if ( version_compare( $current_version, $extension->_edd_sl_version, '<' ) ) {
132
-
133
- $text = sprintf( __( 'A newer version (%1$s) is available. <a href="%2$s">Update now!</a>', 'backupwordpress' ), esc_html( $extension->_edd_sl_version ), esc_url( admin_url( 'update-core.php' ) ) );
134
- } else {
135
-
136
- $text = esc_html__( 'You have the latest version', 'backupwordpress' );
137
-
138
- }
139
- }
140
-
141
- echo $text;
142
-
143
- ?>
144
-
145
- </div>
146
-
147
  </div>
148
 
149
  <div class="column-updated">
150
-
151
- <strong><?php _e( 'Last Updated:', 'backupwordpress' ); ?></strong> <span title="<?php echo esc_attr( $extension->modified ); ?>"><?php printf( __( '%s ago', 'backupwordpress' ), human_time_diff( strtotime( $extension->modified ) ) ); ?></span>
152
-
 
 
 
 
 
 
153
  </div>
154
-
155
  </div>
156
-
157
  </div>
158
 
159
  <?php endforeach; ?>
160
-
161
  </div>
162
-
163
  </div>
164
-
165
  </div>
1
  <?php
 
2
  namespace HM\BackUpWordPress;
 
3
  ?>
4
 
5
  <div class="wrap">
 
6
  <h1>
7
+ <a class="page-title-action" href="<?php echo esc_url( get_settings_url() ); ?>"><?php esc_html_e( '&larr; Backups', 'backupwordpress' ); ?></a>
8
+ <?php esc_html_e( 'BackUpWordPress Extensions', 'backupwordpress' ); ?>
 
 
 
9
  </h1>
10
 
11
  <div class="wp-filter">
12
+ <p><?php esc_html_e( 'Extend BackUpWordPress by installing extensions. Extensions allow you to pick and choose the exact features you need whilst also supporting us, the developers, so we can continue working on BackUpWordPress.', 'backupwordpress' ); ?></p>
13
  </div>
14
 
15
  <?php
16
  $extensions_data = Extensions::get_instance()->get_edd_data();
17
 
18
+ // Sort by title.
19
  usort( $extensions_data, function( $a, $b ) {
20
  return strcmp( $b->title->rendered, $a->title->rendered );
21
  });
22
 
23
+ /**
24
+ * Include is required for the usage of is_plugin_active()
25
+ * to identify if a plugin is currently activated.
26
+ * This info is further used to display a correct action button
27
+ * depending on plugin's state (i.e. Update Now, Activate, Active).
28
+ */
29
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
30
+
31
+ $installed_plugins = array();
32
+ foreach ( get_plugins() as $path => $plugin_info ) {
33
+ $installed_plugins[ strtolower( $plugin_info['Name'] ) ] = array(
34
+ 'version' => $plugin_info['Version'],
35
+ 'path' => $path,
36
+ 'is_active' => is_plugin_active( $path ),
37
+ );
38
+ }
39
  ?>
40
 
41
+ <h3><?php esc_html_e( 'Remote Storage', 'backupwordpress' ); ?></h3>
42
 
43
+ <p><?php esc_html_e( 'It\'s important to store your backups somewhere other than on your site. Using the extensions below you can easily push your backups to one or more Cloud providers.', 'backupwordpress' ); ?></p>
44
 
45
  <div class="wp-list-table widefat plugin-install">
 
46
  <div id="the-list">
47
 
48
  <?php $first = true; ?>
49
 
50
+ <?php foreach ( $extensions_data as $extension ) :
51
 
52
+ $extension_name_lowcase = strtolower( $extension->title->rendered );
53
+ $is_extension_installed = in_array( $extension_name_lowcase, array_keys( $installed_plugins ) );
54
 
55
+ $extension_version = $is_extension_installed ?
56
+ $installed_plugins[ $extension_name_lowcase ]['version'] : '';
57
 
58
+ $extension_path = $is_extension_installed ?
59
+ $installed_plugins[ $extension_name_lowcase ]['path'] : '';
60
 
61
+ $is_extension_active = $is_extension_installed ?
62
+ $installed_plugins[ $extension_name_lowcase ]['is_active'] : false;
63
+ ?>
64
 
65
+ <div class="plugin-card plugin-card-<?php echo esc_attr( $extension->slug ); ?>">
66
+ <div class="plugin-card-top">
67
+ <div class="name column-name">
68
+ <h3>
69
  <a href="<?php echo esc_url( $extension->link ); ?>" class="thickbox">
 
70
  <?php echo esc_html( $extension->title->rendered ); ?>
71
+ <img src="<?php echo esc_url( $extension->featured_image_url ); ?>" class="plugin-icon" alt="" />
 
 
72
  </a>
73
+ </h3>
 
 
74
  </div>
75
 
76
  <div class="action-links">
 
77
  <ul class="plugin-action-buttons">
78
 
79
+ <?php
80
+ if (
81
+ current_user_can( 'install_plugins' ) ||
82
+ current_user_can( 'update_plugins' )
83
+ ) : ?>
84
+
85
+ <li>
86
+ <?php
87
+ // Update Now - Installed and update is available.
88
+ if (
89
+ $is_extension_installed &&
90
+ version_compare( $extension_version, $extension->_edd_sl_version, '<' )
91
+ ) :
92
+
93
+ $update_url = wp_nonce_url(
94
+ self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $extension_path ),
95
+ 'upgrade-plugin_' . $extension_path
96
+ );
97
+ ?>
98
+
99
+ <a
100
+ class="update-now button aria-button-if-js"
101
+ data-plugin="<?php echo esc_attr( $extension_path ); ?>"
102
+ data-slug="<?php echo esc_attr( $extension->slug ); ?>"
103
+ href="<?php echo esc_url( $update_url ); ?>"
104
+ aria-label="<?php printf( esc_attr__( 'Update %s now', 'backupwordpress' ), esc_attr( $extension->title->rendered ) ); ?>"
105
+ data-name="<?php esc_attr( $extension->title->rendered ); ?>">
106
+ <?php esc_html_e( 'Update Now', 'backupwordpress' ); ?>
107
+ </a>
108
+
109
+ <?php
110
+ // Active - Installed and activated, but no update.
111
+ elseif ( $is_extension_installed && $is_extension_active ) : ?>
112
+
113
+ <button
114
+ type="button"
115
+ class="button button-disabled"
116
+ disabled="disabled">
117
+ <?php echo esc_html_x( 'Active', 'Plugin status', 'backupwordpress' ); ?>
118
+ </button>
119
+
120
+ <?php
121
+ // Activate - Installed, but not activated.
122
+ elseif ( $is_extension_installed && ! $is_extension_active ) :
123
+
124
+ $activate_url = add_query_arg( array(
125
+ '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $extension_path ),
126
+ 'action' => 'activate',
127
+ 'plugin' => $extension_path,
128
+ ), network_admin_url( 'plugins.php' ) );
129
+
130
+ // TODO: Network Activate?
131
+ ?>
132
+
133
+ <a
134
+ href="<?php echo esc_url( $activate_url ); ?>"
135
+ class="button activate-now button-secondary"
136
+ aria-label="<?php printf( esc_attr__( 'Activate %s', 'backupwordpress' ), esc_attr( $extension->title->rendered ) ); ?>">
137
+ <?php esc_html_e( 'Activate', 'backupwordpress' ); ?>
138
+ </a>
139
+
140
+ <?php
141
+ // Buy Now - Not installed.
142
+ else : ?>
143
+
144
+ <a
145
+ class="install-now button-primary"
146
+ data-slug="<?php echo esc_attr( $extension->slug ); ?>"
147
+ href="<?php echo esc_url( $extension->link ); ?>"
148
+ aria-label="<?php printf( esc_attr__( 'Install %s now', 'backupwordpress' ), esc_attr( $extension->title->rendered ) ); ?>
149
+ data-name="<?php echo esc_attr( $extension->title->rendered ); ?>">
150
+ <?php printf( esc_html__( 'Buy Now &#36;%s', 'backupwordpress' ), esc_html( $extension->edd_price ) ); ?>
151
+ </a>
152
+
153
+ <?php endif; ?>
154
+ </li>
155
+
156
+ <?php endif; ?>
157
 
158
  <li>
159
+ <a
160
+ href="<?php echo esc_url( $extension->link ); ?>"
161
+ class="thickbox"
162
+ aria-label="<?php printf( esc_attr__( 'More information about %s', 'backupwordpress' ), esc_attr( $extension->title->rendered ) ) ; ?>"
163
+ data-title="<?php echo esc_attr( $extension->title->rendered ); ?>">
164
+ <?php esc_html_e( 'More Details', 'backupwordpress' ); ?>
165
+ </a>
166
  </li>
 
167
  </ul>
 
168
  </div>
169
 
170
  <div class="desc column-description">
 
171
  <p><?php echo wp_kses_post( $extension->content->rendered ); ?></p>
 
172
  </div>
 
173
  </div>
174
 
175
  <?php
 
176
  $style = $first === true ? 'background-color:aliceblue;' : '';
 
177
  $first = false;
 
178
  ?>
179
 
180
  <div class="plugin-card-bottom" style="<?php echo esc_attr( $style ); ?>">
 
181
  <div class="vers column-rating">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  </div>
183
 
184
  <div class="column-updated">
185
+ <?php printf(
186
+ wp_kses(
187
+ __( '<strong>Last Updated:</strong> %s ago', 'backupwordpress' ),
188
+ array(
189
+ 'strong' => array(),
190
+ )
191
+ ),
192
+ esc_html( human_time_diff( strtotime( $extension->modified ) ) )
193
+ ); ?>
194
  </div>
 
195
  </div>
 
196
  </div>
197
 
198
  <?php endforeach; ?>
 
199
  </div>
 
200
  </div>
 
201
  </div>
admin/menu.php CHANGED
@@ -41,6 +41,28 @@ function extensions() {
41
  require_once( HMBKP_PLUGIN_PATH . 'admin/extensions.php' );
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  /**
45
  * Add a link to the backups page to the plugin action links.
46
  *
41
  require_once( HMBKP_PLUGIN_PATH . 'admin/extensions.php' );
42
  }
43
 
44
+ /**
45
+ * Highlights the 'Backups' submenu item when on the Extensions page
46
+ *
47
+ * @param string $submenu_file
48
+ * @return string $submenu_file The slug of the menu item to highlight
49
+ */
50
+ function highlight_submenu( $submenu_file ) {
51
+
52
+ $screen = get_current_screen();
53
+
54
+ if ( 'tools_page_' . HMBKP_PLUGIN_SLUG . '_extensions' === $screen->id ) {
55
+
56
+ // Set the main plugin page to be the active submenu page
57
+ $submenu_file = HMBKP_PLUGIN_SLUG;
58
+
59
+ }
60
+
61
+ return $submenu_file;
62
+
63
+ }
64
+ add_filter( 'submenu_file', 'HM\BackUpWordPress\highlight_submenu' );
65
+
66
  /**
67
  * Add a link to the backups page to the plugin action links.
68
  *
admin/page.php CHANGED
@@ -15,21 +15,20 @@ namespace HM\BackUpWordPress;
15
  <?php if ( get_option( 'hmbkp_enable_support' ) ) : ?>
16
 
17
  <a id="intercom" class="page-title-action" href="mailto:backupwordpress@hmn.md"><?php _e( 'Support', 'backupwordpress' ); ?></a>
 
18
  <?php else :
 
19
  add_thickbox(); ?>
20
  <a id="intercom-info" class="thickbox page-title-action" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'load_enable_support', 'width' => '600', 'height' => '420' ), self_admin_url( 'admin-ajax.php' ) ), 'hmbkp_nonce' ) ); ?>"><span class="dashicons dashicons-admin-users"></span>&nbsp;<?php _e( 'Enable Support', 'backupwordpress' ); ?></a>
 
21
  <?php endif; ?>
22
 
23
  </h1>
24
 
25
- <?php if ( is_backup_possible() ) : ?>
26
-
27
- <?php include_once( HMBKP_PLUGIN_PATH . 'admin/backups.php' ); ?>
28
-
29
- <p class="howto"><?php printf( __( 'If you\'re finding BackUpWordPress useful, please %1$s rate it on the plugin directory%2$s.', 'backupwordpress' ), '<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/backupwordpress">', '</a>' ); ?></p>
30
 
31
- <?php include_once( HMBKP_PLUGIN_PATH . 'admin/upsell.php' ); ?>
32
 
33
- <?php endif; ?>
34
 
35
  </div>
15
  <?php if ( get_option( 'hmbkp_enable_support' ) ) : ?>
16
 
17
  <a id="intercom" class="page-title-action" href="mailto:backupwordpress@hmn.md"><?php _e( 'Support', 'backupwordpress' ); ?></a>
18
+
19
  <?php else :
20
+
21
  add_thickbox(); ?>
22
  <a id="intercom-info" class="thickbox page-title-action" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'load_enable_support', 'width' => '600', 'height' => '420' ), self_admin_url( 'admin-ajax.php' ) ), 'hmbkp_nonce' ) ); ?>"><span class="dashicons dashicons-admin-users"></span>&nbsp;<?php _e( 'Enable Support', 'backupwordpress' ); ?></a>
23
+
24
  <?php endif; ?>
25
 
26
  </h1>
27
 
28
+ <?php include_once( HMBKP_PLUGIN_PATH . 'admin/backups.php' ); ?>
 
 
 
 
29
 
30
+ <p class="howto"><?php printf( __( 'If you\'re finding BackUpWordPress useful, please %1$s rate it on the plugin directory%2$s.', 'backupwordpress' ), '<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/backupwordpress">', '</a>' ); ?></p>
31
 
32
+ <?php include_once( HMBKP_PLUGIN_PATH . 'admin/upsell.php' ); ?>
33
 
34
  </div>
admin/schedule-form-excludes.php CHANGED
@@ -96,7 +96,7 @@ $user_excludes = $excludes->get_user_excludes(); ?>
96
 
97
  $untrusted_directory = urldecode( $_GET['hmbkp_directory_browse'] );
98
 
99
- // Only allow real sub directories of the site root to be browsed.
100
  if (
101
  false !== strpos( $untrusted_directory, Path::get_root() ) &&
102
  is_dir( $untrusted_directory )
@@ -105,8 +105,6 @@ $user_excludes = $excludes->get_user_excludes(); ?>
105
  }
106
  }
107
 
108
- $exclude_string = implode( '|', $excludes->get_excludes_for_regex() );
109
-
110
  $site_size = new Site_Size( 'file' );
111
  $excluded_site_size = new Site_Size( 'file', $excludes );
112
 
@@ -186,8 +184,8 @@ $user_excludes = $excludes->get_user_excludes(); ?>
186
  /* translators: 1: Excluded size 2: Overall site size */
187
  printf(
188
  esc_html__( '%1$s of %2$s', 'backupwordpress' ),
189
- esc_html( $excluded_size ),
190
- esc_html( size_format( $size ) )
191
  );
192
  ?>
193
 
@@ -231,10 +229,7 @@ $user_excludes = $excludes->get_user_excludes(); ?>
231
  $is_excluded = $is_unreadable = false;
232
 
233
  // Check if the file is excluded.
234
- if (
235
- $exclude_string &&
236
- preg_match( '(' . $exclude_string . ')', str_ireplace( trailingslashit( Path::get_root() ), '', wp_normalize_path( $file->getPathname() ) ) )
237
- ) :
238
  $is_excluded = true;
239
  endif;
240
 
@@ -298,20 +293,29 @@ $user_excludes = $excludes->get_user_excludes(); ?>
298
  $size = $site_size->filesize( $file );
299
 
300
  if ( false !== $size ) :
301
- $size = $size ?: '0';
302
- $excluded_size = $excluded_site_size->filesize( $file ) ?: '0'; ?>
 
303
 
304
  <code>
305
 
306
- <?php if ( $file->isDir() ) :
 
 
 
 
 
 
307
 
308
- $excluded_size = is_same_size_format( $size, $excluded_size ) ? (int) size_format( $excluded_size ) : size_format( $excluded_size );
 
 
309
 
310
- /* translators: 1: Excluded size 2: Overall site size */
311
  printf(
312
  esc_html__( '%1$s of %2$s', 'backupwordpress' ),
313
- esc_html( $excluded_size ),
314
- esc_html( size_format( $size ) )
315
  );
316
 
317
  elseif ( ! $is_unreadable ) :
96
 
97
  $untrusted_directory = urldecode( $_GET['hmbkp_directory_browse'] );
98
 
99
+ // Only allow real sub-directories of the site root to be browsed.
100
  if (
101
  false !== strpos( $untrusted_directory, Path::get_root() ) &&
102
  is_dir( $untrusted_directory )
105
  }
106
  }
107
 
 
 
108
  $site_size = new Site_Size( 'file' );
109
  $excluded_site_size = new Site_Size( 'file', $excludes );
110
 
184
  /* translators: 1: Excluded size 2: Overall site size */
185
  printf(
186
  esc_html__( '%1$s of %2$s', 'backupwordpress' ),
187
+ $excluded_size,
188
+ size_format( $size )
189
  );
190
  ?>
191
 
229
  $is_excluded = $is_unreadable = false;
230
 
231
  // Check if the file is excluded.
232
+ if ( $excludes->is_file_excluded( $file ) ) :
 
 
 
233
  $is_excluded = true;
234
  endif;
235
 
293
  $size = $site_size->filesize( $file );
294
 
295
  if ( false !== $size ) :
296
+
297
+ $size = $size;
298
+ $excluded_size = $excluded_site_size->filesize( $file ); ?>
299
 
300
  <code>
301
 
302
+ <?php
303
+ // Display `included of total size` info for directories and excluded files only.
304
+ if ( $file->isDir() || ( $file->isFile() && $is_excluded ) ) :
305
+
306
+ if ( $excluded_size ) {
307
+ $excluded_size = is_same_size_format( $size, $excluded_size ) ? (int) size_format( $excluded_size ) : size_format( $excluded_size );
308
+ }
309
 
310
+ if ( $size ) {
311
+ $size = size_format( $size );
312
+ }
313
 
314
+ /* translators: 1: Excluded size 2: Overall directory/file size */
315
  printf(
316
  esc_html__( '%1$s of %2$s', 'backupwordpress' ),
317
+ $excluded_size,
318
+ $size
319
  );
320
 
321
  elseif ( ! $is_unreadable ) :
admin/schedule-form.php CHANGED
@@ -181,10 +181,10 @@ clear_settings_errors();
181
 
182
  <?php
183
 
184
- $site_size = new Site_Size;
185
 
186
  if ( $site_size->is_site_size_cached() ) :
187
- printf( __( 'This schedule will store a maximum of %s of backups.', 'backupwordpress' ), '<code>' . esc_html( size_format( $site_size->get_site_size( $schedule->get_type(), $schedule->get_excludes() ) * $schedule->get_max_backups() ) ) . '</code>' );
188
  endif; ?>
189
 
190
  </p>
181
 
182
  <?php
183
 
184
+ $site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() );
185
 
186
  if ( $site_size->is_site_size_cached() ) :
187
+ printf( __( 'This schedule will store a maximum of %s of backups.', 'backupwordpress' ), '<code>' . esc_html( size_format( $site_size->get_site_size() * $schedule->get_max_backups() ) ) . '</code>' );
188
  endif; ?>
189
 
190
  </p>
admin/schedule-sentence.php CHANGED
@@ -73,8 +73,7 @@ switch ( $schedule->get_reoccurrence() ) :
73
 
74
  endswitch;
75
 
76
- $server = '<span title="' . esc_attr( Path::get_path() ) . '">' . __( 'this server', 'backupwordpress' ) . '</span>';
77
- $server = '<code>' . esc_attr( str_replace( Path::get_home_path(), '', Path::get_path() ) ) . '</code>';
78
 
79
  // Backup to keep
80
  switch ( $schedule->get_max_backups() ) :
@@ -124,7 +123,7 @@ if ( ! empty( $services ) && count( $services ) > 1 ) {
124
  $sentence .= ' ' . $email_msg;
125
  }
126
 
127
- if ( $services ) {
128
  $sentence .= ' ' . sprintf( __( 'Send a copy of each backup to %s.', 'backupwordpress' ), implode( ', ', $services ) );
129
  }
130
 
@@ -156,10 +155,12 @@ function get_site_size_text( Scheduled_Backup $schedule ) {
156
 
157
  $site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() );
158
 
159
- if ( ( 'database' === $schedule->get_type() ) || $site_size->is_site_size_cached() ) {
160
- return sprintf( '(<code title="' . __( 'Backups will be compressed and should be smaller than this.', 'backupwordpress' ) . '">%s</code>)', esc_attr( $site_size->get_formatted_site_size() ) );
161
- } else {
162
- return sprintf( '(<code class="calculating" title="' . __( 'this shouldn\'t take long&hellip;', 'backupwordpress' ) . '">' . __( 'calculating the size of your site&hellip;', 'backupwordpress' ) . '</code>)' );
 
163
  }
164
 
 
165
  }
73
 
74
  endswitch;
75
 
76
+ $server = '<code title="' . __( 'Check the help tab to learn how to change where your backups are stored.', 'backupwordpress' ) . '">' . esc_attr( str_replace( Path::get_home_path(), '', Path::get_path() ) ) . '</code>';
 
77
 
78
  // Backup to keep
79
  switch ( $schedule->get_max_backups() ) :
123
  $sentence .= ' ' . $email_msg;
124
  }
125
 
126
+ if ( ! empty( $services ) ) {
127
  $sentence .= ' ' . sprintf( __( 'Send a copy of each backup to %s.', 'backupwordpress' ), implode( ', ', $services ) );
128
  }
129
 
155
 
156
  $site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() );
157
 
158
+ if ( 'database' === $schedule->get_type() || $site_size->is_site_size_cached() ) {
159
+ return sprintf(
160
+ '(<code title="' . __( 'Backups will be compressed and should be smaller than this.', 'backupwordpress' ) . '">%s</code>)',
161
+ esc_html( $site_size->get_formatted_site_size() )
162
+ );
163
  }
164
 
165
+ return '';
166
  }
admin/schedule-settings.php CHANGED
@@ -6,7 +6,11 @@ if ( Schedules::get_instance()->get_schedule( $schedule->get_id() ) ) { ?>
6
 
7
  <div class="hmbkp-schedule-actions row-actions">
8
 
9
- <a class="hmbkp-run" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'hmbkp_run_schedule', 'hmbkp_schedule_id' => $schedule->get_id() ), admin_url( 'admin-ajax.php' ) ), 'hmbkp_run_schedule', 'hmbkp_run_schedule_nonce' ) ); ?>"><?php _e( 'Run now', 'backupwordpress' ); ?></a> |
 
 
 
 
10
 
11
  <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_edit_schedule', 'hmbkp_panel' => 'hmbkp_edit_schedule_settings', 'hmbkp_schedule_id' => $schedule->get_id() ), get_settings_url() ), 'hmbkp-edit-schedule' ); ?>"><?php _e( 'Settings', 'backupwordpress' ); ?></a> |
12
 
6
 
7
  <div class="hmbkp-schedule-actions row-actions">
8
 
9
+ <?php if ( is_backup_possible() ) : ?>
10
+
11
+ <a class="hmbkp-run" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'hmbkp_run_schedule', 'hmbkp_schedule_id' => $schedule->get_id() ), admin_url( 'admin-ajax.php' ) ), 'hmbkp_run_schedule', 'hmbkp_run_schedule_nonce' ) ); ?>"><?php _e( 'Run now', 'backupwordpress' ); ?></a> |
12
+
13
+ <?php endif; ?>
14
 
15
  <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'hmbkp_edit_schedule', 'hmbkp_panel' => 'hmbkp_edit_schedule_settings', 'hmbkp_schedule_id' => $schedule->get_id() ), get_settings_url() ), 'hmbkp-edit-schedule' ); ?>"><?php _e( 'Settings', 'backupwordpress' ); ?></a> |
16
 
assets/hmbkp.css CHANGED
@@ -9,18 +9,8 @@ h2 + div[id^="hmbkp"] input { max-width: 100%; }
9
  li a.hmbkp-running:not(.current):before { width: 20px; height: 20px; margin: -1px 10px -5px 0; content: ""; background: transparent url('spinner-2x.gif') no-repeat 0 0; background-size: 20px; display: inline-block; }
10
 
11
  .hmbkp-upsell { margin-top: 40px; padding-top: 16px; border-top: 1px solid #ccc; }
12
- .hmbkp-upsell a { color: #57792b }
13
- .hmbkp-upsell a:hover { color: #98c063 }
14
-
15
- .hmbkp-upsell-sep { color: #bbb;}
16
- .hmbkp-upsell ul { overflow: hidden; }
17
- .hmbkp-upsell li { float: left; margin: 0 20px 20px 0; }
18
- .hmbkp-upsell img { display: block; margin: 0 auto; max-width: 120px; min-height: 60px; }
19
- .hmbkp-upsell ul a { display: block; margin-bottom: 0; width: 120px; }
20
- .hmbkp-upsell .howto { font-weight: normal; display: inline; }
21
- .hmbkp-upsell .hmbkp_hide { float: right; }
22
-
23
- .hmbkp-schedule-sentence { font-size: 16px; font-weight: lighter; margin: 0 0 20px 0; background-color: #FBFBFB; padding: 20px; border: 1px solid #e5e5e5; box-shadow: 0 1px 1px rgba( 0,0,0,.04 ); }
24
  .hmbkp-schedule-sentence::before { content: "\2714"; margin-right: 10px; width: 16px; height: 60px; display: block; float: left; }
25
  .hmbkp-schedule-sentence.hmbkp-error:before { content: "\2718"; }
26
  .hmbkp-schedule-sentence.hmbkp-running:before { width: 20px; height: 80px; margin: -1px 10px 0 0; content: ""; background: transparent url('spinner-2x.gif') no-repeat 0 0; background-size: 20px; display: inline-block; }
@@ -30,7 +20,7 @@ li a.hmbkp-running:not(.current):before { width: 20px; height: 20px; margin: -1p
30
  .hmbkp-schedule-sentence *:not(a)[title] { border-bottom: 1px dotted #CCC; cursor: help; }
31
  .hmbkp-schedule-sentence .hmbkp-status[title] { border-bottom: none; }
32
  .hmbkp-schedule-sentence .submit { padding: 0; }
33
- .hmbkp-schedule-sentence .hmbkp-schedule-actions { visibility: visible; font-size: 12px; font-weight: normal; margin: 0 0 0 26px; }
34
  .hmbkp-schedule-actions a { white-space: nowrap; }
35
  .hmbkp-schedule-sentence .row-actions { position: static; }
36
 
@@ -95,8 +85,3 @@ pre { background-color: #eee; padding: 10px; white-space: pre; max-height: 320px
95
  table.widefat tbody tr:nth-child(odd) { background-color: #f9f9f9 }
96
 
97
  }
98
-
99
- .tools_page_backupwordpress_extensions a[href*="page=backupwordpress"] {
100
- font-weight: bold !important;
101
- color: white !important;
102
- }
9
  li a.hmbkp-running:not(.current):before { width: 20px; height: 20px; margin: -1px 10px -5px 0; content: ""; background: transparent url('spinner-2x.gif') no-repeat 0 0; background-size: 20px; display: inline-block; }
10
 
11
  .hmbkp-upsell { margin-top: 40px; padding-top: 16px; border-top: 1px solid #ccc; }
12
+
13
+ .hmbkp-schedule-sentence { font-size: 16px; margin: 0 0 20px 0; background-color: #FBFBFB; padding: 20px; border: 1px solid #e5e5e5; box-shadow: 0 1px 1px rgba( 0,0,0,.04 ); }
 
 
 
 
 
 
 
 
 
 
14
  .hmbkp-schedule-sentence::before { content: "\2714"; margin-right: 10px; width: 16px; height: 60px; display: block; float: left; }
15
  .hmbkp-schedule-sentence.hmbkp-error:before { content: "\2718"; }
16
  .hmbkp-schedule-sentence.hmbkp-running:before { width: 20px; height: 80px; margin: -1px 10px 0 0; content: ""; background: transparent url('spinner-2x.gif') no-repeat 0 0; background-size: 20px; display: inline-block; }
20
  .hmbkp-schedule-sentence *:not(a)[title] { border-bottom: 1px dotted #CCC; cursor: help; }
21
  .hmbkp-schedule-sentence .hmbkp-status[title] { border-bottom: none; }
22
  .hmbkp-schedule-sentence .submit { padding: 0; }
23
+ .hmbkp-schedule-sentence .hmbkp-schedule-actions { visibility: visible; font-size: 12px; margin: 0 0 0 26px; }
24
  .hmbkp-schedule-actions a { white-space: nowrap; }
25
  .hmbkp-schedule-sentence .row-actions { position: static; }
26
 
85
  table.widefat tbody tr:nth-child(odd) { background-color: #f9f9f9 }
86
 
87
  }
 
 
 
 
 
assets/hmbkp.js CHANGED
@@ -139,21 +139,6 @@ var BackUpWordPressAdmin = (function($){
139
  );
140
  } );
141
 
142
- jQuery( document ).one( 'click', '.hmbkp_send_error_via_email', function ( e ) {
143
-
144
- e.preventDefault();
145
-
146
- jQuery( this ).addClass( 'hmbkp-ajax-loading' ).attr( 'disabled', 'disabled' );
147
-
148
- jQuery.post(
149
- ajaxurl,
150
- {'nonce': hmbkp.nonce, 'action': 'hmbkp_email_error', 'hmbkp_error': data},
151
- function () {
152
- //jQuery.colorbox.close();
153
- }
154
- );
155
-
156
- } );
157
  }
158
 
159
  function hmbkpToggleScheduleFields( recurrence ) {
@@ -213,4 +198,4 @@ var BackUpWordPressAdmin = (function($){
213
 
214
  })(jQuery);
215
 
216
- jQuery( document ).ready(BackUpWordPressAdmin.init);
139
  );
140
  } );
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  }
143
 
144
  function hmbkpToggleScheduleFields( recurrence ) {
198
 
199
  })(jQuery);
200
 
201
+ jQuery( document ).ready( BackUpWordPressAdmin.init );
assets/hmbkp.min.css CHANGED
@@ -1 +1 @@
1
- .hmbkp-schedule-actions a,.hmbkp-schedule-settings .column-format code{white-space:nowrap}.hmbkp_active td:first-child>code:before{content:"\00a0 \2713 ";font-size:11px}.hmbkp_active{background:#E5F7E8}div#hmbkp-warning,h2.nav-tab-wrapper+div[id^=hmbkp]{margin:20px 0 15px}h2+div[id^=hmbkp] input{max-width:100%}li a.hmbkp-running:not(.current):before{width:20px;height:20px;margin:-1px 10px -5px 0;content:"";background:url(spinner-2x.gif) no-repeat;background-size:20px;display:inline-block}.hmbkp-upsell{margin-top:40px;padding-top:16px;border-top:1px solid #ccc}.hmbkp-upsell a{color:#57792b}.hmbkp-upsell a:hover{color:#98c063}.hmbkp-upsell-sep{color:#bbb}.hmbkp-upsell ul{overflow:hidden}.hmbkp-upsell li{float:left;margin:0 20px 20px 0}.hmbkp-upsell img{display:block;margin:0 auto;max-width:120px;min-height:60px}.hmbkp-upsell ul a{display:block;margin-bottom:0;width:120px}.hmbkp-upsell .howto{font-weight:400;display:inline}.hmbkp-upsell .hmbkp_hide{float:right}.hmbkp-schedule-sentence{font-size:16px;font-weight:lighter;margin:0 0 20px;background-color:#FBFBFB;padding:20px;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04)}.hmbkp-schedule-sentence::before{content:"\2714";margin-right:10px;width:16px;height:60px;display:block;float:left}.hmbkp-schedule-sentence.hmbkp-error:before{content:"\2718"}.hmbkp-schedule-sentence.hmbkp-running:before{width:20px;height:80px;margin:-1px 10px 0 0;content:"";background:url(spinner-2x.gif) no-repeat;background-size:20px;display:inline-block}.hmbkp-schedule-sentence .hmbkp-status{display:none;font-size:12px;color:#666;margin:2px 0 0 30px}.hmbkp-schedule-sentence.hmbkp-running .hmbkp-status{display:block}.hmbkp-schedule-sentence.hmbkp-running .hmbkp-schedule-actions{display:none}.hmbkp-schedule-sentence :not(a)[title]{border-bottom:1px dotted #CCC;cursor:help}.hmbkp-schedule-sentence .hmbkp-status[title]{border-bottom:none}.hmbkp-schedule-sentence .submit{padding:0}.hmbkp-schedule-sentence .hmbkp-schedule-actions{visibility:visible;font-size:12px;font-weight:400;margin:0 0 0 26px}.hmbkp-schedule-sentence .row-actions{position:static}.hmbkp-schedule-settings{border-top:1px solid #e5e5e5;margin:20px -20px -20px;background-color:#f5f5f5;padding:0 20px 20px}.hmbkp-exclude-settings thead tr:last-child,table.widefat tbody tr:nth-child(odd){background-color:#f9f9f9}.hmbkp-ajax-loading,button.hmbkp-ajax-loading{padding-left:20px;position:relative}.hmbkp-ajax-loading::after{content:"";width:16px;height:16px;background-image:url(spinner-2x.gif);background-size:16px 16px;background-repeat:no-repeat;background-position:0 0;position:absolute;right:-30px;top:5px}.delete-action{color:#a00;-webkit-transition:all .3s ease;transition:all .3s ease}.delete-action:hover .delete-action:focus{color:red;-webkit-transition:all .3s ease;transition:all .3s ease}.strikethrough{text-decoration:line-through}.hmbkp-exclude-settings td:first-child,.hmbkp-exclude-settings th:first-child{width:20px;padding-right:0}.hmbkp-exclude-settings table .button-secondary{line-height:18px;height:20px}thead td{border-bottom:1px solid #e1e1e1}.hmbkp-exclude-settings table .spinner{display:block;float:left;margin:0}.column-filesize code{position:relative}.column-filesize .dashicons-update{display:none;overflow:hidden;position:absolute;width:100%;left:0;text-align:center;background-color:rgba(255,255,255,.8)}.column-filesize .dashicons-update span{display:none}.column-filesize:hover .dashicons-update{display:inline-block}.hmbkp-exclude-settings td span.reason{color:#CCC}.server-info{overflow:auto;max-height:50%;outline:#000 solid 1px}.server-info pre{max-height:100px;overflow-x:hidden}.page-title-action span.dashicons-admin-users{position:relative;display:inline-block;vertical-align:middle;top:-2px}pre{background-color:#eee;padding:10px;white-space:pre;max-height:320px;overflow:auto;word-wrap:normal!important}@media screen and (max-width:768px){.wrap h2{padding:10px 0 0}.hmbkp-schedule-sentence::before{height:80px}h2 .nav-tab{display:block;padding:10px;margin:0}#intercom-info,.hmbkp-exclude-settings tr>:first-child,.hmbkp-schedule-settings thead tr:nth-child(2),.hmbkp-schedule-settings tr :nth-child(4),.hmbkp-schedule-settings tr :nth-child(5){display:none}.hmbkp-schedule-sentence{margin:10px 0;padding:10px}.hmbkp-exclude-settings table{margin:0 -10px;border-left:none;border-right:none;width:calc(100% + 20px)}.hmbkp-schedule-settings{padding:0 10px 10px;margin-left:-10px;margin-right:-10px;margin-bottom:-10px}table.widefat tbody tr:nth-child(even){background-color:#fff}table.widefat tbody tr:nth-child(odd){background-color:#f9f9f9}}.tools_page_backupwordpress_extensions a[href*="page=backupwordpress"]{font-weight:700!important;color:#fff!important}
1
+ .hmbkp-schedule-actions a,.hmbkp-schedule-settings .column-format code{white-space:nowrap}.hmbkp_active td:first-child>code:before{content:"\00a0 \2713 ";font-size:11px}.hmbkp_active{background:#E5F7E8}div#hmbkp-warning,h2.nav-tab-wrapper+div[id^=hmbkp]{margin:20px 0 15px}h2+div[id^=hmbkp] input{max-width:100%}li a.hmbkp-running:not(.current):before{width:20px;height:20px;margin:-1px 10px -5px 0;content:"";background:url(spinner-2x.gif) no-repeat;background-size:20px;display:inline-block}.hmbkp-upsell{margin-top:40px;padding-top:16px;border-top:1px solid #ccc}.hmbkp-schedule-sentence{font-size:16px;margin:0 0 20px;background-color:#FBFBFB;padding:20px;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04)}.hmbkp-schedule-sentence::before{content:"\2714";margin-right:10px;width:16px;height:60px;display:block;float:left}.hmbkp-schedule-sentence.hmbkp-error:before{content:"\2718"}.hmbkp-schedule-sentence.hmbkp-running:before{width:20px;height:80px;margin:-1px 10px 0 0;content:"";background:url(spinner-2x.gif) no-repeat;background-size:20px;display:inline-block}.hmbkp-schedule-sentence .hmbkp-status{display:none;font-size:12px;color:#666;margin:2px 0 0 30px}.hmbkp-schedule-sentence.hmbkp-running .hmbkp-status{display:block}.hmbkp-schedule-sentence.hmbkp-running .hmbkp-schedule-actions{display:none}.hmbkp-schedule-sentence :not(a)[title]{border-bottom:1px dotted #CCC;cursor:help}.hmbkp-schedule-sentence .hmbkp-status[title]{border-bottom:none}.hmbkp-schedule-sentence .submit{padding:0}.hmbkp-schedule-sentence .hmbkp-schedule-actions{visibility:visible;font-size:12px;margin:0 0 0 26px}.hmbkp-schedule-sentence .row-actions{position:static}.hmbkp-schedule-settings{border-top:1px solid #e5e5e5;margin:20px -20px -20px;background-color:#f5f5f5;padding:0 20px 20px}.hmbkp-exclude-settings thead tr:last-child,table.widefat tbody tr:nth-child(odd){background-color:#f9f9f9}.hmbkp-ajax-loading,button.hmbkp-ajax-loading{padding-left:20px;position:relative}.hmbkp-ajax-loading::after{content:"";width:16px;height:16px;background-image:url(spinner-2x.gif);background-size:16px 16px;background-repeat:no-repeat;background-position:0 0;position:absolute;right:-30px;top:5px}.delete-action{color:#a00;-webkit-transition:all .3s ease;transition:all .3s ease}.delete-action:hover .delete-action:focus{color:red;-webkit-transition:all .3s ease;transition:all .3s ease}.strikethrough{text-decoration:line-through}.hmbkp-exclude-settings td:first-child,.hmbkp-exclude-settings th:first-child{width:20px;padding-right:0}.hmbkp-exclude-settings table .button-secondary{line-height:18px;height:20px}thead td{border-bottom:1px solid #e1e1e1}.hmbkp-exclude-settings table .spinner{display:block;float:left;margin:0}.column-filesize code{position:relative}.column-filesize .dashicons-update{display:none;overflow:hidden;position:absolute;width:100%;left:0;text-align:center;background-color:rgba(255,255,255,.8)}.column-filesize .dashicons-update span{display:none}.column-filesize:hover .dashicons-update{display:inline-block}.hmbkp-exclude-settings td span.reason{color:#CCC}.server-info{overflow:auto;max-height:50%;outline:#000 solid 1px}.server-info pre{max-height:100px;overflow-x:hidden}.page-title-action span.dashicons-admin-users{position:relative;display:inline-block;vertical-align:middle;top:-2px}pre{background-color:#eee;padding:10px;white-space:pre;max-height:320px;overflow:auto;word-wrap:normal!important}@media screen and (max-width:768px){.wrap h2{padding:10px 0 0}.hmbkp-schedule-sentence::before{height:80px}h2 .nav-tab{display:block;padding:10px;margin:0}#intercom-info,.hmbkp-exclude-settings tr>:first-child,.hmbkp-schedule-settings thead tr:nth-child(2),.hmbkp-schedule-settings tr :nth-child(4),.hmbkp-schedule-settings tr :nth-child(5){display:none}.hmbkp-schedule-sentence{margin:10px 0;padding:10px}.hmbkp-exclude-settings table{margin:0 -10px;border-left:none;border-right:none;width:calc(100% + 20px)}.hmbkp-schedule-settings{padding:0 10px 10px;margin-left:-10px;margin-right:-10px;margin-bottom:-10px}table.widefat tbody tr:nth-child(even){background-color:#fff}table.widefat tbody tr:nth-child(odd){background-color:#f9f9f9}}
assets/hmbkp.min.js CHANGED
@@ -1,24 +1 @@
1
- var BackUpWordPressAdmin=function(a){"use strict";function b(){d=a("select#hmbkp_schedule_recurrence_type"),
2
- // Don't ever cache ajax requests
3
- a.ajaxSetup({cache:!1}),d.length&&(c(d.val()),a(document).on("change","select#hmbkp_schedule_recurrence_type",function(){c(a(this).val())})),a(".notice.is-dismissible").on("click",".notice-dismiss",function(){a.post(ajaxurl,{action:"hmbkp_dismiss_notice"})}),
4
- // Show delete confirm message for delete schedule
5
- a(document).on("click",".hmbkp-schedule-actions .delete-action",function(a){confirm(hmbkp.delete_schedule)||a.preventDefault()}),
6
- // Show delete confirm message for delete backup
7
- a(document).on("click",".hmbkp_manage_backups_row .delete-action",function(a){confirm(hmbkp.delete_backup)||a.preventDefault()}),
8
- // Show delete confirm message for remove exclude rule
9
- a(document).on("click",".hmbkp-edit-schedule-excludes-form .delete-action",function(a){confirm(hmbkp.remove_exclude_rule)||a.preventDefault()}),
10
- // Test the cron response using ajax
11
- a.post(ajaxurl,{nonce:hmbkp.nonce,action:"hmbkp_cron_test"},function(b){"1"!==b&&a(".wrap > h2").after(b)}),
12
- // Run a backup
13
- a(document).on("click",".hmbkp-run",function(b){wp.heartbeat.interval("fast"),a(this).closest(".hmbkp-schedule-sentence").addClass("hmbkp-running"),a(".hmbkp-error").removeClass("hmbkp-error");var c=a("[data-hmbkp-schedule-id]").attr("data-hmbkp-schedule-id");a.post(ajaxurl,{hmbkp_run_schedule_nonce:hmbkp.hmbkp_run_schedule_nonce,action:"hmbkp_run_schedule",hmbkp_schedule_id:c}),b.preventDefault()}),
14
- // Send the schedule id with the heartbeat
15
- a(document).on("heartbeat-send",function(b,c){c.hmbkp_schedule_id=a("[data-hmbkp-schedule-id]").attr("data-hmbkp-schedule-id"),a(".hmbkp-schedule-sentence.hmbkp-running").length?c.hmbkp_is_in_progress=!0:c.hmbkp_client_request="site_size"}),
16
- // Update schedule status on heartbeat tick
17
- a(document).on("heartbeat-tick",function(b,c){if(
18
- // If the schedule has finished then reload the page
19
- 0!==c.hmbkp_schedule_status||a(".hmbkp-error").length||location.reload(!0),
20
- // If the schedule is still running then update the schedule status
21
- 0!==c.hmbkp_schedule_status&&void 0!==c.hmbkp_schedule_status&&a(".hmbkp-status").replaceWith(c.hmbkp_schedule_status),void 0!==c.hmbkp_site_size&&a("code.calculating").length){a("code.calculating").text(c.hmbkp_site_size);var d=a(".hmbkp-exclude-settings");d.length&&d.replaceWith(c.hmbkp_dir_sizes)}}),
22
- // Closing ThickBox Modal Window
23
- a(document).on("click",".hmbkp-thickbox-close",function(a){a.preventDefault(),window.parent.tb_remove()}),a(document).on("click",'[id^="hmbkp-warning-"] .notice-dismiss',function(){a.post(ajaxurl,{action:"hmbkp_dismiss_error"})}),jQuery(document).one("click",".hmbkp_send_error_via_email",function(a){a.preventDefault(),jQuery(this).addClass("hmbkp-ajax-loading").attr("disabled","disabled"),jQuery.post(ajaxurl,{nonce:hmbkp.nonce,action:"hmbkp_email_error",hmbkp_error:data},function(){})})}function c(a){a="undefined"!=typeof a?a:"manually";var b=jQuery(".recurring-setting"),c=jQuery("#schedule-start"),d=jQuery(".twice-js");switch(a){case"manually":b.hide();break;case"hourly":b.hide();break;case"daily":b.hide(),c.show(),d.hide();break;case"twicedaily":b.hide(),c.show(),d.show();break;case"weekly":// fall through
24
- case"fortnightly":b.hide(),jQuery("#start-day").show(),c.show(),d.hide();break;case"monthly":b.hide(),c.show(),jQuery("#start-date").show(),d.hide()}}var d;return{init:b}}(jQuery);jQuery(document).ready(BackUpWordPressAdmin.init);
1
+ var BackUpWordPressAdmin=function(a){"use strict";function b(){d=a("select#hmbkp_schedule_recurrence_type"),a.ajaxSetup({cache:!1}),d.length&&(c(d.val()),a(document).on("change","select#hmbkp_schedule_recurrence_type",function(){c(a(this).val())})),a(".notice.is-dismissible").on("click",".notice-dismiss",function(){a.post(ajaxurl,{action:"hmbkp_dismiss_notice"})}),a(document).on("click",".hmbkp-schedule-actions .delete-action",function(a){confirm(hmbkp.delete_schedule)||a.preventDefault()}),a(document).on("click",".hmbkp_manage_backups_row .delete-action",function(a){confirm(hmbkp.delete_backup)||a.preventDefault()}),a(document).on("click",".hmbkp-edit-schedule-excludes-form .delete-action",function(a){confirm(hmbkp.remove_exclude_rule)||a.preventDefault()}),a.post(ajaxurl,{nonce:hmbkp.nonce,action:"hmbkp_cron_test"},function(b){"1"!==b&&a(".wrap > h2").after(b)}),a(document).on("click",".hmbkp-run",function(b){wp.heartbeat.interval("fast"),a(this).closest(".hmbkp-schedule-sentence").addClass("hmbkp-running"),a(".hmbkp-error").removeClass("hmbkp-error");var c=a("[data-hmbkp-schedule-id]").attr("data-hmbkp-schedule-id");a.post(ajaxurl,{hmbkp_run_schedule_nonce:hmbkp.hmbkp_run_schedule_nonce,action:"hmbkp_run_schedule",hmbkp_schedule_id:c}),b.preventDefault()}),a(document).on("heartbeat-send",function(b,c){c.hmbkp_schedule_id=a("[data-hmbkp-schedule-id]").attr("data-hmbkp-schedule-id"),a(".hmbkp-schedule-sentence.hmbkp-running").length?c.hmbkp_is_in_progress=!0:c.hmbkp_client_request="site_size"}),a(document).on("heartbeat-tick",function(b,c){if(0!==c.hmbkp_schedule_status||a(".hmbkp-error").length||location.reload(!0),0!==c.hmbkp_schedule_status&&void 0!==c.hmbkp_schedule_status&&a(".hmbkp-status").replaceWith(c.hmbkp_schedule_status),void 0!==c.hmbkp_site_size&&a("code.calculating").length){a("code.calculating").text(c.hmbkp_site_size);var d=a(".hmbkp-exclude-settings");d.length&&d.replaceWith(c.hmbkp_dir_sizes)}}),a(document).on("click",".hmbkp-thickbox-close",function(a){a.preventDefault(),window.parent.tb_remove()}),a(document).on("click",'[id^="hmbkp-warning-"] .notice-dismiss',function(){a.post(ajaxurl,{action:"hmbkp_dismiss_error"})})}function c(a){a="undefined"!=typeof a?a:"manually";var b=jQuery(".recurring-setting"),c=jQuery("#schedule-start"),d=jQuery(".twice-js");switch(a){case"manually":b.hide();break;case"hourly":b.hide();break;case"daily":b.hide(),c.show(),d.hide();break;case"twicedaily":b.hide(),c.show(),d.show();break;case"weekly":case"fortnightly":b.hide(),jQuery("#start-day").show(),c.show(),d.hide();break;case"monthly":b.hide(),c.show(),jQuery("#start-date").show(),d.hide()}}var d;return{init:b}}(jQuery);jQuery(document).ready(BackUpWordPressAdmin.init);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backupwordpress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: BackUpWordPress
4
  Plugin URI: http://bwp.hmn.md/
5
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>. On multisite, you'll find me under the Network Settings menu.
6
- Version: 3.6.2
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  License: GPL-2+
3
  Plugin Name: BackUpWordPress
4
  Plugin URI: http://bwp.hmn.md/
5
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>. On multisite, you'll find me under the Network Settings menu.
6
+ Version: 3.6.3
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  License: GPL-2+
classes/backup/class-backup-engine-database-mysqldump.php CHANGED
@@ -12,7 +12,7 @@ class Mysqldump_Database_Backup_Engine extends Database_Backup_Engine {
12
  /**
13
  * The path to the mysqldump executable
14
  *
15
- * @var string
16
  */
17
  private $mysqldump_executable_path = '';
18
 
@@ -126,7 +126,7 @@ class Mysqldump_Database_Backup_Engine extends Database_Backup_Engine {
126
  /**
127
  * Get the connection args for the mysqldump command
128
  *
129
- * @return array The array of connection args
130
  */
131
  public function get_mysql_connection_args() {
132
 
12
  /**
13
  * The path to the mysqldump executable
14
  *
15
+ * @var string|false
16
  */
17
  private $mysqldump_executable_path = '';
18
 
126
  /**
127
  * Get the connection args for the mysqldump command
128
  *
129
+ * @return string[] The array of connection args
130
  */
131
  public function get_mysql_connection_args() {
132
 
classes/backup/class-backup-engine-database.php CHANGED
@@ -42,7 +42,7 @@ abstract class Database_Backup_Engine extends Backup_Engine {
42
  * Individual Database Backup Engine implementations must include
43
  * a backup method at a minimum.
44
  *
45
- * @return [type] [description]
46
  */
47
  abstract public function backup();
48
 
@@ -65,7 +65,7 @@ abstract class Database_Backup_Engine extends Backup_Engine {
65
  /**
66
  * Get the database charset setting.
67
  *
68
- * @return [string The database charset.
69
  */
70
  public function get_charset() {
71
  global $wpdb;
42
  * Individual Database Backup Engine implementations must include
43
  * a backup method at a minimum.
44
  *
45
+ * @return bool Whether the backup completed successfully or not.
46
  */
47
  abstract public function backup();
48
 
65
  /**
66
  * Get the database charset setting.
67
  *
68
+ * @return string The database charset.
69
  */
70
  public function get_charset() {
71
  global $wpdb;
classes/backup/class-backup-engine-file-zip.php CHANGED
@@ -12,7 +12,7 @@ class Zip_File_Backup_Engine extends File_Backup_Engine {
12
  /**
13
  * The path to the zip executable
14
  *
15
- * @var string
16
  */
17
  private $zip_executable_path = '';
18
 
@@ -73,6 +73,8 @@ class Zip_File_Backup_Engine extends File_Backup_Engine {
73
  return false;
74
  }
75
 
 
 
76
  // cd to the site root
77
  $command[] = 'cd ' . escapeshellarg( Path::get_root() );
78
 
@@ -122,7 +124,7 @@ class Zip_File_Backup_Engine extends File_Backup_Engine {
122
  */
123
  public function get_exclude_string() {
124
 
125
- if ( ! $this->excludes ) {
126
  return '';
127
  }
128
 
12
  /**
13
  * The path to the zip executable
14
  *
15
+ * @var string|false
16
  */
17
  private $zip_executable_path = '';
18
 
73
  return false;
74
  }
75
 
76
+ $command = array();
77
+
78
  // cd to the site root
79
  $command[] = 'cd ' . escapeshellarg( Path::get_root() );
80
 
124
  */
125
  public function get_exclude_string() {
126
 
127
+ if ( empty( $this->excludes ) ) {
128
  return '';
129
  }
130
 
classes/backup/class-backup-engine-file.php CHANGED
@@ -14,7 +14,7 @@ abstract class File_Backup_Engine extends Backup_Engine {
14
  /**
15
  * The array of excludes rules
16
  *
17
- * @var array
18
  */
19
  protected $excludes;
20
 
@@ -38,7 +38,7 @@ abstract class File_Backup_Engine extends Backup_Engine {
38
  /**
39
  * Set the excludes rules for the backup.
40
  *
41
- * @param array $excludes The exclude rules.
42
  */
43
  public function set_excludes( Excludes $excludes ) {
44
  $this->excludes = $excludes;
@@ -53,13 +53,13 @@ abstract class File_Backup_Engine extends Backup_Engine {
53
  * exclude rules.
54
  *
55
  * @uses Finder
56
- * @return Finder The Finder iterator of all files to be included
57
  */
58
  public function get_files() {
59
 
60
  $finder = new Finder();
61
 
62
- $finder->followLinks( true );
63
  $finder->ignoreDotFiles( false );
64
  $finder->ignoreVCS( true );
65
  $finder->ignoreUnreadableDirs( true );
14
  /**
15
  * The array of excludes rules
16
  *
17
+ * @var Excludes
18
  */
19
  protected $excludes;
20
 
38
  /**
39
  * Set the excludes rules for the backup.
40
  *
41
+ * @param Excludes $excludes The exclude rules.
42
  */
43
  public function set_excludes( Excludes $excludes ) {
44
  $this->excludes = $excludes;
53
  * exclude rules.
54
  *
55
  * @uses Finder
56
+ * @return SplFileInfo[] The array of all files to be included
57
  */
58
  public function get_files() {
59
 
60
  $finder = new Finder();
61
 
62
+ $finder->followLinks(); // defaults to true
63
  $finder->ignoreDotFiles( false );
64
  $finder->ignoreVCS( true );
65
  $finder->ignoreUnreadableDirs( true );
classes/backup/class-backup-engine.php CHANGED
@@ -12,6 +12,13 @@ namespace HM\BackUpWordPress;
12
  */
13
  abstract class Backup_Engine {
14
 
 
 
 
 
 
 
 
15
  /**
16
  * An array of backup errors.
17
  *
@@ -79,10 +86,10 @@ abstract class Backup_Engine {
79
  /**
80
  * Get the array of errors encountered during the backup process.
81
  *
82
- * @param string $context The context for the error, usually the Backup
83
- * Engine that encountered the error.
84
  *
85
- * @return array The array of errors.
86
  */
87
  public function get_errors( $context = null ) {
88
 
@@ -118,10 +125,10 @@ abstract class Backup_Engine {
118
  /**
119
  * Get the array of warnings encountered during the backup process.
120
  *
121
- * @param string $context The context for the warning, usually the Backup
122
- * Engine that encountered the warning.
123
  *
124
- * @return array The array of warnings.
125
  */
126
  public function get_warnings( $context = null ) {
127
 
@@ -141,7 +148,7 @@ abstract class Backup_Engine {
141
  * issues with the backup process.
142
  *
143
  * @param string $context The context for the warning.
144
- * @param string $error The warning that was encountered.
145
  */
146
  public function warning( $context, $warning ) {
147
 
@@ -160,14 +167,14 @@ abstract class Backup_Engine {
160
  *
161
  * PHP errors are always treat as warnings rather than errors.
162
  *
163
- * @param int $type The level of error raised
164
  *
165
- * @return false Return false to pass the error back to PHP so it can
166
- * be handled natively.
167
  */
168
  public function error_handler( $type ) {
169
 
170
- // Skip strict & deprecated warnings
171
  if ( ( defined( 'E_DEPRECATED' ) && E_DEPRECATED === $type ) || ( defined( 'E_STRICT' ) && E_STRICT === $type ) || 0 === error_reporting() ) {
172
  return false;
173
  }
@@ -177,7 +184,7 @@ abstract class Backup_Engine {
177
  *
178
  * These are:
179
  *
180
- * @param int $errorno The error level expressed as an integer/
181
  * @param string $errstr The error message.
182
  * @param string $errfile The file that the error raised in.
183
  * @param string $errorline The line number the error was raised on.
12
  */
13
  abstract class Backup_Engine {
14
 
15
+ /**
16
+ * The filename of the backup
17
+ *
18
+ * @var string
19
+ */
20
+ private $backup_filename = '';
21
+
22
  /**
23
  * An array of backup errors.
24
  *
86
  /**
87
  * Get the array of errors encountered during the backup process.
88
  *
89
+ * @param string|null $context The context for the error, usually the Backup
90
+ * Engine that encountered the error.
91
  *
92
+ * @return array The array of errors.
93
  */
94
  public function get_errors( $context = null ) {
95
 
125
  /**
126
  * Get the array of warnings encountered during the backup process.
127
  *
128
+ * @param string|null $context The context for the warning, usually the Backup
129
+ * Engine that encountered the warning.
130
  *
131
+ * @return array The array of warnings.
132
  */
133
  public function get_warnings( $context = null ) {
134
 
148
  * issues with the backup process.
149
  *
150
  * @param string $context The context for the warning.
151
+ * @param string $warning The warning that was encountered.
152
  */
153
  public function warning( $context, $warning ) {
154
 
167
  *
168
  * PHP errors are always treat as warnings rather than errors.
169
  *
170
+ * @param int $type The level of error raised.
171
  *
172
+ * @return boolean Return false to pass the error back to PHP so it can
173
+ * be handled natively.
174
  */
175
  public function error_handler( $type ) {
176
 
177
+ // Skip strict & deprecated warnings.
178
  if ( ( defined( 'E_DEPRECATED' ) && E_DEPRECATED === $type ) || ( defined( 'E_STRICT' ) && E_STRICT === $type ) || 0 === error_reporting() ) {
179
  return false;
180
  }
184
  *
185
  * These are:
186
  *
187
+ * @param int $errorno The error level expressed as an integer.
188
  * @param string $errstr The error message.
189
  * @param string $errfile The file that the error raised in.
190
  * @param string $errorline The line number the error was raised on.
classes/backup/class-backup-status.php CHANGED
@@ -8,6 +8,7 @@ namespace HM\BackUpWordPress;
8
  class Backup_Status {
9
 
10
  private $filename = '';
 
11
 
12
  public function __construct( $id ) {
13
  $this->id = $id;
@@ -18,6 +19,11 @@ class Backup_Status {
18
  $this->set_status( $status_message );
19
  }
20
 
 
 
 
 
 
21
  public function get_backup_filename() {
22
 
23
  if ( $this->is_started() ) {
@@ -74,7 +80,7 @@ class Backup_Status {
74
 
75
  // If start hasn't been called yet then we wont' have a backup filename
76
  if ( ! $this->filename ) {
77
- return '';
78
  }
79
 
80
  $status = json_encode( (object) array(
8
  class Backup_Status {
9
 
10
  private $filename = '';
11
+ private $id;
12
 
13
  public function __construct( $id ) {
14
  $this->id = $id;
19
  $this->set_status( $status_message );
20
  }
21
 
22
+ /**
23
+ * Get the filename of the backup.
24
+ *
25
+ * @return string|null The backup filename.
26
+ */
27
  public function get_backup_filename() {
28
 
29
  if ( $this->is_started() ) {
80
 
81
  // If start hasn't been called yet then we wont' have a backup filename
82
  if ( ! $this->filename ) {
83
+ return;
84
  }
85
 
86
  $status = json_encode( (object) array(
classes/backup/class-backup.php CHANGED
@@ -137,6 +137,8 @@ class Backup {
137
  * Perform the backup by iterating through each Backup_Engine in turn until
138
  * we find one which works. If a backup filename or any excludes have been
139
  * set then those are passed to each Backup_Engine.
 
 
140
  */
141
  public function perform_backup( array $backup_engines ) {
142
 
@@ -178,7 +180,7 @@ class Backup {
178
  * issues with the backup process.
179
  *
180
  * @param string $context The context for the warning.
181
- * @param string $error The warning that was encountered.
182
  */
183
  public function warning( $context, $warning ) {
184
 
137
  * Perform the backup by iterating through each Backup_Engine in turn until
138
  * we find one which works. If a backup filename or any excludes have been
139
  * set then those are passed to each Backup_Engine.
140
+ *
141
+ * @return Backup_Engine|false The successful backup engine or false on failure.
142
  */
143
  public function perform_backup( array $backup_engines ) {
144
 
180
  * issues with the backup process.
181
  *
182
  * @param string $context The context for the warning.
183
+ * @param string $warning The warning that was encountered.
184
  */
185
  public function warning( $context, $warning ) {
186
 
classes/class-email-service.php CHANGED
@@ -101,9 +101,10 @@ class Email_Service extends Service {
101
  /**
102
  * Validate the email and return an error if validation fails
103
  *
104
- * @param array &$new_data Array of new data, passed by reference
105
- * @param array $old_data The data we are replacing
106
- * @return null|array Null on success, array of errors if validation failed
 
107
  */
108
  public function update( &$new_data, $old_data ) {
109
 
@@ -146,7 +147,6 @@ class Email_Service extends Service {
146
  *
147
  * @see Backup::do_action
148
  * @param string $action The action received from the backup
149
- * @return void
150
  */
151
  public function action( $action, Backup $backup ) {
152
 
101
  /**
102
  * Validate the email and return an error if validation fails
103
  *
104
+ * @param array &$new_data Array of new data, passed by reference.
105
+ * @param array $old_data The data we are replacing.
106
+ *
107
+ * @return array|null Null on success, array of errors if validation failed.
108
  */
109
  public function update( &$new_data, $old_data ) {
110
 
147
  *
148
  * @see Backup::do_action
149
  * @param string $action The action received from the backup
 
150
  */
151
  public function action( $action, Backup $backup ) {
152
 
classes/class-excludes.php CHANGED
@@ -15,7 +15,7 @@ class Excludes {
15
  private $excludes;
16
 
17
  /**
18
- * The array of default exclude rules
19
  *
20
  * @var array
21
  */
@@ -29,9 +29,10 @@ class Excludes {
29
  '.bzr',
30
  '.git',
31
  '.hg',
 
32
  'backwpup-*',
33
  'updraft',
34
- 'wp-snapshots',
35
  'backupbuddy_backups',
36
  'pb_backupbuddy',
37
  'backup-db',
@@ -60,11 +61,10 @@ class Excludes {
60
  }
61
 
62
  $this->excludes = $excludes;
63
-
64
  }
65
 
66
  /**
67
- * Get the excludes
68
  *
69
  * Returns any user set excludes as well as the default list.
70
  *
@@ -80,31 +80,30 @@ class Excludes {
80
  * The primary difference being that any wildcard (*) rules are converted to the regex
81
  * fragment `[\s\S]*?`.
82
  *
83
- * @return array The array of exclude rules
84
  */
85
  public function get_excludes_for_regex() {
86
 
87
  $excludes = $this->get_excludes();
88
 
89
- // Prepare the exclude rules
90
  foreach ( $excludes as &$exclude ) {
91
 
92
  if ( strpos( $exclude, '*' ) !== false ) {
93
 
94
- // Escape slashes
95
  $exclude = str_replace( '/', '\/', $exclude );
96
 
97
- // Convert WildCards to regex
98
  $exclude = str_replace( '*', '[\s\S]*?', $exclude );
99
 
100
- // Wrap in slashes
101
  $exclude = '/' . $exclude . '/';
102
 
103
  }
104
  }
105
 
106
  return $excludes;
107
-
108
  }
109
 
110
  /**
@@ -116,7 +115,7 @@ class Excludes {
116
 
117
  $excludes = $this->excludes;
118
 
119
- // If path() is inside root(), exclude it
120
  if ( strpos( Path::get_path(), Path::get_root() ) !== false && Path::get_root() !== Path::get_path() ) {
121
  array_unshift( $excludes, trailingslashit( Path::get_path() ) );
122
  }
@@ -133,7 +132,7 @@ class Excludes {
133
 
134
  $excludes = array();
135
 
136
- // Back compat with the old Constant
137
  if ( defined( 'HMBKP_EXCLUDE' ) && HMBKP_EXCLUDE ) {
138
  $excludes = explode( ',', implode( ',', (array) HMBKP_EXCLUDE ) );
139
  }
@@ -148,39 +147,62 @@ class Excludes {
148
  $excludes = apply_filters( 'hmbkp_default_excludes', $excludes );
149
 
150
  return $this->normalize( $excludes );
151
-
152
  }
153
 
154
  /**
155
- * normalise the exclude rules so they are ready to work with.
156
  *
157
- * @param array $excludes The array of exclude rules to normalise.
158
  *
159
- * @return array The array of normalised rules.
160
  */
161
  public function normalize( $excludes ) {
162
 
163
  $excludes = array_map(
164
  function( $exclude ) {
165
 
166
- // Convert absolute paths to relative
167
  $exclude = str_replace( PATH::get_root(), '', wp_normalize_path( $exclude ) );
168
 
169
- // Trim the slashes
170
  $exclude = trim( $exclude );
171
  $exclude = ltrim( $exclude, '/' );
172
  $exclude = untrailingslashit( $exclude );
173
 
174
  return $exclude;
175
-
176
  },
177
- $excludes );
 
178
 
179
- // Remove duplicate or empty rules
180
  $excludes = array_unique( $excludes );
181
  $excludes = array_filter( $excludes );
182
 
183
  return $excludes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
 
185
  }
186
  }
15
  private $excludes;
16
 
17
  /**
18
+ * The array of default exclude rules.
19
  *
20
  * @var array
21
  */
29
  '.bzr',
30
  '.git',
31
  '.hg',
32
+ 'backupwp',
33
  'backwpup-*',
34
  'updraft',
35
+ '(?:wp-)?snapshots?', // wp-snapshots, snapshots, snapshot
36
  'backupbuddy_backups',
37
  'pb_backupbuddy',
38
  'backup-db',
61
  }
62
 
63
  $this->excludes = $excludes;
 
64
  }
65
 
66
  /**
67
+ * Get the excludes.
68
  *
69
  * Returns any user set excludes as well as the default list.
70
  *
80
  * The primary difference being that any wildcard (*) rules are converted to the regex
81
  * fragment `[\s\S]*?`.
82
  *
83
+ * @return array The array of exclude rules.
84
  */
85
  public function get_excludes_for_regex() {
86
 
87
  $excludes = $this->get_excludes();
88
 
89
+ // Prepare the exclude rules.
90
  foreach ( $excludes as &$exclude ) {
91
 
92
  if ( strpos( $exclude, '*' ) !== false ) {
93
 
94
+ // Escape slashes.
95
  $exclude = str_replace( '/', '\/', $exclude );
96
 
97
+ // Convert WildCards to regex.
98
  $exclude = str_replace( '*', '[\s\S]*?', $exclude );
99
 
100
+ // Wrap in slashes.
101
  $exclude = '/' . $exclude . '/';
102
 
103
  }
104
  }
105
 
106
  return $excludes;
 
107
  }
108
 
109
  /**
115
 
116
  $excludes = $this->excludes;
117
 
118
+ // If path() is inside root(), exclude it.
119
  if ( strpos( Path::get_path(), Path::get_root() ) !== false && Path::get_root() !== Path::get_path() ) {
120
  array_unshift( $excludes, trailingslashit( Path::get_path() ) );
121
  }
132
 
133
  $excludes = array();
134
 
135
+ // Back compat with the old constant.
136
  if ( defined( 'HMBKP_EXCLUDE' ) && HMBKP_EXCLUDE ) {
137
  $excludes = explode( ',', implode( ',', (array) HMBKP_EXCLUDE ) );
138
  }
147
  $excludes = apply_filters( 'hmbkp_default_excludes', $excludes );
148
 
149
  return $this->normalize( $excludes );
 
150
  }
151
 
152
  /**
153
+ * Normalise the exclude rules so they are ready to work with.
154
  *
155
+ * @param array $excludes The array of exclude rules to normalise.
156
  *
157
+ * @return array The array of normalised rules.
158
  */
159
  public function normalize( $excludes ) {
160
 
161
  $excludes = array_map(
162
  function( $exclude ) {
163
 
164
+ // Convert absolute paths to relative.
165
  $exclude = str_replace( PATH::get_root(), '', wp_normalize_path( $exclude ) );
166
 
167
+ // Trim the slashes.
168
  $exclude = trim( $exclude );
169
  $exclude = ltrim( $exclude, '/' );
170
  $exclude = untrailingslashit( $exclude );
171
 
172
  return $exclude;
 
173
  },
174
+ $excludes
175
+ );
176
 
177
+ // Remove duplicate or empty rules.
178
  $excludes = array_unique( $excludes );
179
  $excludes = array_filter( $excludes );
180
 
181
  return $excludes;
182
+ }
183
+
184
+ /**
185
+ * Check if a file is excluded,
186
+ * i.e. excluded directly or is in an excluded folder.
187
+ *
188
+ * @param \SplFileInfo $file File to check if it's excluded.
189
+ *
190
+ * @return bool|null True if file is excluded, false otherwise.
191
+ * Null - if it's not a file.
192
+ */
193
+ public function is_file_excluded( \SplFileInfo $file ) {
194
+
195
+ $exclude_string = implode( '|', $this->get_excludes_for_regex() );
196
+ $file_path_no_root = str_ireplace(
197
+ trailingslashit( Path::get_root() ),
198
+ '',
199
+ wp_normalize_path( $file->getPathname() )
200
+ );
201
+
202
+ if ( $exclude_string && preg_match( '(' . $exclude_string . ')', $file_path_no_root ) ) {
203
+ return true;
204
+ }
205
 
206
+ return false;
207
  }
208
  }
classes/class-notices.php CHANGED
@@ -84,9 +84,9 @@ class Notices {
84
 
85
  $new_notices = $notices = $this->get_persistent_notices();
86
 
87
- // Make sure we merge in any existing notices
88
  if ( ! empty( $notices[ $context ] ) ) {
89
- $new_notices[ $context ] = array_merge( $notices[ $context ], $messages );
90
  } else {
91
  $new_notices[ $context ] = $messages;
92
  }
84
 
85
  $new_notices = $notices = $this->get_persistent_notices();
86
 
87
+ // Make sure we merge new notices into to any existing notices
88
  if ( ! empty( $notices[ $context ] ) ) {
89
+ $new_notices[ $context ] = array_unique( array_merge( $new_notices[ $context ], $messages ) );
90
  } else {
91
  $new_notices[ $context ] = $messages;
92
  }
classes/class-path.php CHANGED
@@ -269,7 +269,7 @@ class Path {
269
  /**
270
  * Calculate the backup path and create the directory if it doesn't exist.
271
  *
272
- * Tries all possible locations and uses the first one possible
273
  *
274
  * @return
275
  */
@@ -277,33 +277,29 @@ class Path {
277
 
278
  $paths = array();
279
 
280
- // If we have a custom path then try to use it
281
  if ( $this->get_custom_path() ) {
282
  $paths[] = $this->get_custom_path();
283
  }
284
 
285
- // If there is already a backups directory then try to use that
286
  if ( $this->get_existing_path() ) {
287
  $paths[] = $this->get_existing_path();
288
  }
289
 
290
- // If not then default to a new directory in wp-content
291
  $paths[] = $this->get_default_path();
292
 
293
- // If that didn't work then fallback to a new directory in uploads
294
  $paths[] = $this->get_fallback_path();
295
 
296
- // Loop through possible paths, use the first one that exists/can be created and is writable
297
  foreach ( $paths as $path ) {
298
- if ( wp_mkdir_p( $path ) && wp_is_writable( $path ) ) { // Also handles fixing perms / directory already exists
 
299
  break;
300
  }
301
  }
302
-
303
- if ( file_exists( $path ) && wp_is_writable( $path ) ) {
304
- $this->path = $path;
305
- }
306
-
307
  }
308
 
309
  /**
@@ -338,6 +334,7 @@ class Path {
338
  // Protect the directory with a .htaccess file on Apache servers
339
  if ( $is_apache && function_exists( 'insert_with_markers' ) && ! file_exists( $htaccess ) && wp_is_writable( $this->path ) ) {
340
 
 
341
  $contents[] = '# ' . sprintf( __( 'This %s file ensures that other people cannot download your backup files.', 'backupwordpress' ), '.htaccess' );
342
  $contents[] = '';
343
  $contents[] = '<IfModule mod_rewrite.c>';
@@ -362,7 +359,7 @@ class Path {
362
 
363
  $paths = $this->get_existing_paths();
364
 
365
- if ( ( $paths && $this->get_custom_path() ) || count( $paths ) > 1 ) {
366
  foreach ( $paths as $old_path ) {
367
  $this->move_old_backups( $old_path );
368
  }
@@ -372,9 +369,9 @@ class Path {
372
 
373
  /**
374
  * Move backup files from an existing directory and the new
375
- * location
376
  *
377
- * @param string $path The path to move the backups from
378
  */
379
  public function move_old_backups( $from ) {
380
 
269
  /**
270
  * Calculate the backup path and create the directory if it doesn't exist.
271
  *
272
+ * Tries all possible locations and uses the first one possible.
273
  *
274
  * @return
275
  */
277
 
278
  $paths = array();
279
 
280
+ // If we have a custom path then try to use it.
281
  if ( $this->get_custom_path() ) {
282
  $paths[] = $this->get_custom_path();
283
  }
284
 
285
+ // If there is already a backups directory then try to use that.
286
  if ( $this->get_existing_path() ) {
287
  $paths[] = $this->get_existing_path();
288
  }
289
 
290
+ // If not then default to a new directory in wp-content.
291
  $paths[] = $this->get_default_path();
292
 
293
+ // If that didn't work then fallback to a new directory in uploads.
294
  $paths[] = $this->get_fallback_path();
295
 
296
+ // Loop through possible paths, use the first one that exists/can be created and is writable.
297
  foreach ( $paths as $path ) {
298
+ if ( wp_mkdir_p( $path ) && file_exists( $path ) && wp_is_writable( $path ) ) { // Also handles fixing perms / directory already exists.
299
+ $this->path = $path;
300
  break;
301
  }
302
  }
 
 
 
 
 
303
  }
304
 
305
  /**
334
  // Protect the directory with a .htaccess file on Apache servers
335
  if ( $is_apache && function_exists( 'insert_with_markers' ) && ! file_exists( $htaccess ) && wp_is_writable( $this->path ) ) {
336
 
337
+ $contents = array();
338
  $contents[] = '# ' . sprintf( __( 'This %s file ensures that other people cannot download your backup files.', 'backupwordpress' ), '.htaccess' );
339
  $contents[] = '';
340
  $contents[] = '<IfModule mod_rewrite.c>';
359
 
360
  $paths = $this->get_existing_paths();
361
 
362
+ if ( ( ! empty( $paths ) && $this->get_custom_path() ) || count( $paths ) > 1 ) {
363
  foreach ( $paths as $old_path ) {
364
  $this->move_old_backups( $old_path );
365
  }
369
 
370
  /**
371
  * Move backup files from an existing directory and the new
372
+ * location.
373
  *
374
+ * @param string $from The path to move the backups from.
375
  */
376
  public function move_old_backups( $from ) {
377
 
classes/class-plugin.php CHANGED
@@ -6,7 +6,7 @@ namespace HM\BackUpWordPress;
6
  * Class Plugin
7
  */
8
  final class Plugin {
9
- const PLUGIN_VERSION = '3.6.2';
10
 
11
  /**
12
  * @var Plugin The singleton instance.
6
  * Class Plugin
7
  */
8
  final class Plugin {
9
+ const PLUGIN_VERSION = '3.6.3';
10
 
11
  /**
12
  * @var Plugin The singleton instance.
classes/class-requirement.php CHANGED
@@ -9,24 +9,26 @@ namespace HM\BackUpWordPress;
9
  abstract class Requirement {
10
 
11
  /**
 
 
12
  * @var string
13
  */
14
  protected $name = '';
15
 
16
  /**
17
- * @return mixed
18
  */
19
  protected static function test() {}
20
 
21
  /**
22
- * @return mixed
23
  */
24
  public function name() {
25
  return $this->name;
26
  }
27
 
28
  /**
29
- * @return mixed|string
30
  */
31
  public function result() {
32
 
@@ -63,7 +65,7 @@ class Requirement_Zip_Archive extends Requirement {
63
  /**
64
  * @var string
65
  */
66
- var $name = 'ZipArchive';
67
 
68
  /**
69
  * @return bool
@@ -90,10 +92,10 @@ class Requirement_Zip_Command_Path extends Requirement {
90
  /**
91
  * @var string
92
  */
93
- var $name = 'zip command';
94
 
95
  /**
96
- * @return string
97
  */
98
  public static function test() {
99
 
@@ -115,10 +117,10 @@ class Requirement_Mysqldump_Command_Path extends Requirement {
115
  /**
116
  * @var string
117
  */
118
- var $name = 'mysqldump command';
119
 
120
  /**
121
- * @return string
122
  */
123
  public static function test() {
124
 
@@ -138,7 +140,7 @@ class Requirement_PHP_Version extends Requirement {
138
  /**
139
  * @var string
140
  */
141
- var $name = 'Version';
142
 
143
  /**
144
  * @return string
@@ -157,7 +159,7 @@ class Requirement_Cron_Array extends Requirement {
157
  /**
158
  * @var string
159
  */
160
- var $name = 'Cron Array';
161
 
162
  /**
163
  * @return bool|mixed
@@ -184,7 +186,7 @@ class Requirement_Language extends Requirement {
184
  /**
185
  * @var string
186
  */
187
- var $name = 'Language';
188
 
189
  /**
190
  * @return bool|mixed
@@ -216,7 +218,7 @@ class Requirement_Safe_Mode extends Requirement {
216
  /**
217
  * @var string
218
  */
219
- var $name = 'Safe Mode';
220
 
221
  /**
222
  * @return bool
@@ -235,7 +237,7 @@ class Requirement_PHP_Memory_Limit extends Requirement {
235
  /**
236
  * @var string
237
  */
238
- var $name = 'Memory Limit';
239
 
240
  /**
241
  * @return string
@@ -254,7 +256,7 @@ class Requirement_Backup_Path extends Requirement {
254
  /**
255
  * @var string
256
  */
257
- var $name = 'Backup Path';
258
 
259
  /**
260
  * @return string
@@ -273,7 +275,7 @@ class Requirement_Backup_Path_Permissions extends Requirement {
273
  /**
274
  * @var string
275
  */
276
- var $name = 'Backup Path Permissions';
277
 
278
  /**
279
  * @return string
@@ -292,7 +294,7 @@ class Requirement_WP_CONTENT_DIR extends Requirement {
292
  /**
293
  * @var string
294
  */
295
- var $name = 'WP_CONTENT_DIR';
296
 
297
  /**
298
  * @return string
@@ -311,7 +313,7 @@ class Requirement_WP_CONTENT_DIR_Permissions extends Requirement {
311
  /**
312
  * @var string
313
  */
314
- var $name = 'WP_CONTENT_DIR Permissions';
315
 
316
  /**
317
  * @return string
@@ -330,7 +332,7 @@ class Requirement_ABSPATH extends Requirement {
330
  /**
331
  * @var string
332
  */
333
- var $name = 'ABSPATH';
334
 
335
  /**
336
  * @return string
@@ -349,7 +351,7 @@ class Requirement_Backup_Root_Path extends Requirement {
349
  /**
350
  * @var string
351
  */
352
- var $name = 'Site Root Path';
353
 
354
  /**
355
  * @return string
@@ -368,7 +370,7 @@ class Requirement_Calculated_Size extends Requirement {
368
  /**
369
  * @var string
370
  */
371
- var $name = 'Calculated size of site';
372
 
373
  /**
374
  * @return array
@@ -402,10 +404,10 @@ class Requirement_WP_Cron_Test extends Requirement {
402
  /**
403
  * @var string
404
  */
405
- var $name = 'WP Cron Test Failed';
406
 
407
  /**
408
- * @return mixed
409
  */
410
  public static function test() {
411
  return (bool) get_option( 'hmbkp_wp_cron_test_failed' );
@@ -421,7 +423,7 @@ class Requirement_PHP_API extends Requirement {
421
  /**
422
  * @var string
423
  */
424
- var $name = 'Interface';
425
 
426
  /**
427
  * @return string
@@ -440,7 +442,7 @@ class Requirement_Server_Software extends Requirement {
440
  /**
441
  * @var string
442
  */
443
- var $name = 'Server';
444
 
445
  /**
446
  * @return bool
@@ -465,7 +467,7 @@ class Requirement_Server_OS extends Requirement {
465
  /**
466
  * @var string
467
  */
468
- var $name = 'OS';
469
 
470
  /**
471
  * @return string
@@ -484,7 +486,7 @@ class Requirement_PHP_Disable_Functions extends Requirement {
484
  /**
485
  * @var string
486
  */
487
- var $name = 'Disabled Functions';
488
 
489
  /**
490
  * @return string
@@ -503,7 +505,7 @@ class Requirement_PHP_Open_Basedir extends Requirement {
503
  /**
504
  * @var string
505
  */
506
- var $name = 'open_basedir';
507
 
508
  /**
509
  * @return string
@@ -524,7 +526,7 @@ class Requirement_Define_HMBKP_PATH extends Requirement {
524
  /**
525
  * @var string
526
  */
527
- var $name = 'HMBKP_PATH';
528
 
529
  /**
530
  * @return string
@@ -543,7 +545,7 @@ class Requirement_Define_HMBKP_ROOT extends Requirement {
543
  /**
544
  * @var string
545
  */
546
- var $name = 'HMBKP_ROOT';
547
 
548
  /**
549
  * @return string
@@ -562,7 +564,7 @@ class Requirement_Define_HMBKP_MYSQLDUMP_PATH extends Requirement {
562
  /**
563
  * @var string
564
  */
565
- var $name = 'HMBKP_MYSQLDUMP_PATH';
566
 
567
  /**
568
  * @return string
@@ -581,7 +583,7 @@ class Requirement_Define_HMBKP_ZIP_PATH extends Requirement {
581
  /**
582
  * @var string
583
  */
584
- var $name = 'HMBKP_ZIP_PATH';
585
 
586
  /**
587
  * @return string
@@ -600,7 +602,7 @@ class Requirement_Define_HMBKP_CAPABILITY extends Requirement {
600
  /**
601
  * @var string
602
  */
603
- var $name = 'HMBKP_CAPABILITY';
604
 
605
  /**
606
  * @return string
@@ -619,7 +621,7 @@ class Requirement_Define_HMBKP_EMAIL extends Requirement {
619
  /**
620
  * @var string
621
  */
622
- var $name = 'HMBKP_EMAIL';
623
 
624
  /**
625
  * @return string
@@ -638,7 +640,7 @@ class Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE extends Requirement {
638
  /**
639
  * @var string
640
  */
641
- var $name = 'HMBKP_ATTACHMENT_MAX_FILESIZE';
642
 
643
  /**
644
  * @return string
@@ -657,7 +659,7 @@ class Requirement_Define_HMBKP_EXCLUDE extends Requirement {
657
  /**
658
  * @var string
659
  */
660
- var $name = 'HMBKP_EXCLUDE';
661
 
662
  /**
663
  * @return string
@@ -670,8 +672,13 @@ Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EXCLUDE', '
670
 
671
  class Requirement_Active_Plugins extends Requirement {
672
 
673
- var $name = 'Active Plugins';
674
 
 
 
 
 
 
675
  public static function test() {
676
  return get_option( 'active_plugins' );
677
  }
@@ -680,8 +687,11 @@ Requirements::register( 'HM\BackUpWordPress\Requirement_Active_Plugins', 'Site'
680
 
681
  class Requirement_Home_Url extends Requirement {
682
 
683
- var $name = 'Home URL';
684
 
 
 
 
685
  public static function test() {
686
  return home_url();
687
  }
@@ -690,8 +700,11 @@ Requirements::register( 'HM\BackUpWordPress\Requirement_Home_Url', 'Site' );
690
 
691
  class Requirement_Site_Url extends Requirement {
692
 
693
- var $name = 'Site URL';
694
 
 
 
 
695
  public static function test() {
696
  return site_url();
697
  }
@@ -699,8 +712,11 @@ class Requirement_Site_Url extends Requirement {
699
  Requirements::register( 'HM\BackUpWordPress\Requirement_Site_Url', 'Site' );
700
 
701
  class Requirement_Plugin_Version extends Requirement {
702
- var $name = 'Plugin Version';
703
 
 
 
 
704
  public static function test() {
705
  return Plugin::PLUGIN_VERSION;
706
  }
@@ -709,8 +725,11 @@ Requirements::register( 'HM\BackUpWordPress\Requirement_Plugin_Version', 'consta
709
 
710
  class Requirement_Max_Exec extends Requirement {
711
 
712
- var $name = 'Max execution time';
713
 
 
 
 
714
  public static function test() {
715
  return @ini_get( 'max_execution_time' );
716
  }
@@ -719,8 +738,11 @@ Requirements::register( 'HM\BackUpWordPress\Requirement_Max_Exec', 'PHP' );
719
 
720
  class Requirement_PDO extends Requirement {
721
 
722
- var $name = 'PDO';
723
 
 
 
 
724
  public static function test() {
725
 
726
  if ( class_exists( 'PDO' ) && \PDO::getAvailableDrivers() ) {
@@ -742,7 +764,7 @@ class Requirement_Proc_Open extends Requirement {
742
  /**
743
  * @var string
744
  */
745
- var $name = 'proc_open';
746
 
747
  /**
748
  * @return bool
9
  abstract class Requirement {
10
 
11
  /**
12
+ * The name of the requirement.
13
+ *
14
  * @var string
15
  */
16
  protected $name = '';
17
 
18
  /**
19
+ * @return mixed Did the requirement pass or fail.
20
  */
21
  protected static function test() {}
22
 
23
  /**
24
+ * @return string
25
  */
26
  public function name() {
27
  return $this->name;
28
  }
29
 
30
  /**
31
+ * @return string
32
  */
33
  public function result() {
34
 
65
  /**
66
  * @var string
67
  */
68
+ protected $name = 'ZipArchive';
69
 
70
  /**
71
  * @return bool
92
  /**
93
  * @var string
94
  */
95
+ protected $name = 'zip command';
96
 
97
  /**
98
+ * @return string|false
99
  */
100
  public static function test() {
101
 
117
  /**
118
  * @var string
119
  */
120
+ protected $name = 'mysqldump command';
121
 
122
  /**
123
+ * @return string|false
124
  */
125
  public static function test() {
126
 
140
  /**
141
  * @var string
142
  */
143
+ protected $name = 'Version';
144
 
145
  /**
146
  * @return string
159
  /**
160
  * @var string
161
  */
162
+ protected $name = 'Cron Array';
163
 
164
  /**
165
  * @return bool|mixed
186
  /**
187
  * @var string
188
  */
189
+ protected $name = 'Language';
190
 
191
  /**
192
  * @return bool|mixed
218
  /**
219
  * @var string
220
  */
221
+ protected $name = 'Safe Mode';
222
 
223
  /**
224
  * @return bool
237
  /**
238
  * @var string
239
  */
240
+ protected $name = 'Memory Limit';
241
 
242
  /**
243
  * @return string
256
  /**
257
  * @var string
258
  */
259
+ protected $name = 'Backup Path';
260
 
261
  /**
262
  * @return string
275
  /**
276
  * @var string
277
  */
278
+ protected $name = 'Backup Path Permissions';
279
 
280
  /**
281
  * @return string
294
  /**
295
  * @var string
296
  */
297
+ protected $name = 'WP_CONTENT_DIR';
298
 
299
  /**
300
  * @return string
313
  /**
314
  * @var string
315
  */
316
+ protected $name = 'WP_CONTENT_DIR Permissions';
317
 
318
  /**
319
  * @return string
332
  /**
333
  * @var string
334
  */
335
+ protected $name = 'ABSPATH';
336
 
337
  /**
338
  * @return string
351
  /**
352
  * @var string
353
  */
354
+ protected $name = 'Site Root Path';
355
 
356
  /**
357
  * @return string
370
  /**
371
  * @var string
372
  */
373
+ protected $name = 'Calculated size of site';
374
 
375
  /**
376
  * @return array
404
  /**
405
  * @var string
406
  */
407
+ protected $name = 'WP Cron Test Failed';
408
 
409
  /**
410
+ * @return boolean
411
  */
412
  public static function test() {
413
  return (bool) get_option( 'hmbkp_wp_cron_test_failed' );
423
  /**
424
  * @var string
425
  */
426
+ protected $name = 'Interface';
427
 
428
  /**
429
  * @return string
442
  /**
443
  * @var string
444
  */
445
+ protected $name = 'Server';
446
 
447
  /**
448
  * @return bool
467
  /**
468
  * @var string
469
  */
470
+ protected $name = 'OS';
471
 
472
  /**
473
  * @return string
486
  /**
487
  * @var string
488
  */
489
+ protected $name = 'Disabled Functions';
490
 
491
  /**
492
  * @return string
505
  /**
506
  * @var string
507
  */
508
+ protected $name = 'open_basedir';
509
 
510
  /**
511
  * @return string
526
  /**
527
  * @var string
528
  */
529
+ protected $name = 'HMBKP_PATH';
530
 
531
  /**
532
  * @return string
545
  /**
546
  * @var string
547
  */
548
+ protected $name = 'HMBKP_ROOT';
549
 
550
  /**
551
  * @return string
564
  /**
565
  * @var string
566
  */
567
+ protected $name = 'HMBKP_MYSQLDUMP_PATH';
568
 
569
  /**
570
  * @return string
583
  /**
584
  * @var string
585
  */
586
+ protected $name = 'HMBKP_ZIP_PATH';
587
 
588
  /**
589
  * @return string
602
  /**
603
  * @var string
604
  */
605
+ protected $name = 'HMBKP_CAPABILITY';
606
 
607
  /**
608
  * @return string
621
  /**
622
  * @var string
623
  */
624
+ protected $name = 'HMBKP_EMAIL';
625
 
626
  /**
627
  * @return string
640
  /**
641
  * @var string
642
  */
643
+ protected $name = 'HMBKP_ATTACHMENT_MAX_FILESIZE';
644
 
645
  /**
646
  * @return string
659
  /**
660
  * @var string
661
  */
662
+ protected $name = 'HMBKP_EXCLUDE';
663
 
664
  /**
665
  * @return string
672
 
673
  class Requirement_Active_Plugins extends Requirement {
674
 
675
+ protected $name = 'Active Plugins';
676
 
677
+ /**
678
+ * Output the list of active plugins.
679
+ *
680
+ * @return array The array of active plugins.
681
+ */
682
  public static function test() {
683
  return get_option( 'active_plugins' );
684
  }
687
 
688
  class Requirement_Home_Url extends Requirement {
689
 
690
+ protected $name = 'Home URL';
691
 
692
+ /**
693
+ * @return string
694
+ */
695
  public static function test() {
696
  return home_url();
697
  }
700
 
701
  class Requirement_Site_Url extends Requirement {
702
 
703
+ protected $name = 'Site URL';
704
 
705
+ /**
706
+ * @return string
707
+ */
708
  public static function test() {
709
  return site_url();
710
  }
712
  Requirements::register( 'HM\BackUpWordPress\Requirement_Site_Url', 'Site' );
713
 
714
  class Requirement_Plugin_Version extends Requirement {
715
+ protected $name = 'Plugin Version';
716
 
717
+ /**
718
+ * @return string
719
+ */
720
  public static function test() {
721
  return Plugin::PLUGIN_VERSION;
722
  }
725
 
726
  class Requirement_Max_Exec extends Requirement {
727
 
728
+ protected $name = 'Max execution time';
729
 
730
+ /**
731
+ * @return string
732
+ */
733
  public static function test() {
734
  return @ini_get( 'max_execution_time' );
735
  }
738
 
739
  class Requirement_PDO extends Requirement {
740
 
741
+ protected $name = 'PDO';
742
 
743
+ /**
744
+ * @return string|false
745
+ */
746
  public static function test() {
747
 
748
  if ( class_exists( 'PDO' ) && \PDO::getAvailableDrivers() ) {
764
  /**
765
  * @var string
766
  */
767
+ protected $name = 'proc_open';
768
 
769
  /**
770
  * @return bool
classes/class-requirements.php CHANGED
@@ -20,10 +20,10 @@ class Requirements {
20
  /**
21
  * Get the array of registered requirements
22
  *
23
- * @param bool $group
24
  * @return array
25
  */
26
- public static function get_requirements( $group = false ) {
27
 
28
  $requirements = $group ? self::$requirements[ $group ] : self::$requirements;
29
 
@@ -36,7 +36,7 @@ class Requirements {
36
  /**
37
  * Get the requirement groups
38
  *
39
- * @return array
40
  */
41
  public static function get_requirement_groups() {
42
  return array_keys( self::$requirements );
@@ -47,7 +47,6 @@ class Requirements {
47
  *
48
  * @param $class
49
  * @param string $group
50
- * @return WP_Error
51
  */
52
  public static function register( $class, $group = 'misc' ) {
53
  self::$requirements[ $group ][] = $class;
@@ -56,15 +55,11 @@ class Requirements {
56
  /**
57
  * Instantiate the individual requirement classes
58
  *
59
- * @access private
60
  * @param string $class
61
  * @return array An array of instantiated classes
62
  */
63
  private static function instantiate( $class ) {
64
-
65
  $$class = new $class;
66
-
67
  return $$class;
68
-
69
  }
70
  }
20
  /**
21
  * Get the array of registered requirements
22
  *
23
+ * @param string $group
24
  * @return array
25
  */
26
+ public static function get_requirements( $group = '' ) {
27
 
28
  $requirements = $group ? self::$requirements[ $group ] : self::$requirements;
29
 
36
  /**
37
  * Get the requirement groups
38
  *
39
+ * @return string[]
40
  */
41
  public static function get_requirement_groups() {
42
  return array_keys( self::$requirements );
47
  *
48
  * @param $class
49
  * @param string $group
 
50
  */
51
  public static function register( $class, $group = 'misc' ) {
52
  self::$requirements[ $group ][] = $class;
55
  /**
56
  * Instantiate the individual requirement classes
57
  *
 
58
  * @param string $class
59
  * @return array An array of instantiated classes
60
  */
61
  private static function instantiate( $class ) {
 
62
  $$class = new $class;
 
63
  return $$class;
 
64
  }
65
  }
classes/class-site-size.php CHANGED
@@ -163,32 +163,38 @@ class Site_Size {
163
  }
164
 
165
  /**
166
- * Get the total filesize for a given file or directory
167
  *
168
- * If $file is a file then just return the result of `filesize()`.
169
- * If $file is a directory then recursively calculate the size.
 
170
  *
171
- * @param \SplFileInfo $file The file or directory you want to know the size of
172
  *
173
- * @return int The total filesize of the file or directory
 
174
  */
175
  public function filesize( \SplFileInfo $file ) {
176
 
177
- // Skip missing or unreadable files
178
  if ( ! file_exists( $file->getPathname() ) || ! $file->getRealpath() || ! $file->isReadable() ) {
179
  return 0;
180
  }
181
 
182
- // If it's a file then just pass back the filesize
183
  if ( $file->isFile() ) {
184
- return $file->getSize();
 
 
 
 
 
185
  }
186
 
187
- // If it's a directory then pull it from the cached filesize array
188
  if ( $file->isDir() ) {
189
  return $this->directory_filesize( $file );
190
  }
191
-
192
  }
193
 
194
  public function directory_filesize( \SplFileInfo $file ) {
@@ -197,18 +203,19 @@ class Site_Size {
197
  if ( $file->getRealPath() === PATH::get_root() && $this->excludes ) {
198
 
199
  $directory_sizes = get_transient( 'hmbkp_root_size' );
 
200
  if ( $directory_sizes ) {
201
- return $directory_sizes;
202
  }
203
  }
204
 
205
- // If we haven't calculated the site size yet then kick it off in a thread
206
  $directory_sizes = $this->get_cached_filesizes();
207
 
208
  if ( ! is_array( $directory_sizes ) ) {
209
  $this->rebuild_directory_filesizes();
210
 
211
- // Intentionally return null so the caller can tell that the size is being calculated
212
  return null;
213
  }
214
 
@@ -219,7 +226,9 @@ class Site_Size {
219
  $directory_sizes = array_flip( preg_grep( '(' . wp_normalize_path( $file->getRealPath() ) . ')', array_flip( $directory_sizes ) ) );
220
 
221
  if ( $this->excludes ) {
 
222
  $excludes = implode( '|', $this->excludes->get_excludes_for_regex() );
 
223
  if ( $excludes ) {
224
  // Use PREG_GREP_INVERT to remove any filepaths which match an exclude rule
225
  $directory_sizes = array_flip( preg_grep( '(' . $excludes . ')', array_flip( $directory_sizes ), PREG_GREP_INVERT ) );
@@ -234,7 +243,7 @@ class Site_Size {
234
  }
235
 
236
  // Directory size is now just a sum of all files across all sub directories.
237
- return $directory_sizes;
238
 
239
  }
240
 
163
  }
164
 
165
  /**
166
+ * Get the total filesize for a given file or directory. Aware of exclusions.
167
  *
168
+ * If $file is a file then return the result of `filesize()` or 0 if it's excluded.
169
+ * If $file is a directory then recursively calculate the size without
170
+ * the size of excluded files/directories.
171
  *
172
+ * @param \SplFileInfo $file The file or directory you want to know the size of.
173
  *
174
+ * @return int The total filesize of the file or directory without
175
+ * the size of excluded files/directories.
176
  */
177
  public function filesize( \SplFileInfo $file ) {
178
 
179
+ // Skip missing or unreadable files.
180
  if ( ! file_exists( $file->getPathname() ) || ! $file->getRealpath() || ! $file->isReadable() ) {
181
  return 0;
182
  }
183
 
184
+ // If it's a file then return its filesize or 0 if it's excluded.
185
  if ( $file->isFile() ) {
186
+
187
+ if ( $this->excludes && $this->excludes->is_file_excluded( $file ) ) {
188
+ return 0;
189
+ } else {
190
+ return $file->getSize();
191
+ }
192
  }
193
 
194
+ // If it's a directory then pull it from the cached filesize array.
195
  if ( $file->isDir() ) {
196
  return $this->directory_filesize( $file );
197
  }
 
198
  }
199
 
200
  public function directory_filesize( \SplFileInfo $file ) {
203
  if ( $file->getRealPath() === PATH::get_root() && $this->excludes ) {
204
 
205
  $directory_sizes = get_transient( 'hmbkp_root_size' );
206
+
207
  if ( $directory_sizes ) {
208
+ return (int) $directory_sizes;
209
  }
210
  }
211
 
212
+ // If we haven't calculated the site size yet then kick it off in a thread.
213
  $directory_sizes = $this->get_cached_filesizes();
214
 
215
  if ( ! is_array( $directory_sizes ) ) {
216
  $this->rebuild_directory_filesizes();
217
 
218
+ // Intentionally return null so the caller can tell that the size is being calculated.
219
  return null;
220
  }
221
 
226
  $directory_sizes = array_flip( preg_grep( '(' . wp_normalize_path( $file->getRealPath() ) . ')', array_flip( $directory_sizes ) ) );
227
 
228
  if ( $this->excludes ) {
229
+
230
  $excludes = implode( '|', $this->excludes->get_excludes_for_regex() );
231
+
232
  if ( $excludes ) {
233
  // Use PREG_GREP_INVERT to remove any filepaths which match an exclude rule
234
  $directory_sizes = array_flip( preg_grep( '(' . $excludes . ')', array_flip( $directory_sizes ), PREG_GREP_INVERT ) );
243
  }
244
 
245
  // Directory size is now just a sum of all files across all sub directories.
246
+ return (int) $directory_sizes;
247
 
248
  }
249
 
composer.lock CHANGED
@@ -9,16 +9,16 @@
9
  "packages": [
10
  {
11
  "name": "ifsnop/mysqldump-php",
12
- "version": "v2.1",
13
  "source": {
14
  "type": "git",
15
  "url": "https://github.com/ifsnop/mysqldump-php.git",
16
- "reference": "701024dd160f15796bed8130c3bdeb26c634785a"
17
  },
18
  "dist": {
19
  "type": "zip",
20
- "url": "https://api.github.com/repos/ifsnop/mysqldump-php/zipball/701024dd160f15796bed8130c3bdeb26c634785a",
21
- "reference": "701024dd160f15796bed8130c3bdeb26c634785a",
22
  "shasum": ""
23
  },
24
  "require": {
@@ -57,20 +57,20 @@
57
  "pdo",
58
  "sqlite"
59
  ],
60
- "time": "2015-10-19 15:58:11"
61
  },
62
  {
63
  "name": "symfony/finder",
64
- "version": "v2.8.9",
65
  "source": {
66
  "type": "git",
67
  "url": "https://github.com/symfony/finder.git",
68
- "reference": "60804d88691e4a73bbbb3035eb1d9f075c5c2c10"
69
  },
70
  "dist": {
71
  "type": "zip",
72
- "url": "https://api.github.com/repos/symfony/finder/zipball/60804d88691e4a73bbbb3035eb1d9f075c5c2c10",
73
- "reference": "60804d88691e4a73bbbb3035eb1d9f075c5c2c10",
74
  "shasum": ""
75
  },
76
  "require": {
@@ -106,20 +106,20 @@
106
  ],
107
  "description": "Symfony Finder Component",
108
  "homepage": "https://symfony.com",
109
- "time": "2016-07-26 08:02:44"
110
  },
111
  {
112
  "name": "symfony/process",
113
- "version": "v2.8.9",
114
  "source": {
115
  "type": "git",
116
  "url": "https://github.com/symfony/process.git",
117
- "reference": "d20332e43e8774ff8870b394f3dd6020cc7f8e0c"
118
  },
119
  "dist": {
120
  "type": "zip",
121
- "url": "https://api.github.com/repos/symfony/process/zipball/d20332e43e8774ff8870b394f3dd6020cc7f8e0c",
122
- "reference": "d20332e43e8774ff8870b394f3dd6020cc7f8e0c",
123
  "shasum": ""
124
  },
125
  "require": {
@@ -155,7 +155,7 @@
155
  ],
156
  "description": "Symfony Process Component",
157
  "homepage": "https://symfony.com",
158
- "time": "2016-07-28 11:13:19"
159
  }
160
  ],
161
  "packages-dev": [],
9
  "packages": [
10
  {
11
  "name": "ifsnop/mysqldump-php",
12
+ "version": "v2.2",
13
  "source": {
14
  "type": "git",
15
  "url": "https://github.com/ifsnop/mysqldump-php.git",
16
+ "reference": "6c1b84c5b05d862d15ba9ddf92c7d99a3d81e439"
17
  },
18
  "dist": {
19
  "type": "zip",
20
+ "url": "https://api.github.com/repos/ifsnop/mysqldump-php/zipball/6c1b84c5b05d862d15ba9ddf92c7d99a3d81e439",
21
+ "reference": "6c1b84c5b05d862d15ba9ddf92c7d99a3d81e439",
22
  "shasum": ""
23
  },
24
  "require": {
57
  "pdo",
58
  "sqlite"
59
  ],
60
+ "time": "2016-09-07 06:56:07"
61
  },
62
  {
63
  "name": "symfony/finder",
64
+ "version": "v2.8.14",
65
  "source": {
66
  "type": "git",
67
  "url": "https://github.com/symfony/finder.git",
68
+ "reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd"
69
  },
70
  "dist": {
71
  "type": "zip",
72
+ "url": "https://api.github.com/repos/symfony/finder/zipball/0023b024363dfc0cd21262e556f25a291fe8d7fd",
73
+ "reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd",
74
  "shasum": ""
75
  },
76
  "require": {
106
  ],
107
  "description": "Symfony Finder Component",
108
  "homepage": "https://symfony.com",
109
+ "time": "2016-11-03 07:52:58"
110
  },
111
  {
112
  "name": "symfony/process",
113
+ "version": "v2.8.14",
114
  "source": {
115
  "type": "git",
116
  "url": "https://github.com/symfony/process.git",
117
+ "reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f"
118
  },
119
  "dist": {
120
  "type": "zip",
121
+ "url": "https://api.github.com/repos/symfony/process/zipball/024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f",
122
+ "reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f",
123
  "shasum": ""
124
  },
125
  "require": {
155
  ],
156
  "description": "Symfony Process Component",
157
  "homepage": "https://symfony.com",
158
+ "time": "2016-09-29 14:03:54"
159
  }
160
  ],
161
  "packages-dev": [],
functions/core.php CHANGED
@@ -411,10 +411,6 @@ function is_backup_possible() {
411
  return false;
412
  }
413
 
414
- if ( disk_space_low() ) {
415
- return false;
416
- }
417
-
418
  if ( ! Requirement_Mysqldump_Command_Path::test() && ! Requirement_PDO::test() ) {
419
  return false;
420
  }
411
  return false;
412
  }
413
 
 
 
 
 
414
  if ( ! Requirement_Mysqldump_Command_Path::test() && ! Requirement_PDO::test() ) {
415
  return false;
416
  }
functions/interface.php CHANGED
@@ -450,7 +450,7 @@ function disk_space_low( $backup_size = false ) {
450
 
451
  if ( ! $backup_size ) {
452
 
453
- $site_size = new Site_Size();
454
 
455
  if ( ! $site_size->is_site_size_cached() ) {
456
  return false;
450
 
451
  if ( ! $backup_size ) {
452
 
453
+ $site_size = new Site_Size( 'complete', new Excludes() );
454
 
455
  if ( ! $site_size->is_site_size_cached() ) {
456
  return false;
languages/backupwordpress.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL-2+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: BackUpWordPress 3.6.2\n"
6
  "Report-Msgid-Bugs-To: backupwordpress@hmn.md\n"
7
- "POT-Creation-Date: 2016-08-02 13:42:15+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -17,68 +17,68 @@ msgstr ""
17
  msgid "The schedule ID was not provided. Aborting."
18
  msgstr ""
19
 
20
- #: admin/actions.php:245
21
  msgid "Backup type cannot be empty"
22
  msgstr ""
23
 
24
- #: admin/actions.php:247
25
  msgid "Invalid backup type"
26
  msgstr ""
27
 
28
- #: admin/actions.php:258
29
  msgid "Schedule cannot be empty"
30
  msgstr ""
31
 
32
- #: admin/actions.php:260
33
  msgid "Invalid schedule"
34
  msgstr ""
35
 
36
- #: admin/actions.php:271
37
  msgid "Day of the week must be a valid, lowercase day name"
38
  msgstr ""
39
 
40
- #: admin/actions.php:287
41
  msgid "Day of month must be between 1 and 31"
42
  msgstr ""
43
 
44
- #: admin/actions.php:303
45
  msgid "Hours must be between 0 and 23"
46
  msgstr ""
47
 
48
- #: admin/actions.php:319
49
  msgid "Minutes must be between 0 and 59"
50
  msgstr ""
51
 
52
- #: admin/actions.php:330
53
  msgid "Max backups can't be empty"
54
  msgstr ""
55
 
56
- #: admin/actions.php:332
57
  msgid "Max backups must be a number"
58
  msgstr ""
59
 
60
- #: admin/actions.php:334
61
  msgid "Max backups must be greater than 0"
62
  msgstr ""
63
 
64
- #: admin/actions.php:336
65
  msgid ""
66
  "Storing %s backups would use %s of disk space but your server only has %s "
67
  "free."
68
  msgstr ""
69
 
70
- #: admin/actions.php:638 admin/actions.php:644
71
  msgid "BackUpWordPress has detected a problem."
72
  msgstr ""
73
 
74
- #: admin/actions.php:638
75
  msgid ""
76
  "%1$s is returning a %2$s response which could mean cron jobs aren't getting "
77
  "fired properly. BackUpWordPress relies on wp-cron to run scheduled backups. "
78
  "See the %3$s for more details."
79
  msgstr ""
80
 
81
- #: admin/actions.php:644
82
  msgid ""
83
  "%1$s is returning a %2$s response which could mean cron jobs aren't getting "
84
  "fired properly. BackUpWordPress relies on wp-cron to run scheduled backups, "
@@ -90,7 +90,7 @@ msgstr ""
90
  msgid "Size"
91
  msgstr ""
92
 
93
- #: admin/backups-table.php:15 admin/schedule-form-excludes.php:126
94
  msgid "Type"
95
  msgstr ""
96
 
@@ -112,7 +112,7 @@ msgid ""
112
  "settings. %4$s. Defined %5$s will be highlighted."
113
  msgstr ""
114
 
115
- #: admin/constants.php:9 admin/menu.php:92
116
  msgid "Constants"
117
  msgstr ""
118
 
@@ -199,66 +199,66 @@ msgstr ""
199
  msgid "Yes, I want to enable support"
200
  msgstr ""
201
 
202
- #: admin/extensions.php:11
203
  msgid "&larr; Backups"
204
  msgstr ""
205
 
206
- #: admin/extensions.php:13 admin/menu.php:17
207
  msgid "BackUpWordPress Extensions"
208
  msgstr ""
209
 
210
- #: admin/extensions.php:18
211
  msgid ""
212
- "Extend BackUpWordPress by installing extensions. Extensions allows you to "
213
  "pick and choose the exact features you need whilst also supporting us, the "
214
  "developers, so we can continue working on BackUpWordPress."
215
  msgstr ""
216
 
217
- #: admin/extensions.php:36
218
  msgid "Remote Storage"
219
  msgstr ""
220
 
221
- #: admin/extensions.php:38
222
  msgid ""
223
  "It's important to store your backups somewhere other than on your site. "
224
  "Using the extensions below you can easily push your backups to one or more "
225
  "Cloud providers."
226
  msgstr ""
227
 
228
- #: admin/extensions.php:75
229
- msgid "This extension is already installed"
230
  msgstr ""
231
 
232
- #: admin/extensions.php:75
233
- msgid "Installed"
234
  msgstr ""
235
 
236
- #: admin/extensions.php:79
237
- msgid "Buy Now &dollar;%s"
238
  msgstr ""
239
 
240
- #: admin/extensions.php:87
241
- msgid "More information about %s"
242
  msgstr ""
243
 
244
- #: admin/extensions.php:87
245
- msgid "More Details"
246
  msgstr ""
247
 
248
- #: admin/extensions.php:133
249
- msgid "A newer version (%1$s) is available. <a href=\"%2$s\">Update now!</a>"
250
  msgstr ""
251
 
252
- #: admin/extensions.php:136
253
- msgid "You have the latest version"
254
  msgstr ""
255
 
256
- #: admin/extensions.php:151
257
- msgid "Last Updated:"
258
  msgstr ""
259
 
260
- #: admin/extensions.php:151
261
- msgid "%s ago"
262
  msgstr ""
263
 
264
  #: admin/faq.php:2
@@ -438,7 +438,7 @@ msgstr ""
438
  msgid "Manage Backups | BackUpWordPress"
439
  msgstr ""
440
 
441
- #: admin/menu.php:12 admin/menu.php:14 admin/menu.php:55
442
  msgid "Backups"
443
  msgstr ""
444
 
@@ -450,23 +450,23 @@ msgstr ""
450
  msgid "Extensions"
451
  msgstr ""
452
 
453
- #: admin/menu.php:86
454
  msgid "FAQ"
455
  msgstr ""
456
 
457
- #: admin/menu.php:105
458
  msgid "Server Info"
459
  msgstr ""
460
 
461
- #: admin/menu.php:112
462
  msgid "For more information:"
463
  msgstr ""
464
 
465
- #: admin/menu.php:112
466
  msgid "Support Forums"
467
  msgstr ""
468
 
469
- #: admin/menu.php:112
470
  msgid "Help with translation"
471
  msgstr ""
472
 
@@ -474,11 +474,11 @@ msgstr ""
474
  msgid "Support"
475
  msgstr ""
476
 
477
- #: admin/page.php:20
478
  msgid "Enable Support"
479
  msgstr ""
480
 
481
- #: admin/page.php:29
482
  msgid ""
483
  "If you're finding BackUpWordPress useful, please %1$s rate it on the plugin "
484
  "directory%2$s."
@@ -517,69 +517,70 @@ msgid ""
517
  "backup."
518
  msgstr ""
519
 
520
- #: admin/schedule-form-excludes.php:123
521
  msgid "Name"
522
  msgstr ""
523
 
524
- #: admin/schedule-form-excludes.php:124
525
  msgid "Included Size"
526
  msgstr ""
527
 
528
- #: admin/schedule-form-excludes.php:125
529
  msgid "Permissions"
530
  msgstr ""
531
 
532
- #: admin/schedule-form-excludes.php:127
533
  msgid "Status"
534
  msgstr ""
535
 
536
- #: admin/schedule-form-excludes.php:188 admin/schedule-form-excludes.php:312
537
  #. translators: 1: Excluded size 2: Overall site size
 
538
  msgid "%1$s of %2$s"
539
  msgstr ""
540
 
541
- #: admin/schedule-form-excludes.php:195
542
  msgid "Refresh"
543
  msgstr ""
544
 
545
- #: admin/schedule-form-excludes.php:210 admin/schedule-form-excludes.php:349
546
  msgid "Symlink"
547
  msgstr ""
548
 
549
- #: admin/schedule-form-excludes.php:212 admin/schedule-form-excludes.php:352
550
  msgid "Folder"
551
  msgstr ""
552
 
553
- #: admin/schedule-form-excludes.php:354
554
  msgid "File"
555
  msgstr ""
556
 
557
- #: admin/schedule-form-excludes.php:363
558
  msgid "Unreadable files won't be backed up."
559
  msgstr ""
560
 
561
- #: admin/schedule-form-excludes.php:364
562
  msgid "Unreadable"
563
  msgstr ""
564
 
565
- #: admin/schedule-form-excludes.php:369
566
  msgid "Excluded"
567
  msgstr ""
568
 
569
- #: admin/schedule-form-excludes.php:391
570
  msgid "Exclude &rarr;"
571
  msgstr ""
572
 
573
- #: admin/schedule-form-excludes.php:406
574
  msgid "This folder is empty"
575
  msgstr ""
576
 
577
- #: admin/schedule-form-excludes.php:418 admin/schedule-form.php:204
578
- #: admin/schedule-settings.php:85
579
  msgid "Done"
580
  msgstr ""
581
 
582
- #: admin/schedule-form.php:7 admin/schedule-settings.php:11
583
  msgid "Settings"
584
  msgstr ""
585
 
@@ -712,22 +713,22 @@ msgid "manually"
712
  msgstr ""
713
 
714
  #: admin/schedule-sentence.php:76
715
- msgid "this server"
716
  msgstr ""
717
 
718
- #: admin/schedule-sentence.php:84
719
  msgid "store the most recent backup in %s"
720
  msgstr ""
721
 
722
- #: admin/schedule-sentence.php:90
723
  msgid "don't store any backups in on this server"
724
  msgstr ""
725
 
726
- #: admin/schedule-sentence.php:96
727
  msgid "store the last %1$s backups in %2$s"
728
  msgstr ""
729
 
730
- #: admin/schedule-sentence.php:128
731
  msgid "Send a copy of each backup to %s."
732
  msgstr ""
733
 
@@ -735,23 +736,15 @@ msgstr ""
735
  msgid "Backups will be compressed and should be smaller than this."
736
  msgstr ""
737
 
738
- #: admin/schedule-sentence.php:162
739
- msgid "this shouldn't take long&hellip;"
740
- msgstr ""
741
-
742
- #: admin/schedule-sentence.php:162
743
- msgid "calculating the size of your site&hellip;"
744
- msgstr ""
745
-
746
- #: admin/schedule-settings.php:9
747
  msgid "Run now"
748
  msgstr ""
749
 
750
- #: admin/schedule-settings.php:17
751
  msgid "Excludes"
752
  msgstr ""
753
 
754
- #: admin/schedule-settings.php:30 functions/interface.php:36
755
  msgid "Delete"
756
  msgstr ""
757
 
@@ -812,7 +805,7 @@ msgstr ""
812
  msgid "Send an email notification to %s"
813
  msgstr ""
814
 
815
- #: classes/class-email-service.php:121
816
  msgid "%s isn't a valid email"
817
  msgstr ""
818
 
@@ -866,7 +859,7 @@ msgstr ""
866
  msgid "Unfortunately, the backup file was too large to attach to this email."
867
  msgstr ""
868
 
869
- #: classes/class-path.php:341
870
  msgid "This %s file ensures that other people cannot download your backup files."
871
  msgstr ""
872
 
@@ -1220,7 +1213,12 @@ msgstr ""
1220
  msgid "http://hmn.md/"
1221
  msgstr ""
1222
 
1223
- #: admin/schedule-sentence.php:121
 
 
 
 
 
1224
  msgctxt ""
1225
  "1: Backup Type 2: Total size of backup 3: Schedule 4: Number of backups to "
1226
  "store"
2
  # This file is distributed under the GPL-2+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: BackUpWordPress 3.6.3\n"
6
  "Report-Msgid-Bugs-To: backupwordpress@hmn.md\n"
7
+ "POT-Creation-Date: 2016-11-28 17:11:19+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
17
  msgid "The schedule ID was not provided. Aborting."
18
  msgstr ""
19
 
20
+ #: admin/actions.php:243
21
  msgid "Backup type cannot be empty"
22
  msgstr ""
23
 
24
+ #: admin/actions.php:245
25
  msgid "Invalid backup type"
26
  msgstr ""
27
 
28
+ #: admin/actions.php:256
29
  msgid "Schedule cannot be empty"
30
  msgstr ""
31
 
32
+ #: admin/actions.php:258
33
  msgid "Invalid schedule"
34
  msgstr ""
35
 
36
+ #: admin/actions.php:269
37
  msgid "Day of the week must be a valid, lowercase day name"
38
  msgstr ""
39
 
40
+ #: admin/actions.php:285
41
  msgid "Day of month must be between 1 and 31"
42
  msgstr ""
43
 
44
+ #: admin/actions.php:301
45
  msgid "Hours must be between 0 and 23"
46
  msgstr ""
47
 
48
+ #: admin/actions.php:317
49
  msgid "Minutes must be between 0 and 59"
50
  msgstr ""
51
 
52
+ #: admin/actions.php:328
53
  msgid "Max backups can't be empty"
54
  msgstr ""
55
 
56
+ #: admin/actions.php:330
57
  msgid "Max backups must be a number"
58
  msgstr ""
59
 
60
+ #: admin/actions.php:332
61
  msgid "Max backups must be greater than 0"
62
  msgstr ""
63
 
64
+ #: admin/actions.php:334
65
  msgid ""
66
  "Storing %s backups would use %s of disk space but your server only has %s "
67
  "free."
68
  msgstr ""
69
 
70
+ #: admin/actions.php:636 admin/actions.php:642
71
  msgid "BackUpWordPress has detected a problem."
72
  msgstr ""
73
 
74
+ #: admin/actions.php:636
75
  msgid ""
76
  "%1$s is returning a %2$s response which could mean cron jobs aren't getting "
77
  "fired properly. BackUpWordPress relies on wp-cron to run scheduled backups. "
78
  "See the %3$s for more details."
79
  msgstr ""
80
 
81
+ #: admin/actions.php:642
82
  msgid ""
83
  "%1$s is returning a %2$s response which could mean cron jobs aren't getting "
84
  "fired properly. BackUpWordPress relies on wp-cron to run scheduled backups, "
90
  msgid "Size"
91
  msgstr ""
92
 
93
+ #: admin/backups-table.php:15 admin/schedule-form-excludes.php:124
94
  msgid "Type"
95
  msgstr ""
96
 
112
  "settings. %4$s. Defined %5$s will be highlighted."
113
  msgstr ""
114
 
115
+ #: admin/constants.php:9 admin/menu.php:114
116
  msgid "Constants"
117
  msgstr ""
118
 
199
  msgid "Yes, I want to enable support"
200
  msgstr ""
201
 
202
+ #: admin/extensions.php:7
203
  msgid "&larr; Backups"
204
  msgstr ""
205
 
206
+ #: admin/extensions.php:8 admin/menu.php:17
207
  msgid "BackUpWordPress Extensions"
208
  msgstr ""
209
 
210
+ #: admin/extensions.php:12
211
  msgid ""
212
+ "Extend BackUpWordPress by installing extensions. Extensions allow you to "
213
  "pick and choose the exact features you need whilst also supporting us, the "
214
  "developers, so we can continue working on BackUpWordPress."
215
  msgstr ""
216
 
217
+ #: admin/extensions.php:41
218
  msgid "Remote Storage"
219
  msgstr ""
220
 
221
+ #: admin/extensions.php:43
222
  msgid ""
223
  "It's important to store your backups somewhere other than on your site. "
224
  "Using the extensions below you can easily push your backups to one or more "
225
  "Cloud providers."
226
  msgstr ""
227
 
228
+ #: admin/extensions.php:104
229
+ msgid "Update %s now"
230
  msgstr ""
231
 
232
+ #: admin/extensions.php:106
233
+ msgid "Update Now"
234
  msgstr ""
235
 
236
+ #: admin/extensions.php:136
237
+ msgid "Activate %s"
238
  msgstr ""
239
 
240
+ #: admin/extensions.php:137
241
+ msgid "Activate"
242
  msgstr ""
243
 
244
+ #: admin/extensions.php:148
245
+ msgid "Install %s now"
246
  msgstr ""
247
 
248
+ #: admin/extensions.php:150
249
+ msgid "Buy Now &#36;%s"
250
  msgstr ""
251
 
252
+ #: admin/extensions.php:162
253
+ msgid "More information about %s"
254
  msgstr ""
255
 
256
+ #: admin/extensions.php:164
257
+ msgid "More Details"
258
  msgstr ""
259
 
260
+ #: admin/extensions.php:187
261
+ msgid "<strong>Last Updated:</strong> %s ago"
262
  msgstr ""
263
 
264
  #: admin/faq.php:2
438
  msgid "Manage Backups | BackUpWordPress"
439
  msgstr ""
440
 
441
+ #: admin/menu.php:12 admin/menu.php:14 admin/menu.php:77
442
  msgid "Backups"
443
  msgstr ""
444
 
450
  msgid "Extensions"
451
  msgstr ""
452
 
453
+ #: admin/menu.php:108
454
  msgid "FAQ"
455
  msgstr ""
456
 
457
+ #: admin/menu.php:127
458
  msgid "Server Info"
459
  msgstr ""
460
 
461
+ #: admin/menu.php:134
462
  msgid "For more information:"
463
  msgstr ""
464
 
465
+ #: admin/menu.php:134
466
  msgid "Support Forums"
467
  msgstr ""
468
 
469
+ #: admin/menu.php:134
470
  msgid "Help with translation"
471
  msgstr ""
472
 
474
  msgid "Support"
475
  msgstr ""
476
 
477
+ #: admin/page.php:22
478
  msgid "Enable Support"
479
  msgstr ""
480
 
481
+ #: admin/page.php:30
482
  msgid ""
483
  "If you're finding BackUpWordPress useful, please %1$s rate it on the plugin "
484
  "directory%2$s."
517
  "backup."
518
  msgstr ""
519
 
520
+ #: admin/schedule-form-excludes.php:121
521
  msgid "Name"
522
  msgstr ""
523
 
524
+ #: admin/schedule-form-excludes.php:122
525
  msgid "Included Size"
526
  msgstr ""
527
 
528
+ #: admin/schedule-form-excludes.php:123
529
  msgid "Permissions"
530
  msgstr ""
531
 
532
+ #: admin/schedule-form-excludes.php:125
533
  msgid "Status"
534
  msgstr ""
535
 
536
+ #: admin/schedule-form-excludes.php:186 admin/schedule-form-excludes.php:316
537
  #. translators: 1: Excluded size 2: Overall site size
538
+ #. translators: 1: Excluded size 2: Overall directory/file size
539
  msgid "%1$s of %2$s"
540
  msgstr ""
541
 
542
+ #: admin/schedule-form-excludes.php:193
543
  msgid "Refresh"
544
  msgstr ""
545
 
546
+ #: admin/schedule-form-excludes.php:208 admin/schedule-form-excludes.php:353
547
  msgid "Symlink"
548
  msgstr ""
549
 
550
+ #: admin/schedule-form-excludes.php:210 admin/schedule-form-excludes.php:356
551
  msgid "Folder"
552
  msgstr ""
553
 
554
+ #: admin/schedule-form-excludes.php:358
555
  msgid "File"
556
  msgstr ""
557
 
558
+ #: admin/schedule-form-excludes.php:367
559
  msgid "Unreadable files won't be backed up."
560
  msgstr ""
561
 
562
+ #: admin/schedule-form-excludes.php:368
563
  msgid "Unreadable"
564
  msgstr ""
565
 
566
+ #: admin/schedule-form-excludes.php:373
567
  msgid "Excluded"
568
  msgstr ""
569
 
570
+ #: admin/schedule-form-excludes.php:395
571
  msgid "Exclude &rarr;"
572
  msgstr ""
573
 
574
+ #: admin/schedule-form-excludes.php:410
575
  msgid "This folder is empty"
576
  msgstr ""
577
 
578
+ #: admin/schedule-form-excludes.php:422 admin/schedule-form.php:204
579
+ #: admin/schedule-settings.php:89
580
  msgid "Done"
581
  msgstr ""
582
 
583
+ #: admin/schedule-form.php:7 admin/schedule-settings.php:15
584
  msgid "Settings"
585
  msgstr ""
586
 
713
  msgstr ""
714
 
715
  #: admin/schedule-sentence.php:76
716
+ msgid "Check the help tab to learn how to change where your backups are stored."
717
  msgstr ""
718
 
719
+ #: admin/schedule-sentence.php:83
720
  msgid "store the most recent backup in %s"
721
  msgstr ""
722
 
723
+ #: admin/schedule-sentence.php:89
724
  msgid "don't store any backups in on this server"
725
  msgstr ""
726
 
727
+ #: admin/schedule-sentence.php:95
728
  msgid "store the last %1$s backups in %2$s"
729
  msgstr ""
730
 
731
+ #: admin/schedule-sentence.php:127
732
  msgid "Send a copy of each backup to %s."
733
  msgstr ""
734
 
736
  msgid "Backups will be compressed and should be smaller than this."
737
  msgstr ""
738
 
739
+ #: admin/schedule-settings.php:11
 
 
 
 
 
 
 
 
740
  msgid "Run now"
741
  msgstr ""
742
 
743
+ #: admin/schedule-settings.php:21
744
  msgid "Excludes"
745
  msgstr ""
746
 
747
+ #: admin/schedule-settings.php:34 functions/interface.php:36
748
  msgid "Delete"
749
  msgstr ""
750
 
805
  msgid "Send an email notification to %s"
806
  msgstr ""
807
 
808
+ #: classes/class-email-service.php:122
809
  msgid "%s isn't a valid email"
810
  msgstr ""
811
 
859
  msgid "Unfortunately, the backup file was too large to attach to this email."
860
  msgstr ""
861
 
862
+ #: classes/class-path.php:338
863
  msgid "This %s file ensures that other people cannot download your backup files."
864
  msgstr ""
865
 
1213
  msgid "http://hmn.md/"
1214
  msgstr ""
1215
 
1216
+ #: admin/extensions.php:117
1217
+ msgctxt "Plugin status"
1218
+ msgid "Active"
1219
+ msgstr ""
1220
+
1221
+ #: admin/schedule-sentence.php:120
1222
  msgctxt ""
1223
  "1: Backup Type 2: Total size of backup 3: Schedule 4: Number of backups to "
1224
  "store"
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === BackUpWordPress ===
2
- Contributors: humanmade, willmot, dashaluna, pauldewouters, joehoyle, mattheu, tcrsavage, cuvelier
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.9
5
- Tested up to: 4.5
6
- Stable tag: 3.6.2
7
 
8
  Simple automated backups of your WordPress-powered website.
9
 
@@ -158,6 +158,16 @@ users should see major improvements to reliability.
158
 
159
  == Changelog ==
160
 
 
 
 
 
 
 
 
 
 
 
161
  ### 3.6.2 / 2016-08-02
162
 
163
  * Improves admin performance.
1
  === BackUpWordPress ===
2
+ Contributors: humanmade, willmot, dashaluna, pauldewouters, joehoyle, mattheu, tcrsavage, cuvelier, katmoody, sambulance
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.9
5
+ Tested up to: 4.7
6
+ Stable tag: 3.6.3
7
 
8
  Simple automated backups of your WordPress-powered website.
9
 
158
 
159
  == Changelog ==
160
 
161
+ ### 3.6.3 / 2016-12-14
162
+
163
+ * Fix issue where low disk space caused the admin interface to be unavailable
164
+ * Fix issue where admin notices were causing databases and error logs to fill up
165
+ * Improves file size calculations
166
+ * Improves remaining disk space calculations
167
+ * Improves file exclusion methods
168
+ * Misc admin interface improvements
169
+ * Misc code quality improvements and bug fixes
170
+
171
  ### 3.6.2 / 2016-08-02
172
 
173
  * Improves admin performance.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitffc53c57bb8d99be0f3745ccee4cdfec::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitad035600fdf4e2767aebf7cd5f7d027e::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -53,8 +53,8 @@ class ClassLoader
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
56
-
57
  private $classMapAuthoritative = false;
 
58
 
59
  public function getPrefixes()
60
  {
@@ -322,20 +322,20 @@ class ClassLoader
322
  if (isset($this->classMap[$class])) {
323
  return $this->classMap[$class];
324
  }
325
- if ($this->classMapAuthoritative) {
326
  return false;
327
  }
328
 
329
  $file = $this->findFileWithExtension($class, '.php');
330
 
331
  // Search for Hack files if we are running on HHVM
332
- if ($file === null && defined('HHVM_VERSION')) {
333
  $file = $this->findFileWithExtension($class, '.hh');
334
  }
335
 
336
- if ($file === null) {
337
  // Remember that this class does not exist.
338
- return $this->classMap[$class] = false;
339
  }
340
 
341
  return $file;
@@ -399,6 +399,8 @@ class ClassLoader
399
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
  return $file;
401
  }
 
 
402
  }
403
  }
404
 
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
 
56
  private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
 
59
  public function getPrefixes()
60
  {
322
  if (isset($this->classMap[$class])) {
323
  return $this->classMap[$class];
324
  }
325
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
326
  return false;
327
  }
328
 
329
  $file = $this->findFileWithExtension($class, '.php');
330
 
331
  // Search for Hack files if we are running on HHVM
332
+ if (false === $file && defined('HHVM_VERSION')) {
333
  $file = $this->findFileWithExtension($class, '.hh');
334
  }
335
 
336
+ if (false === $file) {
337
  // Remember that this class does not exist.
338
+ $this->missingClasses[$class] = true;
339
  }
340
 
341
  return $file;
399
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
  return $file;
401
  }
402
+
403
+ return false;
404
  }
405
  }
406
 
vendor/composer/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
 
2
- Copyright (c) 2015 Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
1
 
2
+ Copyright (c) 2016 Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitffc53c57bb8d99be0f3745ccee4cdfec
6
  {
7
  private static $loader;
8
 
@@ -19,23 +19,30 @@ class ComposerAutoloaderInitffc53c57bb8d99be0f3745ccee4cdfec
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitffc53c57bb8d99be0f3745ccee4cdfec', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitffc53c57bb8d99be0f3745ccee4cdfec', 'loadClassLoader'));
25
-
26
- $map = require __DIR__ . '/autoload_namespaces.php';
27
- foreach ($map as $namespace => $path) {
28
- $loader->set($namespace, $path);
29
- }
30
-
31
- $map = require __DIR__ . '/autoload_psr4.php';
32
- foreach ($map as $namespace => $path) {
33
- $loader->setPsr4($namespace, $path);
34
- }
35
-
36
- $classMap = require __DIR__ . '/autoload_classmap.php';
37
- if ($classMap) {
38
- $loader->addClassMap($classMap);
 
 
 
 
 
 
 
39
  }
40
 
41
  $loader->register(true);
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitad035600fdf4e2767aebf7cd5f7d027e
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitad035600fdf4e2767aebf7cd5f7d027e', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitad035600fdf4e2767aebf7cd5f7d027e', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitad035600fdf4e2767aebf7cd5f7d027e::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
  }
47
 
48
  $loader->register(true);
vendor/composer/installed.json CHANGED
@@ -1,77 +1,23 @@
1
  [
2
- {
3
- "name": "ifsnop/mysqldump-php",
4
- "version": "v2.1",
5
- "version_normalized": "2.1.0.0",
6
- "source": {
7
- "type": "git",
8
- "url": "https://github.com/ifsnop/mysqldump-php.git",
9
- "reference": "701024dd160f15796bed8130c3bdeb26c634785a"
10
- },
11
- "dist": {
12
- "type": "zip",
13
- "url": "https://api.github.com/repos/ifsnop/mysqldump-php/zipball/701024dd160f15796bed8130c3bdeb26c634785a",
14
- "reference": "701024dd160f15796bed8130c3bdeb26c634785a",
15
- "shasum": ""
16
- },
17
- "require": {
18
- "php": ">=5.3.0"
19
- },
20
- "require-dev": {
21
- "phpunit/phpunit": "3.7.*",
22
- "squizlabs/php_codesniffer": "1.*"
23
- },
24
- "time": "2015-10-19 15:58:11",
25
- "type": "library",
26
- "installation-source": "dist",
27
- "autoload": {
28
- "psr-4": {
29
- "Ifsnop\\": "src/Ifsnop/"
30
- }
31
- },
32
- "notification-url": "https://packagist.org/downloads/",
33
- "license": [
34
- "MIT"
35
- ],
36
- "authors": [
37
- {
38
- "name": "Diego Torres",
39
- "homepage": "https://github.com/ifsnop",
40
- "role": "Developer"
41
- }
42
- ],
43
- "description": "This is a php version of linux's mysqldump in terminal \"$ mysqldump -u username -p...\"",
44
- "homepage": "https://github.com/ifsnop/mysqldump-php",
45
- "keywords": [
46
- "backup",
47
- "database",
48
- "dump",
49
- "export",
50
- "mysql",
51
- "mysqldump",
52
- "pdo",
53
- "sqlite"
54
- ]
55
- },
56
  {
57
  "name": "symfony/finder",
58
- "version": "v2.8.9",
59
- "version_normalized": "2.8.9.0",
60
  "source": {
61
  "type": "git",
62
  "url": "https://github.com/symfony/finder.git",
63
- "reference": "60804d88691e4a73bbbb3035eb1d9f075c5c2c10"
64
  },
65
  "dist": {
66
  "type": "zip",
67
- "url": "https://api.github.com/repos/symfony/finder/zipball/60804d88691e4a73bbbb3035eb1d9f075c5c2c10",
68
- "reference": "60804d88691e4a73bbbb3035eb1d9f075c5c2c10",
69
  "shasum": ""
70
  },
71
  "require": {
72
  "php": ">=5.3.9"
73
  },
74
- "time": "2016-07-26 08:02:44",
75
  "type": "library",
76
  "extra": {
77
  "branch-alias": {
@@ -106,23 +52,23 @@
106
  },
107
  {
108
  "name": "symfony/process",
109
- "version": "v2.8.9",
110
- "version_normalized": "2.8.9.0",
111
  "source": {
112
  "type": "git",
113
  "url": "https://github.com/symfony/process.git",
114
- "reference": "d20332e43e8774ff8870b394f3dd6020cc7f8e0c"
115
  },
116
  "dist": {
117
  "type": "zip",
118
- "url": "https://api.github.com/repos/symfony/process/zipball/d20332e43e8774ff8870b394f3dd6020cc7f8e0c",
119
- "reference": "d20332e43e8774ff8870b394f3dd6020cc7f8e0c",
120
  "shasum": ""
121
  },
122
  "require": {
123
  "php": ">=5.3.9"
124
  },
125
- "time": "2016-07-28 11:13:19",
126
  "type": "library",
127
  "extra": {
128
  "branch-alias": {
@@ -154,5 +100,59 @@
154
  ],
155
  "description": "Symfony Process Component",
156
  "homepage": "https://symfony.com"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
  ]
1
  [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  {
3
  "name": "symfony/finder",
4
+ "version": "v2.8.14",
5
+ "version_normalized": "2.8.14.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/symfony/finder.git",
9
+ "reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/symfony/finder/zipball/0023b024363dfc0cd21262e556f25a291fe8d7fd",
14
+ "reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd",
15
  "shasum": ""
16
  },
17
  "require": {
18
  "php": ">=5.3.9"
19
  },
20
+ "time": "2016-11-03 07:52:58",
21
  "type": "library",
22
  "extra": {
23
  "branch-alias": {
52
  },
53
  {
54
  "name": "symfony/process",
55
+ "version": "v2.8.14",
56
+ "version_normalized": "2.8.14.0",
57
  "source": {
58
  "type": "git",
59
  "url": "https://github.com/symfony/process.git",
60
+ "reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f"
61
  },
62
  "dist": {
63
  "type": "zip",
64
+ "url": "https://api.github.com/repos/symfony/process/zipball/024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f",
65
+ "reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f",
66
  "shasum": ""
67
  },
68
  "require": {
69
  "php": ">=5.3.9"
70
  },
71
+ "time": "2016-09-29 14:03:54",
72
  "type": "library",
73
  "extra": {
74
  "branch-alias": {
100
  ],
101
  "description": "Symfony Process Component",
102
  "homepage": "https://symfony.com"
103
+ },
104
+ {
105
+ "name": "ifsnop/mysqldump-php",
106
+ "version": "v2.2",
107
+ "version_normalized": "2.2.0.0",
108
+ "source": {
109
+ "type": "git",
110
+ "url": "https://github.com/ifsnop/mysqldump-php.git",
111
+ "reference": "6c1b84c5b05d862d15ba9ddf92c7d99a3d81e439"
112
+ },
113
+ "dist": {
114
+ "type": "zip",
115
+ "url": "https://api.github.com/repos/ifsnop/mysqldump-php/zipball/6c1b84c5b05d862d15ba9ddf92c7d99a3d81e439",
116
+ "reference": "6c1b84c5b05d862d15ba9ddf92c7d99a3d81e439",
117
+ "shasum": ""
118
+ },
119
+ "require": {
120
+ "php": ">=5.3.0"
121
+ },
122
+ "require-dev": {
123
+ "phpunit/phpunit": "3.7.*",
124
+ "squizlabs/php_codesniffer": "1.*"
125
+ },
126
+ "time": "2016-09-07 06:56:07",
127
+ "type": "library",
128
+ "installation-source": "dist",
129
+ "autoload": {
130
+ "psr-4": {
131
+ "Ifsnop\\": "src/Ifsnop/"
132
+ }
133
+ },
134
+ "notification-url": "https://packagist.org/downloads/",
135
+ "license": [
136
+ "MIT"
137
+ ],
138
+ "authors": [
139
+ {
140
+ "name": "Diego Torres",
141
+ "homepage": "https://github.com/ifsnop",
142
+ "role": "Developer"
143
+ }
144
+ ],
145
+ "description": "This is a php version of linux's mysqldump in terminal \"$ mysqldump -u username -p...\"",
146
+ "homepage": "https://github.com/ifsnop/mysqldump-php",
147
+ "keywords": [
148
+ "backup",
149
+ "database",
150
+ "dump",
151
+ "export",
152
+ "mysql",
153
+ "mysqldump",
154
+ "pdo",
155
+ "sqlite"
156
+ ]
157
  }
158
  ]
vendor/ifsnop/mysqldump-php/src/Ifsnop/Mysqldump/Mysqldump.php CHANGED
@@ -122,6 +122,7 @@ class Mysqldump
122
  'lock-tables' => true,
123
  'add-locks' => true,
124
  'extended-insert' => true,
 
125
  'disable-keys' => true,
126
  'where' => '',
127
  'no-create-info' => false,
@@ -164,10 +165,27 @@ class Mysqldump
164
  throw new Exception("Unexpected value in dumpSettings: (" . implode(",", $diff) . ")");
165
  }
166
 
 
 
 
 
 
 
 
 
167
  // Create a new compressManager to manage compressed output
168
  $this->compressManager = CompressManagerFactory::create($this->dumpSettings['compress']);
169
  }
170
 
 
 
 
 
 
 
 
 
 
171
  /**
172
  * Custom array_replace_recursive to be used if PHP < 5.3
173
  * Replaces elements from passed arrays into the first array recursively
@@ -332,9 +350,10 @@ class Mysqldump
332
  // If there still are some tables/views in include-tables array,
333
  // that means that some tables or views weren't found.
334
  // Give proper error and exit.
 
335
  if (0 < count($this->dumpSettings['include-tables'])) {
336
  $name = implode(",", $this->dumpSettings['include-tables']);
337
- throw new Exception("Table or View (" . $name . ") not found in database");
338
  }
339
 
340
  $this->exportTables();
@@ -360,18 +379,20 @@ class Mysqldump
360
  private function getDumpFileHeader()
361
  {
362
  $header = '';
363
- if (!$this->dumpSettings['skip-comments']) {
364
  // Some info about software, source and time
365
  $header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php" . PHP_EOL .
366
  "--" . PHP_EOL .
367
  "-- Host: {$this->host}\tDatabase: {$this->dbName}" . PHP_EOL .
368
  "-- ------------------------------------------------------" . PHP_EOL;
369
 
370
- if (!empty($this->version)) {
371
  $header .= "-- Server version \t" . $this->version . PHP_EOL;
372
  }
373
 
374
- $header .= "-- Date: " . date('r') . PHP_EOL . PHP_EOL;
 
 
375
  }
376
  return $header;
377
  }
@@ -424,7 +445,7 @@ class Mysqldump
424
  }
425
 
426
  // Listing all views from database
427
- if (empty($this->dumpSettings['include-tables'])) {
428
  // include all views for now, blacklisting happens later
429
  foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->dbName)) as $row) {
430
  array_push($this->views, current($row));
@@ -432,13 +453,13 @@ class Mysqldump
432
  } else {
433
  // include only the tables mentioned in include-tables
434
  foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->dbName)) as $row) {
435
- if (in_array(current($row), $this->dumpSettings['include-tables'], true)) {
436
  array_push($this->views, current($row));
437
  $elem = array_search(
438
  current($row),
439
- $this->dumpSettings['include-tables']
440
  );
441
- unset($this->dumpSettings['include-tables'][$elem]);
442
  }
443
  }
444
  }
@@ -458,6 +479,27 @@ class Mysqldump
458
  }
459
  }
460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  /**
462
  * Exports all the tables selected from database
463
  *
@@ -467,11 +509,11 @@ class Mysqldump
467
  {
468
  // Exporting tables one by one
469
  foreach ($this->tables as $table) {
470
- if (in_array($table, $this->dumpSettings['exclude-tables'], true)) {
471
  continue;
472
  }
473
  $this->getTableStructure($table);
474
- if (false === $this->dumpSettings['no-data']) {
475
  $this->listValues($table);
476
  }
477
  }
@@ -487,14 +529,14 @@ class Mysqldump
487
  if (false === $this->dumpSettings['no-create-info']) {
488
  // Exporting views one by one
489
  foreach ($this->views as $view) {
490
- if (in_array($view, $this->dumpSettings['exclude-tables'], true)) {
491
  continue;
492
  }
493
  $this->tableColumnTypes[$view] = $this->getTableColumnTypes($view);
494
  $this->getViewStructureTable($view);
495
  }
496
  foreach ($this->views as $view) {
497
- if (in_array($view, $this->dumpSettings['exclude-tables'], true)) {
498
  continue;
499
  }
500
  $this->getViewStructureView($view);
@@ -773,9 +815,18 @@ class Mysqldump
773
  foreach ($resultSet as $row) {
774
  $vals = $this->escape($tableName, $row);
775
  if ($onlyOnce || !$this->dumpSettings['extended-insert']) {
776
- $lineSize += $this->compressManager->write(
777
- "INSERT INTO `$tableName` VALUES (" . implode(",", $vals) . ")"
778
- );
 
 
 
 
 
 
 
 
 
779
  $onlyOnce = false;
780
  } else {
781
  $lineSize += $this->compressManager->write(",(" . implode(",", $vals) . ")");
@@ -1335,7 +1386,15 @@ class TypeAdapterMysql extends TypeAdapterFactory
1335
  'longblob',
1336
  'binary',
1337
  'varbinary',
1338
- 'bit'
 
 
 
 
 
 
 
 
1339
  )
1340
  );
1341
 
122
  'lock-tables' => true,
123
  'add-locks' => true,
124
  'extended-insert' => true,
125
+ 'complete-insert' => false,
126
  'disable-keys' => true,
127
  'where' => '',
128
  'no-create-info' => false,
165
  throw new Exception("Unexpected value in dumpSettings: (" . implode(",", $diff) . ")");
166
  }
167
 
168
+ if ( !is_array($this->dumpSettings['include-tables']) ||
169
+ !is_array($this->dumpSettings['exclude-tables']) ) {
170
+ throw new Exception("Include-tables and exclude-tables should be arrays");
171
+ }
172
+
173
+ // Dump the same views as tables, mimic mysqldump behaviour
174
+ $this->dumpSettings['include-views'] = $this->dumpSettings['include-tables'];
175
+
176
  // Create a new compressManager to manage compressed output
177
  $this->compressManager = CompressManagerFactory::create($this->dumpSettings['compress']);
178
  }
179
 
180
+ /**
181
+ * Destructor of Mysqldump. Unsets dbHandlers and database objects.
182
+ *
183
+ */
184
+ public function __destruct()
185
+ {
186
+ $this->dbHandler = null;
187
+ }
188
+
189
  /**
190
  * Custom array_replace_recursive to be used if PHP < 5.3
191
  * Replaces elements from passed arrays into the first array recursively
350
  // If there still are some tables/views in include-tables array,
351
  // that means that some tables or views weren't found.
352
  // Give proper error and exit.
353
+ // This check will be removed once include-tables supports regexps
354
  if (0 < count($this->dumpSettings['include-tables'])) {
355
  $name = implode(",", $this->dumpSettings['include-tables']);
356
+ throw new Exception("Table (" . $name . ") not found in database");
357
  }
358
 
359
  $this->exportTables();
379
  private function getDumpFileHeader()
380
  {
381
  $header = '';
382
+ if ( !$this->dumpSettings['skip-comments'] ) {
383
  // Some info about software, source and time
384
  $header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php" . PHP_EOL .
385
  "--" . PHP_EOL .
386
  "-- Host: {$this->host}\tDatabase: {$this->dbName}" . PHP_EOL .
387
  "-- ------------------------------------------------------" . PHP_EOL;
388
 
389
+ if ( !empty($this->version) ) {
390
  $header .= "-- Server version \t" . $this->version . PHP_EOL;
391
  }
392
 
393
+ if ( !$this->dumpSettings['skip-dump-date'] ) {
394
+ $header .= "-- Date: " . date('r') . PHP_EOL . PHP_EOL;
395
+ }
396
  }
397
  return $header;
398
  }
445
  }
446
 
447
  // Listing all views from database
448
+ if (empty($this->dumpSettings['include-views'])) {
449
  // include all views for now, blacklisting happens later
450
  foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->dbName)) as $row) {
451
  array_push($this->views, current($row));
453
  } else {
454
  // include only the tables mentioned in include-tables
455
  foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->dbName)) as $row) {
456
+ if (in_array(current($row), $this->dumpSettings['include-views'], true)) {
457
  array_push($this->views, current($row));
458
  $elem = array_search(
459
  current($row),
460
+ $this->dumpSettings['include-views']
461
  );
462
+ unset($this->dumpSettings['include-views'][$elem]);
463
  }
464
  }
465
  }
479
  }
480
  }
481
 
482
+ /**
483
+ * Compare if $table name matches with a definition inside $arr
484
+ * @param $table string
485
+ * @param $arr array with strings or patterns
486
+ * @return bool
487
+ */
488
+ private function matches($table, $arr) {
489
+ $match = false;
490
+
491
+ foreach ($arr as $pattern) {
492
+ if ( '/' != $pattern[0] ) {
493
+ continue;
494
+ }
495
+ if ( 1 == preg_match($pattern, $table) ) {
496
+ $match = true;
497
+ }
498
+ }
499
+
500
+ return in_array($table, $arr) || $match;
501
+ }
502
+
503
  /**
504
  * Exports all the tables selected from database
505
  *
509
  {
510
  // Exporting tables one by one
511
  foreach ($this->tables as $table) {
512
+ if ( $this->matches($table, $this->dumpSettings['exclude-tables']) ) {
513
  continue;
514
  }
515
  $this->getTableStructure($table);
516
+ if ( false === $this->dumpSettings['no-data'] ) {
517
  $this->listValues($table);
518
  }
519
  }
529
  if (false === $this->dumpSettings['no-create-info']) {
530
  // Exporting views one by one
531
  foreach ($this->views as $view) {
532
+ if ( $this->matches($view, $this->dumpSettings['exclude-tables']) ) {
533
  continue;
534
  }
535
  $this->tableColumnTypes[$view] = $this->getTableColumnTypes($view);
536
  $this->getViewStructureTable($view);
537
  }
538
  foreach ($this->views as $view) {
539
+ if ( $this->matches($view, $this->dumpSettings['exclude-tables']) ) {
540
  continue;
541
  }
542
  $this->getViewStructureView($view);
815
  foreach ($resultSet as $row) {
816
  $vals = $this->escape($tableName, $row);
817
  if ($onlyOnce || !$this->dumpSettings['extended-insert']) {
818
+
819
+ if ($this->dumpSettings['complete-insert']) {
820
+ $lineSize += $this->compressManager->write(
821
+ "INSERT INTO `$tableName` (`" .
822
+ implode("`, `", array_keys($this->tableColumnTypes[$tableName])) .
823
+ "`) VALUES (" . implode(",", $vals) . ")"
824
+ );
825
+ } else {
826
+ $lineSize += $this->compressManager->write(
827
+ "INSERT INTO `$tableName` VALUES (" . implode(",", $vals) . ")"
828
+ );
829
+ }
830
  $onlyOnce = false;
831
  } else {
832
  $lineSize += $this->compressManager->write(",(" . implode(",", $vals) . ")");
1386
  'longblob',
1387
  'binary',
1388
  'varbinary',
1389
+ 'bit',
1390
+ 'geometry', /* http://bugs.mysql.com/bug.php?id=43544 */
1391
+ 'point',
1392
+ 'linestring',
1393
+ 'polygon',
1394
+ 'multipoint',
1395
+ 'multilinestring',
1396
+ 'multipolygon',
1397
+ 'geometrycollection',
1398
  )
1399
  );
1400
 
vendor/symfony/finder/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- vendor/
2
- composer.lock
3
- phpunit.xml
 
 
 
vendor/symfony/finder/Iterator/DateRangeFilterIterator.php CHANGED
@@ -44,7 +44,7 @@ class DateRangeFilterIterator extends FilterIterator
44
  {
45
  $fileinfo = $this->current();
46
 
47
- if (!file_exists($fileinfo->getRealPath())) {
48
  return false;
49
  }
50
 
44
  {
45
  $fileinfo = $this->current();
46
 
47
+ if (!file_exists($fileinfo->getPathname())) {
48
  return false;
49
  }
50
 
vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php CHANGED
@@ -35,6 +35,7 @@ class ExcludeDirectoryFilterIterator extends FilterIterator implements \Recursiv
35
  $this->isRecursive = $iterator instanceof \RecursiveIterator;
36
  $patterns = array();
37
  foreach ($directories as $directory) {
 
38
  if (!$this->isRecursive || false !== strpos($directory, '/')) {
39
  $patterns[] = preg_quote($directory, '#');
40
  } else {
@@ -51,7 +52,7 @@ class ExcludeDirectoryFilterIterator extends FilterIterator implements \Recursiv
51
  /**
52
  * Filters the iterator values.
53
  *
54
- * @return bool true if the value should be kept, false otherwise
55
  */
56
  public function accept()
57
  {
35
  $this->isRecursive = $iterator instanceof \RecursiveIterator;
36
  $patterns = array();
37
  foreach ($directories as $directory) {
38
+ $directory = rtrim($directory, '/');
39
  if (!$this->isRecursive || false !== strpos($directory, '/')) {
40
  $patterns[] = preg_quote($directory, '#');
41
  } else {
52
  /**
53
  * Filters the iterator values.
54
  *
55
+ * @return bool True if the value should be kept, false otherwise
56
  */
57
  public function accept()
58
  {
vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php CHANGED
@@ -137,6 +137,11 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
137
  return $this->rewindable;
138
  }
139
 
 
 
 
 
 
140
  if (false !== $stream = @opendir($this->getPath())) {
141
  $infos = stream_get_meta_data($stream);
142
  closedir($stream);
137
  return $this->rewindable;
138
  }
139
 
140
+ // workaround for an HHVM bug, should be removed when https://github.com/facebook/hhvm/issues/7281 is fixed
141
+ if ('' === $this->getPath()) {
142
+ return $this->rewindable = false;
143
+ }
144
+
145
  if (false !== $stream = @opendir($this->getPath())) {
146
  $infos = stream_get_meta_data($stream);
147
  closedir($stream);
vendor/symfony/finder/Iterator/SortableIterator.php CHANGED
@@ -41,7 +41,7 @@ class SortableIterator implements \IteratorAggregate
41
 
42
  if (self::SORT_BY_NAME === $sort) {
43
  $this->sort = function ($a, $b) {
44
- return strcmp($a->getRealpath(), $b->getRealpath());
45
  };
46
  } elseif (self::SORT_BY_TYPE === $sort) {
47
  $this->sort = function ($a, $b) {
@@ -51,7 +51,7 @@ class SortableIterator implements \IteratorAggregate
51
  return 1;
52
  }
53
 
54
- return strcmp($a->getRealpath(), $b->getRealpath());
55
  };
56
  } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
57
  $this->sort = function ($a, $b) {
41
 
42
  if (self::SORT_BY_NAME === $sort) {
43
  $this->sort = function ($a, $b) {
44
+ return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
45
  };
46
  } elseif (self::SORT_BY_TYPE === $sort) {
47
  $this->sort = function ($a, $b) {
51
  return 1;
52
  }
53
 
54
+ return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
55
  };
56
  } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
57
  $this->sort = function ($a, $b) {
vendor/symfony/finder/README.md DELETED
@@ -1,14 +0,0 @@
1
- Finder Component
2
- ================
3
-
4
- The Finder component finds files and directories via an intuitive fluent
5
- interface.
6
-
7
- Resources
8
- ---------
9
-
10
- * [Documentation](https://symfony.com/doc/current/components/finder.html)
11
- * [Contributing](https://symfony.com/doc/current/contributing/index.html)
12
- * [Report issues](https://github.com/symfony/symfony/issues) and
13
- [send Pull Requests](https://github.com/symfony/symfony/pulls)
14
- in the [main Symfony repository](https://github.com/symfony/symfony)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/BsdFinderTest.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests;
13
-
14
- use Symfony\Component\Finder\Adapter\BsdFindAdapter;
15
- use Symfony\Component\Finder\Finder;
16
-
17
- /**
18
- * @group legacy
19
- */
20
- class BsdFinderTest extends FinderTest
21
- {
22
- protected function buildFinder()
23
- {
24
- $adapter = new BsdFindAdapter();
25
-
26
- if (!$adapter->isSupported()) {
27
- $this->markTestSkipped(get_class($adapter).' is not supported.');
28
- }
29
-
30
- return Finder::create()
31
- ->removeAdapters()
32
- ->addAdapter($adapter);
33
- }
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Comparator/ComparatorTest.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Comparator;
13
-
14
- use Symfony\Component\Finder\Comparator\Comparator;
15
-
16
- class ComparatorTest extends \PHPUnit_Framework_TestCase
17
- {
18
- public function testGetSetOperator()
19
- {
20
- $comparator = new Comparator();
21
- try {
22
- $comparator->setOperator('foo');
23
- $this->fail('->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
24
- } catch (\Exception $e) {
25
- $this->assertInstanceOf('InvalidArgumentException', $e, '->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
26
- }
27
-
28
- $comparator = new Comparator();
29
- $comparator->setOperator('>');
30
- $this->assertEquals('>', $comparator->getOperator(), '->getOperator() returns the current operator');
31
- }
32
-
33
- public function testGetSetTarget()
34
- {
35
- $comparator = new Comparator();
36
- $comparator->setTarget(8);
37
- $this->assertEquals(8, $comparator->getTarget(), '->getTarget() returns the target');
38
- }
39
-
40
- /**
41
- * @dataProvider getTestData
42
- */
43
- public function testTest($operator, $target, $match, $noMatch)
44
- {
45
- $c = new Comparator();
46
- $c->setOperator($operator);
47
- $c->setTarget($target);
48
-
49
- foreach ($match as $m) {
50
- $this->assertTrue($c->test($m), '->test() tests a string against the expression');
51
- }
52
-
53
- foreach ($noMatch as $m) {
54
- $this->assertFalse($c->test($m), '->test() tests a string against the expression');
55
- }
56
- }
57
-
58
- public function getTestData()
59
- {
60
- return array(
61
- array('<', '1000', array('500', '999'), array('1000', '1500')),
62
- );
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Comparator;
13
-
14
- use Symfony\Component\Finder\Comparator\DateComparator;
15
-
16
- class DateComparatorTest extends \PHPUnit_Framework_TestCase
17
- {
18
- public function testConstructor()
19
- {
20
- try {
21
- new DateComparator('foobar');
22
- $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
23
- } catch (\Exception $e) {
24
- $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
25
- }
26
-
27
- try {
28
- new DateComparator('');
29
- $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
30
- } catch (\Exception $e) {
31
- $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
32
- }
33
- }
34
-
35
- /**
36
- * @dataProvider getTestData
37
- */
38
- public function testTest($test, $match, $noMatch)
39
- {
40
- $c = new DateComparator($test);
41
-
42
- foreach ($match as $m) {
43
- $this->assertTrue($c->test($m), '->test() tests a string against the expression');
44
- }
45
-
46
- foreach ($noMatch as $m) {
47
- $this->assertFalse($c->test($m), '->test() tests a string against the expression');
48
- }
49
- }
50
-
51
- public function getTestData()
52
- {
53
- return array(
54
- array('< 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
55
- array('until 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
56
- array('before 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
57
- array('> 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
58
- array('after 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
59
- array('since 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
60
- array('!= 2005-10-10', array(strtotime('2005-10-11')), array(strtotime('2005-10-10'))),
61
- );
62
- }
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Comparator;
13
-
14
- use Symfony\Component\Finder\Comparator\NumberComparator;
15
-
16
- class NumberComparatorTest extends \PHPUnit_Framework_TestCase
17
- {
18
- /**
19
- * @dataProvider getConstructorTestData
20
- */
21
- public function testConstructor($successes, $failures)
22
- {
23
- foreach ($successes as $s) {
24
- new NumberComparator($s);
25
- }
26
-
27
- foreach ($failures as $f) {
28
- try {
29
- new NumberComparator($f);
30
- $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
31
- } catch (\Exception $e) {
32
- $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
33
- }
34
- }
35
- }
36
-
37
- /**
38
- * @dataProvider getTestData
39
- */
40
- public function testTest($test, $match, $noMatch)
41
- {
42
- $c = new NumberComparator($test);
43
-
44
- foreach ($match as $m) {
45
- $this->assertTrue($c->test($m), '->test() tests a string against the expression');
46
- }
47
-
48
- foreach ($noMatch as $m) {
49
- $this->assertFalse($c->test($m), '->test() tests a string against the expression');
50
- }
51
- }
52
-
53
- public function getTestData()
54
- {
55
- return array(
56
- array('< 1000', array('500', '999'), array('1000', '1500')),
57
-
58
- array('< 1K', array('500', '999'), array('1000', '1500')),
59
- array('<1k', array('500', '999'), array('1000', '1500')),
60
- array(' < 1 K ', array('500', '999'), array('1000', '1500')),
61
- array('<= 1K', array('1000'), array('1001')),
62
- array('> 1K', array('1001'), array('1000')),
63
- array('>= 1K', array('1000'), array('999')),
64
-
65
- array('< 1KI', array('500', '1023'), array('1024', '1500')),
66
- array('<= 1KI', array('1024'), array('1025')),
67
- array('> 1KI', array('1025'), array('1024')),
68
- array('>= 1KI', array('1024'), array('1023')),
69
-
70
- array('1KI', array('1024'), array('1023', '1025')),
71
- array('==1KI', array('1024'), array('1023', '1025')),
72
-
73
- array('==1m', array('1000000'), array('999999', '1000001')),
74
- array('==1mi', array(1024 * 1024), array(1024 * 1024 - 1, 1024 * 1024 + 1)),
75
-
76
- array('==1g', array('1000000000'), array('999999999', '1000000001')),
77
- array('==1gi', array(1024 * 1024 * 1024), array(1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1)),
78
-
79
- array('!= 1000', array('500', '999'), array('1000')),
80
- );
81
- }
82
-
83
- public function getConstructorTestData()
84
- {
85
- return array(
86
- array(
87
- array(
88
- '1', '0',
89
- '3.5', '33.55', '123.456', '123456.78',
90
- '.1', '.123',
91
- '.0', '0.0',
92
- '1.', '0.', '123.',
93
- '==1', '!=1', '<1', '>1', '<=1', '>=1',
94
- '==1k', '==1ki', '==1m', '==1mi', '==1g', '==1gi',
95
- '1k', '1ki', '1m', '1mi', '1g', '1gi',
96
- ),
97
- array(
98
- false, null, '',
99
- ' ', 'foobar',
100
- '=1', '===1',
101
- '0 . 1', '123 .45', '234. 567',
102
- '..', '.0.', '0.1.2',
103
- ),
104
- ),
105
- );
106
- }
107
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Expression/ExpressionTest.php DELETED
@@ -1,71 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Expression;
13
-
14
- use Symfony\Component\Finder\Expression\Expression;
15
-
16
- /**
17
- * @group legacy
18
- */
19
- class ExpressionTest extends \PHPUnit_Framework_TestCase
20
- {
21
- /**
22
- * @dataProvider getTypeGuesserData
23
- */
24
- public function testTypeGuesser($expr, $type)
25
- {
26
- $this->assertEquals($type, Expression::create($expr)->getType());
27
- }
28
-
29
- /**
30
- * @dataProvider getCaseSensitiveData
31
- */
32
- public function testCaseSensitive($expr, $isCaseSensitive)
33
- {
34
- $this->assertEquals($isCaseSensitive, Expression::create($expr)->isCaseSensitive());
35
- }
36
-
37
- /**
38
- * @dataProvider getRegexRenderingData
39
- */
40
- public function testRegexRendering($expr, $body)
41
- {
42
- $this->assertEquals($body, Expression::create($expr)->renderPattern());
43
- }
44
-
45
- public function getTypeGuesserData()
46
- {
47
- return array(
48
- array('{foo}', Expression::TYPE_REGEX),
49
- array('/foo/', Expression::TYPE_REGEX),
50
- array('foo', Expression::TYPE_GLOB),
51
- array('foo*', Expression::TYPE_GLOB),
52
- );
53
- }
54
-
55
- public function getCaseSensitiveData()
56
- {
57
- return array(
58
- array('{foo}m', true),
59
- array('/foo/i', false),
60
- array('foo*', true),
61
- );
62
- }
63
-
64
- public function getRegexRenderingData()
65
- {
66
- return array(
67
- array('{foo}m', 'foo'),
68
- array('/foo/i', 'foo'),
69
- );
70
- }
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Expression/GlobTest.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Expression;
13
-
14
- use Symfony\Component\Finder\Expression\Expression;
15
-
16
- /**
17
- * @group legacy
18
- */
19
- class GlobTest extends \PHPUnit_Framework_TestCase
20
- {
21
- /**
22
- * @dataProvider getToRegexData
23
- */
24
- public function testGlobToRegex($glob, $match, $noMatch)
25
- {
26
- foreach ($match as $m) {
27
- $this->assertRegExp(Expression::create($glob)->getRegex()->render(), $m, '::toRegex() converts a glob to a regexp');
28
- }
29
-
30
- foreach ($noMatch as $m) {
31
- $this->assertNotRegExp(Expression::create($glob)->getRegex()->render(), $m, '::toRegex() converts a glob to a regexp');
32
- }
33
- }
34
-
35
- public function getToRegexData()
36
- {
37
- return array(
38
- array('', array(''), array('f', '/')),
39
- array('*', array('foo'), array('foo/', '/foo')),
40
- array('foo.*', array('foo.php', 'foo.a', 'foo.'), array('fooo.php', 'foo.php/foo')),
41
- array('fo?', array('foo', 'fot'), array('fooo', 'ffoo', 'fo/')),
42
- array('fo{o,t}', array('foo', 'fot'), array('fob', 'fo/')),
43
- array('foo(bar|foo)', array('foo(bar|foo)'), array('foobar', 'foofoo')),
44
- array('foo,bar', array('foo,bar'), array('foo', 'bar')),
45
- array('fo{o,\\,}', array('foo', 'fo,'), array()),
46
- array('fo{o,\\\\}', array('foo', 'fo\\'), array()),
47
- array('/foo', array('/foo'), array('foo')),
48
- );
49
- }
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Expression/RegexTest.php DELETED
@@ -1,146 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Expression;
13
-
14
- use Symfony\Component\Finder\Expression\Expression;
15
-
16
- /**
17
- * @group legacy
18
- */
19
- class RegexTest extends \PHPUnit_Framework_TestCase
20
- {
21
- /**
22
- * @dataProvider getHasFlagsData
23
- */
24
- public function testHasFlags($regex, $start, $end)
25
- {
26
- $expr = new Expression($regex);
27
-
28
- $this->assertEquals($start, $expr->getRegex()->hasStartFlag());
29
- $this->assertEquals($end, $expr->getRegex()->hasEndFlag());
30
- }
31
-
32
- /**
33
- * @dataProvider getHasJokersData
34
- */
35
- public function testHasJokers($regex, $start, $end)
36
- {
37
- $expr = new Expression($regex);
38
-
39
- $this->assertEquals($start, $expr->getRegex()->hasStartJoker());
40
- $this->assertEquals($end, $expr->getRegex()->hasEndJoker());
41
- }
42
-
43
- /**
44
- * @dataProvider getSetFlagsData
45
- */
46
- public function testSetFlags($regex, $start, $end, $expected)
47
- {
48
- $expr = new Expression($regex);
49
- $expr->getRegex()->setStartFlag($start)->setEndFlag($end);
50
-
51
- $this->assertEquals($expected, $expr->render());
52
- }
53
-
54
- /**
55
- * @dataProvider getSetJokersData
56
- */
57
- public function testSetJokers($regex, $start, $end, $expected)
58
- {
59
- $expr = new Expression($regex);
60
- $expr->getRegex()->setStartJoker($start)->setEndJoker($end);
61
-
62
- $this->assertEquals($expected, $expr->render());
63
- }
64
-
65
- public function testOptions()
66
- {
67
- $expr = new Expression('~abc~is');
68
- $expr->getRegex()->removeOption('i')->addOption('m');
69
-
70
- $this->assertEquals('~abc~sm', $expr->render());
71
- }
72
-
73
- public function testMixFlagsAndJokers()
74
- {
75
- $expr = new Expression('~^.*abc.*$~is');
76
-
77
- $expr->getRegex()->setStartFlag(false)->setEndFlag(false)->setStartJoker(false)->setEndJoker(false);
78
- $this->assertEquals('~abc~is', $expr->render());
79
-
80
- $expr->getRegex()->setStartFlag(true)->setEndFlag(true)->setStartJoker(true)->setEndJoker(true);
81
- $this->assertEquals('~^.*abc.*$~is', $expr->render());
82
- }
83
-
84
- /**
85
- * @dataProvider getReplaceJokersTestData
86
- */
87
- public function testReplaceJokers($regex, $expected)
88
- {
89
- $expr = new Expression($regex);
90
- $expr = $expr->getRegex()->replaceJokers('@');
91
-
92
- $this->assertEquals($expected, $expr->renderPattern());
93
- }
94
-
95
- public function getHasFlagsData()
96
- {
97
- return array(
98
- array('~^abc~', true, false),
99
- array('~abc$~', false, true),
100
- array('~abc~', false, false),
101
- array('~^abc$~', true, true),
102
- array('~^abc\\$~', true, false),
103
- );
104
- }
105
-
106
- public function getHasJokersData()
107
- {
108
- return array(
109
- array('~.*abc~', true, false),
110
- array('~abc.*~', false, true),
111
- array('~abc~', false, false),
112
- array('~.*abc.*~', true, true),
113
- array('~.*abc\\.*~', true, false),
114
- );
115
- }
116
-
117
- public function getSetFlagsData()
118
- {
119
- return array(
120
- array('~abc~', true, false, '~^abc~'),
121
- array('~abc~', false, true, '~abc$~'),
122
- array('~abc~', false, false, '~abc~'),
123
- array('~abc~', true, true, '~^abc$~'),
124
- );
125
- }
126
-
127
- public function getSetJokersData()
128
- {
129
- return array(
130
- array('~abc~', true, false, '~.*abc~'),
131
- array('~abc~', false, true, '~abc.*~'),
132
- array('~abc~', false, false, '~abc~'),
133
- array('~abc~', true, true, '~.*abc.*~'),
134
- );
135
- }
136
-
137
- public function getReplaceJokersTestData()
138
- {
139
- return array(
140
- array('~.abc~', '@abc'),
141
- array('~\\.abc~', '\\.abc'),
142
- array('~\\\\.abc~', '\\\\@abc'),
143
- array('~\\\\\\.abc~', '\\\\\\.abc'),
144
- );
145
- }
146
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/FakeAdapter/DummyAdapter.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\FakeAdapter;
13
-
14
- use Symfony\Component\Finder\Adapter\AbstractAdapter;
15
-
16
- /**
17
- * @author Jean-François Simon <contact@jfsimon.fr>
18
- */
19
- class DummyAdapter extends AbstractAdapter
20
- {
21
- /**
22
- * @var \Iterator
23
- */
24
- private $iterator;
25
-
26
- /**
27
- * @param \Iterator $iterator
28
- */
29
- public function __construct(\Iterator $iterator)
30
- {
31
- $this->iterator = $iterator;
32
- }
33
-
34
- /**
35
- * {@inheritdoc}
36
- */
37
- public function searchInDirectory($dir)
38
- {
39
- return $this->iterator;
40
- }
41
-
42
- /**
43
- * {@inheritdoc}
44
- */
45
- public function getName()
46
- {
47
- return 'yes';
48
- }
49
-
50
- /**
51
- * {@inheritdoc}
52
- */
53
- protected function canBeUsed()
54
- {
55
- return true;
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/FakeAdapter/FailingAdapter.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\FakeAdapter;
13
-
14
- use Symfony\Component\Finder\Adapter\AbstractAdapter;
15
- use Symfony\Component\Finder\Exception\AdapterFailureException;
16
-
17
- /**
18
- * @author Jean-François Simon <contact@jfsimon.fr>
19
- */
20
- class FailingAdapter extends AbstractAdapter
21
- {
22
- /**
23
- * {@inheritdoc}
24
- */
25
- public function searchInDirectory($dir)
26
- {
27
- throw new AdapterFailureException($this);
28
- }
29
-
30
- /**
31
- * {@inheritdoc}
32
- */
33
- public function getName()
34
- {
35
- return 'failing';
36
- }
37
-
38
- /**
39
- * {@inheritdoc}
40
- */
41
- protected function canBeUsed()
42
- {
43
- return true;
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/FakeAdapter/NamedAdapter.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\FakeAdapter;
13
-
14
- use Symfony\Component\Finder\Adapter\AbstractAdapter;
15
-
16
- /**
17
- * @author Jean-François Simon <contact@jfsimon.fr>
18
- */
19
- class NamedAdapter extends AbstractAdapter
20
- {
21
- /**
22
- * @var string
23
- */
24
- private $name;
25
-
26
- /**
27
- * @param string $name
28
- */
29
- public function __construct($name)
30
- {
31
- $this->name = $name;
32
- }
33
-
34
- /**
35
- * {@inheritdoc}
36
- */
37
- public function searchInDirectory($dir)
38
- {
39
- return new \ArrayIterator(array());
40
- }
41
-
42
- /**
43
- * {@inheritdoc}
44
- */
45
- public function getName()
46
- {
47
- return $this->name;
48
- }
49
-
50
- /**
51
- * {@inheritdoc}
52
- */
53
- protected function canBeUsed()
54
- {
55
- return true;
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/FakeAdapter/UnsupportedAdapter.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\FakeAdapter;
13
-
14
- use Symfony\Component\Finder\Adapter\AbstractAdapter;
15
-
16
- /**
17
- * @author Jean-François Simon <contact@jfsimon.fr>
18
- */
19
- class UnsupportedAdapter extends AbstractAdapter
20
- {
21
- /**
22
- * {@inheritdoc}
23
- */
24
- public function searchInDirectory($dir)
25
- {
26
- return new \ArrayIterator(array());
27
- }
28
-
29
- /**
30
- * {@inheritdoc}
31
- */
32
- public function getName()
33
- {
34
- return 'unsupported';
35
- }
36
-
37
- /**
38
- * {@inheritdoc}
39
- */
40
- protected function canBeUsed()
41
- {
42
- return false;
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/FinderTest.php DELETED
@@ -1,745 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests;
13
-
14
- use Symfony\Component\Finder\Adapter\AdapterInterface;
15
- use Symfony\Component\Finder\Adapter\GnuFindAdapter;
16
- use Symfony\Component\Finder\Adapter\PhpAdapter;
17
- use Symfony\Component\Finder\Finder;
18
-
19
- class FinderTest extends Iterator\RealIteratorTestCase
20
- {
21
- public function testCreate()
22
- {
23
- $this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create());
24
- }
25
-
26
- public function testDirectories()
27
- {
28
- $finder = $this->buildFinder();
29
- $this->assertSame($finder, $finder->directories());
30
- $this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator());
31
-
32
- $finder = $this->buildFinder();
33
- $finder->directories();
34
- $finder->files();
35
- $finder->directories();
36
- $this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator());
37
- }
38
-
39
- public function testFiles()
40
- {
41
- $finder = $this->buildFinder();
42
- $this->assertSame($finder, $finder->files());
43
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
44
-
45
- $finder = $this->buildFinder();
46
- $finder->files();
47
- $finder->directories();
48
- $finder->files();
49
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
50
- }
51
-
52
- public function testDepth()
53
- {
54
- $finder = $this->buildFinder();
55
- $this->assertSame($finder, $finder->depth('< 1'));
56
- $this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
57
-
58
- $finder = $this->buildFinder();
59
- $this->assertSame($finder, $finder->depth('<= 0'));
60
- $this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
61
-
62
- $finder = $this->buildFinder();
63
- $this->assertSame($finder, $finder->depth('>= 1'));
64
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp')), $finder->in(self::$tmpDir)->getIterator());
65
-
66
- $finder = $this->buildFinder();
67
- $finder->depth('< 1')->depth('>= 1');
68
- $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
69
- }
70
-
71
- public function testName()
72
- {
73
- $finder = $this->buildFinder();
74
- $this->assertSame($finder, $finder->name('*.php'));
75
- $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
76
-
77
- $finder = $this->buildFinder();
78
- $finder->name('test.ph*');
79
- $finder->name('test.py');
80
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
81
-
82
- $finder = $this->buildFinder();
83
- $finder->name('~^test~i');
84
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
85
-
86
- $finder = $this->buildFinder();
87
- $finder->name('~\\.php$~i');
88
- $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
89
-
90
- $finder = $this->buildFinder();
91
- $finder->name('test.p{hp,y}');
92
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
93
- }
94
-
95
- public function testNotName()
96
- {
97
- $finder = $this->buildFinder();
98
- $this->assertSame($finder, $finder->notName('*.php'));
99
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
100
-
101
- $finder = $this->buildFinder();
102
- $finder->notName('*.php');
103
- $finder->notName('*.py');
104
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
105
-
106
- $finder = $this->buildFinder();
107
- $finder->name('test.ph*');
108
- $finder->name('test.py');
109
- $finder->notName('*.php');
110
- $finder->notName('*.py');
111
- $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
112
-
113
- $finder = $this->buildFinder();
114
- $finder->name('test.ph*');
115
- $finder->name('test.py');
116
- $finder->notName('*.p{hp,y}');
117
- $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
118
- }
119
-
120
- /**
121
- * @dataProvider getRegexNameTestData
122
- */
123
- public function testRegexName($regex)
124
- {
125
- $finder = $this->buildFinder();
126
- $finder->name($regex);
127
- $this->assertIterator($this->toAbsolute(array('test.py', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
128
- }
129
-
130
- public function testSize()
131
- {
132
- $finder = $this->buildFinder();
133
- $this->assertSame($finder, $finder->files()->size('< 1K')->size('> 500'));
134
- $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
135
- }
136
-
137
- public function testDate()
138
- {
139
- $finder = $this->buildFinder();
140
- $this->assertSame($finder, $finder->files()->date('until last month'));
141
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
142
- }
143
-
144
- public function testExclude()
145
- {
146
- $finder = $this->buildFinder();
147
- $this->assertSame($finder, $finder->exclude('foo'));
148
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
149
- }
150
-
151
- public function testIgnoreVCS()
152
- {
153
- $finder = $this->buildFinder();
154
- $this->assertSame($finder, $finder->ignoreVCS(false)->ignoreDotFiles(false));
155
- $this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
156
-
157
- $finder = $this->buildFinder();
158
- $finder->ignoreVCS(false)->ignoreVCS(false)->ignoreDotFiles(false);
159
- $this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
160
-
161
- $finder = $this->buildFinder();
162
- $this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false));
163
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
164
- }
165
-
166
- public function testIgnoreDotFiles()
167
- {
168
- $finder = $this->buildFinder();
169
- $this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false));
170
- $this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
171
-
172
- $finder = $this->buildFinder();
173
- $finder->ignoreDotFiles(false)->ignoreDotFiles(false)->ignoreVCS(false);
174
- $this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
175
-
176
- $finder = $this->buildFinder();
177
- $this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false));
178
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
179
- }
180
-
181
- public function testSortByName()
182
- {
183
- $finder = $this->buildFinder();
184
- $this->assertSame($finder, $finder->sortByName());
185
- $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
186
- }
187
-
188
- public function testSortByType()
189
- {
190
- $finder = $this->buildFinder();
191
- $this->assertSame($finder, $finder->sortByType());
192
- $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'toto', 'foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
193
- }
194
-
195
- public function testSortByAccessedTime()
196
- {
197
- $finder = $this->buildFinder();
198
- $this->assertSame($finder, $finder->sortByAccessedTime());
199
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
200
- }
201
-
202
- public function testSortByChangedTime()
203
- {
204
- $finder = $this->buildFinder();
205
- $this->assertSame($finder, $finder->sortByChangedTime());
206
- $this->assertIterator($this->toAbsolute(array('toto', 'test.py', 'test.php', 'foo/bar.tmp', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
207
- }
208
-
209
- public function testSortByModifiedTime()
210
- {
211
- $finder = $this->buildFinder();
212
- $this->assertSame($finder, $finder->sortByModifiedTime());
213
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
214
- }
215
-
216
- public function testSort()
217
- {
218
- $finder = $this->buildFinder();
219
- $this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }));
220
- $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
221
- }
222
-
223
- public function testFilter()
224
- {
225
- $finder = $this->buildFinder();
226
- $this->assertSame($finder, $finder->filter(function (\SplFileInfo $f) { return false !== strpos($f, 'test'); }));
227
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
228
- }
229
-
230
- public function testFollowLinks()
231
- {
232
- if ('\\' == DIRECTORY_SEPARATOR) {
233
- $this->markTestSkipped('symlinks are not supported on Windows');
234
- }
235
-
236
- $finder = $this->buildFinder();
237
- $this->assertSame($finder, $finder->followLinks());
238
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
239
- }
240
-
241
- public function testIn()
242
- {
243
- $finder = $this->buildFinder();
244
- $iterator = $finder->files()->name('*.php')->depth('< 1')->in(array(self::$tmpDir, __DIR__))->getIterator();
245
-
246
- $expected = array(
247
- self::$tmpDir.DIRECTORY_SEPARATOR.'test.php',
248
- __DIR__.DIRECTORY_SEPARATOR.'BsdFinderTest.php',
249
- __DIR__.DIRECTORY_SEPARATOR.'FinderTest.php',
250
- __DIR__.DIRECTORY_SEPARATOR.'GnuFinderTest.php',
251
- __DIR__.DIRECTORY_SEPARATOR.'PhpFinderTest.php',
252
- __DIR__.DIRECTORY_SEPARATOR.'GlobTest.php',
253
- );
254
-
255
- $this->assertIterator($expected, $iterator);
256
- }
257
-
258
- /**
259
- * @expectedException \InvalidArgumentException
260
- */
261
- public function testInWithNonExistentDirectory()
262
- {
263
- $finder = new Finder();
264
- $finder->in('foobar');
265
- }
266
-
267
- public function testInWithGlob()
268
- {
269
- $finder = $this->buildFinder();
270
- $finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator();
271
-
272
- $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
273
- }
274
-
275
- /**
276
- * @expectedException \InvalidArgumentException
277
- */
278
- public function testInWithNonDirectoryGlob()
279
- {
280
- $finder = new Finder();
281
- $finder->in(__DIR__.'/Fixtures/A/a*');
282
- }
283
-
284
- public function testInWithGlobBrace()
285
- {
286
- $finder = $this->buildFinder();
287
- $finder->in(array(__DIR__.'/Fixtures/{A,copy/A}/B/C'))->getIterator();
288
-
289
- $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
290
- }
291
-
292
- /**
293
- * @expectedException \LogicException
294
- */
295
- public function testGetIteratorWithoutIn()
296
- {
297
- $finder = Finder::create();
298
- $finder->getIterator();
299
- }
300
-
301
- public function testGetIterator()
302
- {
303
- $finder = $this->buildFinder();
304
- $dirs = array();
305
- foreach ($finder->directories()->in(self::$tmpDir) as $dir) {
306
- $dirs[] = (string) $dir;
307
- }
308
-
309
- $expected = $this->toAbsolute(array('foo', 'toto'));
310
-
311
- sort($dirs);
312
- sort($expected);
313
-
314
- $this->assertEquals($expected, $dirs, 'implements the \IteratorAggregate interface');
315
-
316
- $finder = $this->buildFinder();
317
- $this->assertEquals(2, iterator_count($finder->directories()->in(self::$tmpDir)), 'implements the \IteratorAggregate interface');
318
-
319
- $finder = $this->buildFinder();
320
- $a = iterator_to_array($finder->directories()->in(self::$tmpDir));
321
- $a = array_values(array_map(function ($a) { return (string) $a; }, $a));
322
- sort($a);
323
- $this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface');
324
- }
325
-
326
- public function testRelativePath()
327
- {
328
- $finder = $this->buildFinder()->in(self::$tmpDir);
329
-
330
- $paths = array();
331
-
332
- foreach ($finder as $file) {
333
- $paths[] = $file->getRelativePath();
334
- }
335
-
336
- $ref = array('', '', '', '', 'foo', '');
337
-
338
- sort($ref);
339
- sort($paths);
340
-
341
- $this->assertEquals($ref, $paths);
342
- }
343
-
344
- public function testRelativePathname()
345
- {
346
- $finder = $this->buildFinder()->in(self::$tmpDir)->sortByName();
347
-
348
- $paths = array();
349
-
350
- foreach ($finder as $file) {
351
- $paths[] = $file->getRelativePathname();
352
- }
353
-
354
- $ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar');
355
-
356
- sort($paths);
357
- sort($ref);
358
-
359
- $this->assertEquals($ref, $paths);
360
- }
361
-
362
- public function testAppendWithAFinder()
363
- {
364
- $finder = $this->buildFinder();
365
- $finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
366
-
367
- $finder1 = $this->buildFinder();
368
- $finder1->directories()->in(self::$tmpDir);
369
-
370
- $finder = $finder->append($finder1);
371
-
372
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator());
373
- }
374
-
375
- public function testAppendWithAnArray()
376
- {
377
- $finder = $this->buildFinder();
378
- $finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
379
-
380
- $finder->append($this->toAbsolute(array('foo', 'toto')));
381
-
382
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator());
383
- }
384
-
385
- public function testAppendReturnsAFinder()
386
- {
387
- $this->assertInstanceOf('Symfony\\Component\\Finder\\Finder', Finder::create()->append(array()));
388
- }
389
-
390
- public function testAppendDoesNotRequireIn()
391
- {
392
- $finder = $this->buildFinder();
393
- $finder->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
394
-
395
- $finder1 = Finder::create()->append($finder);
396
-
397
- $this->assertIterator(iterator_to_array($finder->getIterator()), $finder1->getIterator());
398
- }
399
-
400
- public function testCountDirectories()
401
- {
402
- $directory = Finder::create()->directories()->in(self::$tmpDir);
403
- $i = 0;
404
-
405
- foreach ($directory as $dir) {
406
- ++$i;
407
- }
408
-
409
- $this->assertCount($i, $directory);
410
- }
411
-
412
- public function testCountFiles()
413
- {
414
- $files = Finder::create()->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures');
415
- $i = 0;
416
-
417
- foreach ($files as $file) {
418
- ++$i;
419
- }
420
-
421
- $this->assertCount($i, $files);
422
- }
423
-
424
- /**
425
- * @expectedException \LogicException
426
- */
427
- public function testCountWithoutIn()
428
- {
429
- $finder = Finder::create()->files();
430
- count($finder);
431
- }
432
-
433
- /**
434
- * @dataProvider getContainsTestData
435
- */
436
- public function testContains($matchPatterns, $noMatchPatterns, $expected)
437
- {
438
- $finder = $this->buildFinder();
439
- $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures')
440
- ->name('*.txt')->sortByName()
441
- ->contains($matchPatterns)
442
- ->notContains($noMatchPatterns);
443
-
444
- $this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
445
- }
446
-
447
- public function testContainsOnDirectory()
448
- {
449
- $finder = $this->buildFinder();
450
- $finder->in(__DIR__)
451
- ->directories()
452
- ->name('Fixtures')
453
- ->contains('abc');
454
- $this->assertIterator(array(), $finder);
455
- }
456
-
457
- public function testNotContainsOnDirectory()
458
- {
459
- $finder = $this->buildFinder();
460
- $finder->in(__DIR__)
461
- ->directories()
462
- ->name('Fixtures')
463
- ->notContains('abc');
464
- $this->assertIterator(array(), $finder);
465
- }
466
-
467
- /**
468
- * Searching in multiple locations involves AppendIterator which does an unnecessary rewind which leaves FilterIterator
469
- * with inner FilesystemIterator in an invalid state.
470
- *
471
- * @see https://bugs.php.net/68557
472
- */
473
- public function testMultipleLocations()
474
- {
475
- $locations = array(
476
- self::$tmpDir.'/',
477
- self::$tmpDir.'/toto/',
478
- );
479
-
480
- // it is expected that there are test.py test.php in the tmpDir
481
- $finder = new Finder();
482
- $finder->in($locations)
483
- // the default flag IGNORE_DOT_FILES fixes the problem indirectly
484
- // so we set it to false for better isolation
485
- ->ignoreDotFiles(false)
486
- ->depth('< 1')->name('test.php');
487
-
488
- $this->assertCount(1, $finder);
489
- }
490
-
491
- /**
492
- * Searching in multiple locations with sub directories involves
493
- * AppendIterator which does an unnecessary rewind which leaves
494
- * FilterIterator with inner FilesystemIterator in an invalid state.
495
- *
496
- * @see https://bugs.php.net/68557
497
- */
498
- public function testMultipleLocationsWithSubDirectories()
499
- {
500
- $locations = array(
501
- __DIR__.'/Fixtures/one',
502
- self::$tmpDir.DIRECTORY_SEPARATOR.'toto',
503
- );
504
-
505
- $finder = $this->buildFinder();
506
- $finder->in($locations)->depth('< 10')->name('*.neon');
507
-
508
- $expected = array(
509
- __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon',
510
- __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon',
511
- );
512
-
513
- $this->assertIterator($expected, $finder);
514
- $this->assertIteratorInForeach($expected, $finder);
515
- }
516
-
517
- /**
518
- * Iterator keys must be the file pathname.
519
- */
520
- public function testIteratorKeys()
521
- {
522
- $finder = $this->buildFinder()->in(self::$tmpDir);
523
- foreach ($finder as $key => $file) {
524
- $this->assertEquals($file->getPathname(), $key);
525
- }
526
- }
527
-
528
- public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag()
529
- {
530
- $finder = $this->buildFinder();
531
- $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s')
532
- ->path('/^dir/');
533
-
534
- $expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat');
535
- $this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
536
- }
537
-
538
- /**
539
- * @group legacy
540
- */
541
- public function testAdaptersOrdering()
542
- {
543
- $finder = Finder::create()
544
- ->removeAdapters()
545
- ->addAdapter(new FakeAdapter\NamedAdapter('a'), 0)
546
- ->addAdapter(new FakeAdapter\NamedAdapter('b'), -50)
547
- ->addAdapter(new FakeAdapter\NamedAdapter('c'), 50)
548
- ->addAdapter(new FakeAdapter\NamedAdapter('d'), -25)
549
- ->addAdapter(new FakeAdapter\NamedAdapter('e'), 25);
550
-
551
- $this->assertEquals(
552
- array('c', 'e', 'a', 'd', 'b'),
553
- array_map(function (AdapterInterface $adapter) {
554
- return $adapter->getName();
555
- }, $finder->getAdapters())
556
- );
557
- }
558
-
559
- /**
560
- * @group legacy
561
- */
562
- public function testAdaptersChaining()
563
- {
564
- $iterator = new \ArrayIterator(array());
565
- $filenames = $this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto'));
566
- foreach ($filenames as $file) {
567
- $iterator->append(new \Symfony\Component\Finder\SplFileInfo($file, null, null));
568
- }
569
-
570
- $finder = Finder::create()
571
- ->removeAdapters()
572
- ->addAdapter(new FakeAdapter\UnsupportedAdapter(), 3)
573
- ->addAdapter(new FakeAdapter\FailingAdapter(), 2)
574
- ->addAdapter(new FakeAdapter\DummyAdapter($iterator), 1);
575
-
576
- $this->assertIterator($filenames, $finder->in(sys_get_temp_dir())->getIterator());
577
- }
578
-
579
- public function getContainsTestData()
580
- {
581
- return array(
582
- array('', '', array()),
583
- array('foo', 'bar', array()),
584
- array('', 'foobar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')),
585
- array('lorem ipsum dolor sit amet', 'foobar', array('lorem.txt')),
586
- array('sit', 'bar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')),
587
- array('dolor sit amet', '@^L@m', array('dolor.txt', 'ipsum.txt')),
588
- array('/^lorem ipsum dolor sit amet$/m', 'foobar', array('lorem.txt')),
589
- array('lorem', 'foobar', array('lorem.txt')),
590
- array('', 'lorem', array('dolor.txt', 'ipsum.txt')),
591
- array('ipsum dolor sit amet', '/^IPSUM/m', array('lorem.txt')),
592
- );
593
- }
594
-
595
- public function getRegexNameTestData()
596
- {
597
- return array(
598
- array('~.+\\.p.+~i'),
599
- array('~t.*s~i'),
600
- );
601
- }
602
-
603
- /**
604
- * @dataProvider getTestPathData
605
- */
606
- public function testPath($matchPatterns, $noMatchPatterns, array $expected)
607
- {
608
- $finder = $this->buildFinder();
609
- $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures')
610
- ->path($matchPatterns)
611
- ->notPath($noMatchPatterns);
612
-
613
- $this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
614
- }
615
-
616
- /**
617
- * @group legacy
618
- */
619
- public function testAdapterSelection()
620
- {
621
- // test that by default, PhpAdapter is selected
622
- $adapters = Finder::create()->getAdapters();
623
- $this->assertTrue($adapters[0] instanceof PhpAdapter);
624
-
625
- // test another adapter selection
626
- $adapters = Finder::create()->setAdapter('gnu_find')->getAdapters();
627
- $this->assertTrue($adapters[0] instanceof GnuFindAdapter);
628
-
629
- // test that useBestAdapter method removes selection
630
- $adapters = Finder::create()->useBestAdapter()->getAdapters();
631
- $this->assertFalse($adapters[0] instanceof PhpAdapter);
632
- }
633
-
634
- public function getTestPathData()
635
- {
636
- return array(
637
- array('', '', array()),
638
- array('/^A\/B\/C/', '/C$/',
639
- array('A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat'),
640
- ),
641
- array('/^A\/B/', 'foobar',
642
- array(
643
- 'A'.DIRECTORY_SEPARATOR.'B',
644
- 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
645
- 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
646
- 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
647
- ),
648
- ),
649
- array('A/B/C', 'foobar',
650
- array(
651
- 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
652
- 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
653
- 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
654
- 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy',
655
- ),
656
- ),
657
- array('A/B', 'foobar',
658
- array(
659
- //dirs
660
- 'A'.DIRECTORY_SEPARATOR.'B',
661
- 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
662
- 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B',
663
- 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
664
- //files
665
- 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
666
- 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
667
- 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat.copy',
668
- 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy',
669
- ),
670
- ),
671
- array('/^with space\//', 'foobar',
672
- array(
673
- 'with space'.DIRECTORY_SEPARATOR.'foo.txt',
674
- ),
675
- ),
676
- );
677
- }
678
-
679
- public function testAccessDeniedException()
680
- {
681
- if ('\\' === DIRECTORY_SEPARATOR) {
682
- $this->markTestSkipped('chmod is not supported on Windows');
683
- }
684
-
685
- $finder = $this->buildFinder();
686
- $finder->files()->in(self::$tmpDir);
687
-
688
- // make 'foo' directory non-readable
689
- $testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo';
690
- chmod($testDir, 0333);
691
-
692
- if (false === $couldRead = is_readable($testDir)) {
693
- try {
694
- $this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator());
695
- $this->fail('Finder should throw an exception when opening a non-readable directory.');
696
- } catch (\Exception $e) {
697
- $expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException';
698
- if ($e instanceof \PHPUnit_Framework_ExpectationFailedException) {
699
- $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
700
- }
701
-
702
- $this->assertInstanceOf($expectedExceptionClass, $e);
703
- }
704
- }
705
-
706
- // restore original permissions
707
- chmod($testDir, 0777);
708
- clearstatcache($testDir);
709
-
710
- if ($couldRead) {
711
- $this->markTestSkipped('could read test files while test requires unreadable');
712
- }
713
- }
714
-
715
- public function testIgnoredAccessDeniedException()
716
- {
717
- if ('\\' === DIRECTORY_SEPARATOR) {
718
- $this->markTestSkipped('chmod is not supported on Windows');
719
- }
720
-
721
- $finder = $this->buildFinder();
722
- $finder->files()->ignoreUnreadableDirs()->in(self::$tmpDir);
723
-
724
- // make 'foo' directory non-readable
725
- $testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo';
726
- chmod($testDir, 0333);
727
-
728
- if (false === ($couldRead = is_readable($testDir))) {
729
- $this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator());
730
- }
731
-
732
- // restore original permissions
733
- chmod($testDir, 0777);
734
- clearstatcache($testDir);
735
-
736
- if ($couldRead) {
737
- $this->markTestSkipped('could read test files while test requires unreadable');
738
- }
739
- }
740
-
741
- protected function buildFinder()
742
- {
743
- return Finder::create();
744
- }
745
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/A/a.dat DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/copy/A/B/ab.dat.copy DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/copy/A/a.dat.copy DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/dolor.txt DELETED
@@ -1,2 +0,0 @@
1
- dolor sit amet
2
- DOLOR SIT AMET
 
 
vendor/symfony/finder/Tests/Fixtures/ipsum.txt DELETED
@@ -1,2 +0,0 @@
1
- ipsum dolor sit amet
2
- IPSUM DOLOR SIT AMET
 
 
vendor/symfony/finder/Tests/Fixtures/lorem.txt DELETED
@@ -1,2 +0,0 @@
1
- lorem ipsum dolor sit amet
2
- LOREM IPSUM DOLOR SIT AMET
 
 
vendor/symfony/finder/Tests/Fixtures/one/a DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/one/b/c.neon DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/one/b/d.neon DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat DELETED
File without changes
vendor/symfony/finder/Tests/Fixtures/with space/foo.txt DELETED
File without changes
vendor/symfony/finder/Tests/GlobTest.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests;
13
-
14
- use Symfony\Component\Finder\Glob;
15
-
16
- class GlobTest extends \PHPUnit_Framework_TestCase
17
- {
18
- public function testGlobToRegexDelimiters()
19
- {
20
- $this->assertEquals('#^(?=[^\.])\#$#', Glob::toRegex('#'));
21
- $this->assertEquals('#^\.[^/]*$#', Glob::toRegex('.*'));
22
- $this->assertEquals('^\.[^/]*$', Glob::toRegex('.*', true, true, ''));
23
- $this->assertEquals('/^\.[^/]*$/', Glob::toRegex('.*', true, true, '/'));
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/GnuFinderTest.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests;
13
-
14
- use Symfony\Component\Finder\Adapter\GnuFindAdapter;
15
- use Symfony\Component\Finder\Finder;
16
-
17
- /**
18
- * @group legacy
19
- */
20
- class GnuFinderTest extends FinderTest
21
- {
22
- protected function buildFinder()
23
- {
24
- $adapter = new GnuFindAdapter();
25
-
26
- if (!$adapter->isSupported()) {
27
- $this->markTestSkipped(get_class($adapter).' is not supported.');
28
- }
29
-
30
- return Finder::create()
31
- ->removeAdapters()
32
- ->addAdapter($adapter);
33
- }
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\CustomFilterIterator;
15
-
16
- class CustomFilterIteratorTest extends IteratorTestCase
17
- {
18
- /**
19
- * @expectedException \InvalidArgumentException
20
- */
21
- public function testWithInvalidFilter()
22
- {
23
- new CustomFilterIterator(new Iterator(), array('foo'));
24
- }
25
-
26
- /**
27
- * @dataProvider getAcceptData
28
- */
29
- public function testAccept($filters, $expected)
30
- {
31
- $inner = new Iterator(array('test.php', 'test.py', 'foo.php'));
32
-
33
- $iterator = new CustomFilterIterator($inner, $filters);
34
-
35
- $this->assertIterator($expected, $iterator);
36
- }
37
-
38
- public function getAcceptData()
39
- {
40
- return array(
41
- array(array(function (\SplFileInfo $fileinfo) { return false; }), array()),
42
- array(array(function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }), array('test.php', 'test.py')),
43
- array(array('is_dir'), array()),
44
- );
45
- }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
15
- use Symfony\Component\Finder\Comparator\DateComparator;
16
-
17
- class DateRangeFilterIteratorTest extends RealIteratorTestCase
18
- {
19
- /**
20
- * @dataProvider getAcceptData
21
- */
22
- public function testAccept($size, $expected)
23
- {
24
- $files = self::$files;
25
- $files[] = self::toAbsolute('doesnotexist');
26
- $inner = new Iterator($files);
27
-
28
- $iterator = new DateRangeFilterIterator($inner, $size);
29
-
30
- $this->assertIterator($expected, $iterator);
31
- }
32
-
33
- public function getAcceptData()
34
- {
35
- $since20YearsAgo = array(
36
- '.git',
37
- 'test.py',
38
- 'foo',
39
- 'foo/bar.tmp',
40
- 'test.php',
41
- 'toto',
42
- 'toto/.git',
43
- '.bar',
44
- '.foo',
45
- '.foo/.bar',
46
- 'foo bar',
47
- '.foo/bar',
48
- );
49
-
50
- $since2MonthsAgo = array(
51
- '.git',
52
- 'test.py',
53
- 'foo',
54
- 'toto',
55
- 'toto/.git',
56
- '.bar',
57
- '.foo',
58
- '.foo/.bar',
59
- 'foo bar',
60
- '.foo/bar',
61
- );
62
-
63
- $untilLastMonth = array(
64
- 'foo/bar.tmp',
65
- 'test.php',
66
- );
67
-
68
- return array(
69
- array(array(new DateComparator('since 20 years ago')), $this->toAbsolute($since20YearsAgo)),
70
- array(array(new DateComparator('since 2 months ago')), $this->toAbsolute($since2MonthsAgo)),
71
- array(array(new DateComparator('until last month')), $this->toAbsolute($untilLastMonth)),
72
- );
73
- }
74
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
15
-
16
- class DepthRangeFilterIteratorTest extends RealIteratorTestCase
17
- {
18
- /**
19
- * @dataProvider getAcceptData
20
- */
21
- public function testAccept($minDepth, $maxDepth, $expected)
22
- {
23
- $inner = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
24
-
25
- $iterator = new DepthRangeFilterIterator($inner, $minDepth, $maxDepth);
26
-
27
- $actual = array_keys(iterator_to_array($iterator));
28
- sort($expected);
29
- sort($actual);
30
- $this->assertEquals($expected, $actual);
31
- }
32
-
33
- public function getAcceptData()
34
- {
35
- $lessThan1 = array(
36
- '.git',
37
- 'test.py',
38
- 'foo',
39
- 'test.php',
40
- 'toto',
41
- '.foo',
42
- '.bar',
43
- 'foo bar',
44
- );
45
-
46
- $lessThanOrEqualTo1 = array(
47
- '.git',
48
- 'test.py',
49
- 'foo',
50
- 'foo/bar.tmp',
51
- 'test.php',
52
- 'toto',
53
- 'toto/.git',
54
- '.foo',
55
- '.foo/.bar',
56
- '.bar',
57
- 'foo bar',
58
- '.foo/bar',
59
- );
60
-
61
- $graterThanOrEqualTo1 = array(
62
- 'toto/.git',
63
- 'foo/bar.tmp',
64
- '.foo/.bar',
65
- '.foo/bar',
66
- );
67
-
68
- $equalTo1 = array(
69
- 'toto/.git',
70
- 'foo/bar.tmp',
71
- '.foo/.bar',
72
- '.foo/bar',
73
- );
74
-
75
- return array(
76
- array(0, 0, $this->toAbsolute($lessThan1)),
77
- array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)),
78
- array(2, PHP_INT_MAX, array()),
79
- array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)),
80
- array(1, 1, $this->toAbsolute($equalTo1)),
81
- );
82
- }
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
15
- use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
16
-
17
- class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
18
- {
19
- /**
20
- * @dataProvider getAcceptData
21
- */
22
- public function testAccept($directories, $expected)
23
- {
24
- $inner = new \RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
25
-
26
- $iterator = new ExcludeDirectoryFilterIterator($inner, $directories);
27
-
28
- $this->assertIterator($expected, $iterator);
29
- }
30
-
31
- public function getAcceptData()
32
- {
33
- $foo = array(
34
- '.bar',
35
- '.foo',
36
- '.foo/.bar',
37
- '.foo/bar',
38
- '.git',
39
- 'test.py',
40
- 'test.php',
41
- 'toto',
42
- 'toto/.git',
43
- 'foo bar',
44
- );
45
-
46
- $fo = array(
47
- '.bar',
48
- '.foo',
49
- '.foo/.bar',
50
- '.foo/bar',
51
- '.git',
52
- 'test.py',
53
- 'foo',
54
- 'foo/bar.tmp',
55
- 'test.php',
56
- 'toto',
57
- 'toto/.git',
58
- 'foo bar',
59
- );
60
-
61
- return array(
62
- array(array('foo'), $this->toAbsolute($foo)),
63
- array(array('fo'), $this->toAbsolute($fo)),
64
- );
65
- }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/FilePathsIteratorTest.php DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\FilePathsIterator;
15
-
16
- /**
17
- * @group legacy
18
- */
19
- class FilePathsIteratorTest extends RealIteratorTestCase
20
- {
21
- /**
22
- * @dataProvider getSubPathData
23
- */
24
- public function testSubPath($baseDir, array $paths, array $subPaths, array $subPathnames)
25
- {
26
- $iterator = new FilePathsIterator($paths, $baseDir);
27
-
28
- foreach ($iterator as $index => $file) {
29
- $this->assertEquals($paths[$index], $file->getPathname());
30
- $this->assertEquals($subPaths[$index], $iterator->getSubPath());
31
- $this->assertEquals($subPathnames[$index], $iterator->getSubPathname());
32
- }
33
- }
34
-
35
- public function getSubPathData()
36
- {
37
- $tmpDir = sys_get_temp_dir().'/symfony_finder';
38
-
39
- return array(
40
- array(
41
- $tmpDir,
42
- array(
43
- // paths
44
- $tmpDir.DIRECTORY_SEPARATOR.'.git' => $tmpDir.DIRECTORY_SEPARATOR.'.git',
45
- $tmpDir.DIRECTORY_SEPARATOR.'test.py' => $tmpDir.DIRECTORY_SEPARATOR.'test.py',
46
- $tmpDir.DIRECTORY_SEPARATOR.'foo' => $tmpDir.DIRECTORY_SEPARATOR.'foo',
47
- $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp',
48
- $tmpDir.DIRECTORY_SEPARATOR.'test.php' => $tmpDir.DIRECTORY_SEPARATOR.'test.php',
49
- $tmpDir.DIRECTORY_SEPARATOR.'toto' => $tmpDir.DIRECTORY_SEPARATOR.'toto',
50
- ),
51
- array(
52
- // subPaths
53
- $tmpDir.DIRECTORY_SEPARATOR.'.git' => '',
54
- $tmpDir.DIRECTORY_SEPARATOR.'test.py' => '',
55
- $tmpDir.DIRECTORY_SEPARATOR.'foo' => '',
56
- $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => 'foo',
57
- $tmpDir.DIRECTORY_SEPARATOR.'test.php' => '',
58
- $tmpDir.DIRECTORY_SEPARATOR.'toto' => '',
59
- ),
60
- array(
61
- // subPathnames
62
- $tmpDir.DIRECTORY_SEPARATOR.'.git' => '.git',
63
- $tmpDir.DIRECTORY_SEPARATOR.'test.py' => 'test.py',
64
- $tmpDir.DIRECTORY_SEPARATOR.'foo' => 'foo',
65
- $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => 'foo'.DIRECTORY_SEPARATOR.'bar.tmp',
66
- $tmpDir.DIRECTORY_SEPARATOR.'test.php' => 'test.php',
67
- $tmpDir.DIRECTORY_SEPARATOR.'toto' => 'toto',
68
- ),
69
- ),
70
- );
71
- }
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php DELETED
@@ -1,73 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\FileTypeFilterIterator;
15
-
16
- class FileTypeFilterIteratorTest extends RealIteratorTestCase
17
- {
18
- /**
19
- * @dataProvider getAcceptData
20
- */
21
- public function testAccept($mode, $expected)
22
- {
23
- $inner = new InnerTypeIterator(self::$files);
24
-
25
- $iterator = new FileTypeFilterIterator($inner, $mode);
26
-
27
- $this->assertIterator($expected, $iterator);
28
- }
29
-
30
- public function getAcceptData()
31
- {
32
- $onlyFiles = array(
33
- 'test.py',
34
- 'foo/bar.tmp',
35
- 'test.php',
36
- '.bar',
37
- '.foo/.bar',
38
- '.foo/bar',
39
- 'foo bar',
40
- );
41
-
42
- $onlyDirectories = array(
43
- '.git',
44
- 'foo',
45
- 'toto',
46
- 'toto/.git',
47
- '.foo',
48
- );
49
-
50
- return array(
51
- array(FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)),
52
- array(FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)),
53
- );
54
- }
55
- }
56
-
57
- class InnerTypeIterator extends \ArrayIterator
58
- {
59
- public function current()
60
- {
61
- return new \SplFileInfo(parent::current());
62
- }
63
-
64
- public function isFile()
65
- {
66
- return $this->current()->isFile();
67
- }
68
-
69
- public function isDir()
70
- {
71
- return $this->current()->isDir();
72
- }
73
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php DELETED
@@ -1,86 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
15
-
16
- class FilecontentFilterIteratorTest extends IteratorTestCase
17
- {
18
- public function testAccept()
19
- {
20
- $inner = new MockFileListIterator(array('test.txt'));
21
- $iterator = new FilecontentFilterIterator($inner, array(), array());
22
- $this->assertIterator(array('test.txt'), $iterator);
23
- }
24
-
25
- public function testDirectory()
26
- {
27
- $inner = new MockFileListIterator(array('directory'));
28
- $iterator = new FilecontentFilterIterator($inner, array('directory'), array());
29
- $this->assertIterator(array(), $iterator);
30
- }
31
-
32
- public function testUnreadableFile()
33
- {
34
- $inner = new MockFileListIterator(array('file r-'));
35
- $iterator = new FilecontentFilterIterator($inner, array('file r-'), array());
36
- $this->assertIterator(array(), $iterator);
37
- }
38
-
39
- /**
40
- * @dataProvider getTestFilterData
41
- */
42
- public function testFilter(\Iterator $inner, array $matchPatterns, array $noMatchPatterns, array $resultArray)
43
- {
44
- $iterator = new FilecontentFilterIterator($inner, $matchPatterns, $noMatchPatterns);
45
- $this->assertIterator($resultArray, $iterator);
46
- }
47
-
48
- public function getTestFilterData()
49
- {
50
- $inner = new MockFileListIterator();
51
-
52
- $inner[] = new MockSplFileInfo(array(
53
- 'name' => 'a.txt',
54
- 'contents' => 'Lorem ipsum...',
55
- 'type' => 'file',
56
- 'mode' => 'r+', )
57
- );
58
-
59
- $inner[] = new MockSplFileInfo(array(
60
- 'name' => 'b.yml',
61
- 'contents' => 'dolor sit...',
62
- 'type' => 'file',
63
- 'mode' => 'r+', )
64
- );
65
-
66
- $inner[] = new MockSplFileInfo(array(
67
- 'name' => 'some/other/dir/third.php',
68
- 'contents' => 'amet...',
69
- 'type' => 'file',
70
- 'mode' => 'r+', )
71
- );
72
-
73
- $inner[] = new MockSplFileInfo(array(
74
- 'name' => 'unreadable-file.txt',
75
- 'contents' => false,
76
- 'type' => 'file',
77
- 'mode' => 'r+', )
78
- );
79
-
80
- return array(
81
- array($inner, array('.'), array(), array('a.txt', 'b.yml', 'some/other/dir/third.php')),
82
- array($inner, array('ipsum'), array(), array('a.txt')),
83
- array($inner, array('i', 'amet'), array('Lorem', 'amet'), array('b.yml')),
84
- );
85
- }
86
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
15
-
16
- class FilenameFilterIteratorTest extends IteratorTestCase
17
- {
18
- /**
19
- * @dataProvider getAcceptData
20
- */
21
- public function testAccept($matchPatterns, $noMatchPatterns, $expected)
22
- {
23
- $inner = new InnerNameIterator(array('test.php', 'test.py', 'foo.php'));
24
-
25
- $iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns);
26
-
27
- $this->assertIterator($expected, $iterator);
28
- }
29
-
30
- public function getAcceptData()
31
- {
32
- return array(
33
- array(array('test.*'), array(), array('test.php', 'test.py')),
34
- array(array(), array('test.*'), array('foo.php')),
35
- array(array('*.php'), array('test.*'), array('foo.php')),
36
- array(array('*.php', '*.py'), array('foo.*'), array('test.php', 'test.py')),
37
- array(array('/\.php$/'), array(), array('test.php', 'foo.php')),
38
- array(array(), array('/\.php$/'), array('test.py')),
39
- );
40
- }
41
- }
42
-
43
- class InnerNameIterator extends \ArrayIterator
44
- {
45
- public function current()
46
- {
47
- return new \SplFileInfo(parent::current());
48
- }
49
-
50
- public function getFilename()
51
- {
52
- return parent::current();
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/FilterIteratorTest.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- /**
15
- * @author Alex Bogomazov
16
- */
17
- class FilterIteratorTest extends RealIteratorTestCase
18
- {
19
- public function testFilterFilesystemIterators()
20
- {
21
- $i = new \FilesystemIterator($this->toAbsolute());
22
-
23
- // it is expected that there are test.py test.php in the tmpDir
24
- $i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', array($i));
25
- $i->expects($this->any())
26
- ->method('accept')
27
- ->will($this->returnCallback(function () use ($i) {
28
- return (bool) preg_match('/\.php/', (string) $i->current());
29
- })
30
- );
31
-
32
- $c = 0;
33
- foreach ($i as $item) {
34
- ++$c;
35
- }
36
-
37
- $this->assertEquals(1, $c);
38
-
39
- $i->rewind();
40
-
41
- $c = 0;
42
- foreach ($i as $item) {
43
- ++$c;
44
- }
45
-
46
- // This would fail in php older than 5.5.23/5.6.7 with \FilterIterator
47
- // but works with Symfony\Component\Finder\Iterator\FilterIterator
48
- // see https://bugs.php.net/68557
49
- $this->assertEquals(1, $c);
50
- }
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/Iterator.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- class Iterator implements \Iterator
15
- {
16
- protected $values = array();
17
-
18
- public function __construct(array $values = array())
19
- {
20
- foreach ($values as $value) {
21
- $this->attach(new \SplFileInfo($value));
22
- }
23
- $this->rewind();
24
- }
25
-
26
- public function attach(\SplFileInfo $fileinfo)
27
- {
28
- $this->values[] = $fileinfo;
29
- }
30
-
31
- public function rewind()
32
- {
33
- reset($this->values);
34
- }
35
-
36
- public function valid()
37
- {
38
- return false !== $this->current();
39
- }
40
-
41
- public function next()
42
- {
43
- next($this->values);
44
- }
45
-
46
- public function current()
47
- {
48
- return current($this->values);
49
- }
50
-
51
- public function key()
52
- {
53
- return key($this->values);
54
- }
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php DELETED
@@ -1,98 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- abstract class IteratorTestCase extends \PHPUnit_Framework_TestCase
15
- {
16
- protected function assertIterator($expected, \Traversable $iterator)
17
- {
18
- // set iterator_to_array $use_key to false to avoid values merge
19
- // this made FinderTest::testAppendWithAnArray() fail with GnuFinderAdapter
20
- $values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false));
21
-
22
- $expected = array_map(function ($path) { return str_replace('/', DIRECTORY_SEPARATOR, $path); }, $expected);
23
-
24
- sort($values);
25
- sort($expected);
26
-
27
- $this->assertEquals($expected, array_values($values));
28
- }
29
-
30
- protected function assertOrderedIterator($expected, \Traversable $iterator)
31
- {
32
- $values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator));
33
-
34
- $this->assertEquals($expected, array_values($values));
35
- }
36
-
37
- /**
38
- * Same as assertOrderedIterator, but checks the order of groups of
39
- * array elements.
40
- *
41
- * @param array $expected - an array of arrays. For any two subarrays
42
- * $a and $b such that $a goes before $b in $expected, the method
43
- * asserts that any element of $a goes before any element of $b
44
- * in the sequence generated by $iterator
45
- * @param \Traversable $iterator
46
- */
47
- protected function assertOrderedIteratorForGroups($expected, \Traversable $iterator)
48
- {
49
- $values = array_values(array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator)));
50
-
51
- foreach ($expected as $subarray) {
52
- $temp = array();
53
- while (count($values) && count($temp) < count($subarray)) {
54
- $temp[] = array_shift($values);
55
- }
56
- sort($temp);
57
- sort($subarray);
58
- $this->assertEquals($subarray, $temp);
59
- }
60
- }
61
-
62
- /**
63
- * Same as IteratorTestCase::assertIterator with foreach usage.
64
- *
65
- * @param array $expected
66
- * @param \Traversable $iterator
67
- */
68
- protected function assertIteratorInForeach($expected, \Traversable $iterator)
69
- {
70
- $values = array();
71
- foreach ($iterator as $file) {
72
- $this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
73
- $values[] = $file->getPathname();
74
- }
75
-
76
- sort($values);
77
- sort($expected);
78
-
79
- $this->assertEquals($expected, array_values($values));
80
- }
81
-
82
- /**
83
- * Same as IteratorTestCase::assertOrderedIterator with foreach usage.
84
- *
85
- * @param array $expected
86
- * @param \Traversable $iterator
87
- */
88
- protected function assertOrderedIteratorInForeach($expected, \Traversable $iterator)
89
- {
90
- $values = array();
91
- foreach ($iterator as $file) {
92
- $this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
93
- $values[] = $file->getPathname();
94
- }
95
-
96
- $this->assertEquals($expected, array_values($values));
97
- }
98
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- class MockFileListIterator extends \ArrayIterator
15
- {
16
- public function __construct(array $filesArray = array())
17
- {
18
- $files = array_map(function ($file) { return new MockSplFileInfo($file); }, $filesArray);
19
- parent::__construct($files);
20
- }
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php DELETED
@@ -1,134 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- class MockSplFileInfo extends \SplFileInfo
15
- {
16
- const TYPE_DIRECTORY = 1;
17
- const TYPE_FILE = 2;
18
- const TYPE_UNKNOWN = 3;
19
-
20
- private $contents = null;
21
- private $mode = null;
22
- private $type = null;
23
- private $relativePath = null;
24
- private $relativePathname = null;
25
-
26
- public function __construct($param)
27
- {
28
- if (is_string($param)) {
29
- parent::__construct($param);
30
- } elseif (is_array($param)) {
31
- $defaults = array(
32
- 'name' => 'file.txt',
33
- 'contents' => null,
34
- 'mode' => null,
35
- 'type' => null,
36
- 'relativePath' => null,
37
- 'relativePathname' => null,
38
- );
39
- $defaults = array_merge($defaults, $param);
40
- parent::__construct($defaults['name']);
41
- $this->setContents($defaults['contents']);
42
- $this->setMode($defaults['mode']);
43
- $this->setType($defaults['type']);
44
- $this->setRelativePath($defaults['relativePath']);
45
- $this->setRelativePathname($defaults['relativePathname']);
46
- } else {
47
- throw new \RuntimeException(sprintf('Incorrect parameter "%s"', $param));
48
- }
49
- }
50
-
51
- public function isFile()
52
- {
53
- if (null === $this->type) {
54
- return false !== strpos($this->getFilename(), 'file');
55
- }
56
-
57
- return self::TYPE_FILE === $this->type;
58
- }
59
-
60
- public function isDir()
61
- {
62
- if (null === $this->type) {
63
- return false !== strpos($this->getFilename(), 'directory');
64
- }
65
-
66
- return self::TYPE_DIRECTORY === $this->type;
67
- }
68
-
69
- public function isReadable()
70
- {
71
- if (null === $this->mode) {
72
- return preg_match('/r\+/', $this->getFilename());
73
- }
74
-
75
- return preg_match('/r\+/', $this->mode);
76
- }
77
-
78
- public function getContents()
79
- {
80
- return $this->contents;
81
- }
82
-
83
- public function setContents($contents)
84
- {
85
- $this->contents = $contents;
86
- }
87
-
88
- public function setMode($mode)
89
- {
90
- $this->mode = $mode;
91
- }
92
-
93
- public function setType($type)
94
- {
95
- if (is_string($type)) {
96
- switch ($type) {
97
- case 'directory':
98
- $this->type = self::TYPE_DIRECTORY;
99
- case 'd':
100
- $this->type = self::TYPE_DIRECTORY;
101
- break;
102
- case 'file':
103
- $this->type = self::TYPE_FILE;
104
- case 'f':
105
- $this->type = self::TYPE_FILE;
106
- break;
107
- default:
108
- $this->type = self::TYPE_UNKNOWN;
109
- }
110
- } else {
111
- $this->type = $type;
112
- }
113
- }
114
-
115
- public function setRelativePath($relativePath)
116
- {
117
- $this->relativePath = $relativePath;
118
- }
119
-
120
- public function setRelativePathname($relativePathname)
121
- {
122
- $this->relativePathname = $relativePathname;
123
- }
124
-
125
- public function getRelativePath()
126
- {
127
- return $this->relativePath;
128
- }
129
-
130
- public function getRelativePathname()
131
- {
132
- return $this->relativePathname;
133
- }
134
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\MultiplePcreFilterIterator;
15
-
16
- class MultiplePcreFilterIteratorTest extends \PHPUnit_Framework_TestCase
17
- {
18
- /**
19
- * @dataProvider getIsRegexFixtures
20
- */
21
- public function testIsRegex($string, $isRegex, $message)
22
- {
23
- $testIterator = new TestMultiplePcreFilterIterator();
24
- $this->assertEquals($isRegex, $testIterator->isRegex($string), $message);
25
- }
26
-
27
- public function getIsRegexFixtures()
28
- {
29
- return array(
30
- array('foo', false, 'string'),
31
- array(' foo ', false, '" " is not a valid delimiter'),
32
- array('\\foo\\', false, '"\\" is not a valid delimiter'),
33
- array('afooa', false, '"a" is not a valid delimiter'),
34
- array('//', false, 'the pattern should contain at least 1 character'),
35
- array('/a/', true, 'valid regex'),
36
- array('/foo/', true, 'valid regex'),
37
- array('/foo/i', true, 'valid regex with a single modifier'),
38
- array('/foo/imsxu', true, 'valid regex with multiple modifiers'),
39
- array('#foo#', true, '"#" is a valid delimiter'),
40
- array('{foo}', true, '"{,}" is a valid delimiter pair'),
41
- array('[foo]', true, '"[,]" is a valid delimiter pair'),
42
- array('(foo)', true, '"(,)" is a valid delimiter pair'),
43
- array('<foo>', true, '"<,>" is a valid delimiter pair'),
44
- array('*foo.*', false, '"*" is not considered as a valid delimiter'),
45
- array('?foo.?', false, '"?" is not considered as a valid delimiter'),
46
- );
47
- }
48
- }
49
-
50
- class TestMultiplePcreFilterIterator extends MultiplePcreFilterIterator
51
- {
52
- public function __construct()
53
- {
54
- }
55
-
56
- public function accept()
57
- {
58
- throw new \BadFunctionCallException('Not implemented');
59
- }
60
-
61
- public function isRegex($str)
62
- {
63
- return parent::isRegex($str);
64
- }
65
-
66
- public function toRegex($str)
67
- {
68
- throw new \BadFunctionCallException('Not implemented');
69
- }
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\PathFilterIterator;
15
-
16
- class PathFilterIteratorTest extends IteratorTestCase
17
- {
18
- /**
19
- * @dataProvider getTestFilterData
20
- */
21
- public function testFilter(\Iterator $inner, array $matchPatterns, array $noMatchPatterns, array $resultArray)
22
- {
23
- $iterator = new PathFilterIterator($inner, $matchPatterns, $noMatchPatterns);
24
- $this->assertIterator($resultArray, $iterator);
25
- }
26
-
27
- public function getTestFilterData()
28
- {
29
- $inner = new MockFileListIterator();
30
-
31
- //PATH: A/B/C/abc.dat
32
- $inner[] = new MockSplFileInfo(array(
33
- 'name' => 'abc.dat',
34
- 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
35
- ));
36
-
37
- //PATH: A/B/ab.dat
38
- $inner[] = new MockSplFileInfo(array(
39
- 'name' => 'ab.dat',
40
- 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
41
- ));
42
-
43
- //PATH: A/a.dat
44
- $inner[] = new MockSplFileInfo(array(
45
- 'name' => 'a.dat',
46
- 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'a.dat',
47
- ));
48
-
49
- //PATH: copy/A/B/C/abc.dat.copy
50
- $inner[] = new MockSplFileInfo(array(
51
- 'name' => 'abc.dat.copy',
52
- 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
53
- ));
54
-
55
- //PATH: copy/A/B/ab.dat.copy
56
- $inner[] = new MockSplFileInfo(array(
57
- 'name' => 'ab.dat.copy',
58
- 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
59
- ));
60
-
61
- //PATH: copy/A/a.dat.copy
62
- $inner[] = new MockSplFileInfo(array(
63
- 'name' => 'a.dat.copy',
64
- 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'a.dat',
65
- ));
66
-
67
- return array(
68
- array($inner, array('/^A/'), array(), array('abc.dat', 'ab.dat', 'a.dat')),
69
- array($inner, array('/^A\/B/'), array(), array('abc.dat', 'ab.dat')),
70
- array($inner, array('/^A\/B\/C/'), array(), array('abc.dat')),
71
- array($inner, array('/A\/B\/C/'), array(), array('abc.dat', 'abc.dat.copy')),
72
-
73
- array($inner, array('A'), array(), array('abc.dat', 'ab.dat', 'a.dat', 'abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
74
- array($inner, array('A/B'), array(), array('abc.dat', 'ab.dat', 'abc.dat.copy', 'ab.dat.copy')),
75
- array($inner, array('A/B/C'), array(), array('abc.dat', 'abc.dat.copy')),
76
-
77
- array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
78
- array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')),
79
- array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')),
80
-
81
- );
82
- }
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php DELETED
@@ -1,110 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- abstract class RealIteratorTestCase extends IteratorTestCase
15
- {
16
- protected static $tmpDir;
17
- protected static $files;
18
-
19
- public static function setUpBeforeClass()
20
- {
21
- self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder';
22
-
23
- self::$files = array(
24
- '.git/',
25
- '.foo/',
26
- '.foo/.bar',
27
- '.foo/bar',
28
- '.bar',
29
- 'test.py',
30
- 'foo/',
31
- 'foo/bar.tmp',
32
- 'test.php',
33
- 'toto/',
34
- 'toto/.git/',
35
- 'foo bar',
36
- );
37
-
38
- self::$files = self::toAbsolute(self::$files);
39
-
40
- if (is_dir(self::$tmpDir)) {
41
- self::tearDownAfterClass();
42
- } else {
43
- mkdir(self::$tmpDir);
44
- }
45
-
46
- foreach (self::$files as $file) {
47
- if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
48
- mkdir($file);
49
- } else {
50
- touch($file);
51
- }
52
- }
53
-
54
- file_put_contents(self::toAbsolute('test.php'), str_repeat(' ', 800));
55
- file_put_contents(self::toAbsolute('test.py'), str_repeat(' ', 2000));
56
-
57
- touch(self::toAbsolute('foo/bar.tmp'), strtotime('2005-10-15'));
58
- touch(self::toAbsolute('test.php'), strtotime('2005-10-15'));
59
- }
60
-
61
- public static function tearDownAfterClass()
62
- {
63
- foreach (array_reverse(self::$files) as $file) {
64
- if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
65
- @rmdir($file);
66
- } else {
67
- @unlink($file);
68
- }
69
- }
70
- }
71
-
72
- protected static function toAbsolute($files = null)
73
- {
74
- /*
75
- * Without the call to setUpBeforeClass() property can be null.
76
- */
77
- if (!self::$tmpDir) {
78
- self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder';
79
- }
80
-
81
- if (is_array($files)) {
82
- $f = array();
83
- foreach ($files as $file) {
84
- if (is_array($file)) {
85
- $f[] = self::toAbsolute($file);
86
- } else {
87
- $f[] = self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $file);
88
- }
89
- }
90
-
91
- return $f;
92
- }
93
-
94
- if (is_string($files)) {
95
- return self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $files);
96
- }
97
-
98
- return self::$tmpDir;
99
- }
100
-
101
- protected static function toAbsoluteFixtures($files)
102
- {
103
- $f = array();
104
- foreach ($files as $file) {
105
- $f[] = realpath(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.$file);
106
- }
107
-
108
- return $f;
109
- }
110
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
15
-
16
- class RecursiveDirectoryIteratorTest extends IteratorTestCase
17
- {
18
- /**
19
- * @group network
20
- */
21
- public function testRewindOnFtp()
22
- {
23
- try {
24
- $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS);
25
- } catch (\UnexpectedValueException $e) {
26
- $this->markTestSkipped('Unsupported stream "ftp".');
27
- }
28
-
29
- $i->rewind();
30
-
31
- $this->assertTrue(true);
32
- }
33
-
34
- /**
35
- * @group network
36
- */
37
- public function testSeekOnFtp()
38
- {
39
- try {
40
- $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS);
41
- } catch (\UnexpectedValueException $e) {
42
- $this->markTestSkipped('Unsupported stream "ftp".');
43
- }
44
-
45
- $contains = array(
46
- 'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'1000GB.zip',
47
- 'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'100GB.zip',
48
- );
49
- $actual = array();
50
-
51
- $i->seek(0);
52
- $actual[] = $i->getPathname();
53
-
54
- $i->seek(1);
55
- $actual[] = $i->getPathname();
56
-
57
- $this->assertEquals($contains, $actual);
58
- }
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
15
- use Symfony\Component\Finder\Comparator\NumberComparator;
16
-
17
- class SizeRangeFilterIteratorTest extends RealIteratorTestCase
18
- {
19
- /**
20
- * @dataProvider getAcceptData
21
- */
22
- public function testAccept($size, $expected)
23
- {
24
- $inner = new InnerSizeIterator(self::$files);
25
-
26
- $iterator = new SizeRangeFilterIterator($inner, $size);
27
-
28
- $this->assertIterator($expected, $iterator);
29
- }
30
-
31
- public function getAcceptData()
32
- {
33
- $lessThan1KGreaterThan05K = array(
34
- '.foo',
35
- '.git',
36
- 'foo',
37
- 'test.php',
38
- 'toto',
39
- 'toto/.git',
40
- );
41
-
42
- return array(
43
- array(array(new NumberComparator('< 1K'), new NumberComparator('> 0.5K')), $this->toAbsolute($lessThan1KGreaterThan05K)),
44
- );
45
- }
46
- }
47
-
48
- class InnerSizeIterator extends \ArrayIterator
49
- {
50
- public function current()
51
- {
52
- return new \SplFileInfo(parent::current());
53
- }
54
-
55
- public function getFilename()
56
- {
57
- return parent::current();
58
- }
59
-
60
- public function isFile()
61
- {
62
- return $this->current()->isFile();
63
- }
64
-
65
- public function getSize()
66
- {
67
- return $this->current()->getSize();
68
- }
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php DELETED
@@ -1,183 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Iterator;
13
-
14
- use Symfony\Component\Finder\Iterator\SortableIterator;
15
-
16
- class SortableIteratorTest extends RealIteratorTestCase
17
- {
18
- public function testConstructor()
19
- {
20
- try {
21
- new SortableIterator(new Iterator(array()), 'foobar');
22
- $this->fail('__construct() throws an \InvalidArgumentException exception if the mode is not valid');
23
- } catch (\Exception $e) {
24
- $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid');
25
- }
26
- }
27
-
28
- /**
29
- * @dataProvider getAcceptData
30
- */
31
- public function testAccept($mode, $expected)
32
- {
33
- if (!is_callable($mode)) {
34
- switch ($mode) {
35
- case SortableIterator::SORT_BY_ACCESSED_TIME :
36
- if ('\\' === DIRECTORY_SEPARATOR) {
37
- touch(self::toAbsolute('.git'));
38
- } else {
39
- file_get_contents(self::toAbsolute('.git'));
40
- }
41
- sleep(1);
42
- file_get_contents(self::toAbsolute('.bar'));
43
- break;
44
- case SortableIterator::SORT_BY_CHANGED_TIME :
45
- file_put_contents(self::toAbsolute('test.php'), 'foo');
46
- sleep(1);
47
- file_put_contents(self::toAbsolute('test.py'), 'foo');
48
- break;
49
- case SortableIterator::SORT_BY_MODIFIED_TIME :
50
- file_put_contents(self::toAbsolute('test.php'), 'foo');
51
- sleep(1);
52
- file_put_contents(self::toAbsolute('test.py'), 'foo');
53
- break;
54
- }
55
- }
56
-
57
- $inner = new Iterator(self::$files);
58
-
59
- $iterator = new SortableIterator($inner, $mode);
60
-
61
- if ($mode === SortableIterator::SORT_BY_ACCESSED_TIME
62
- || $mode === SortableIterator::SORT_BY_CHANGED_TIME
63
- || $mode === SortableIterator::SORT_BY_MODIFIED_TIME
64
- ) {
65
- if ('\\' === DIRECTORY_SEPARATOR && SortableIterator::SORT_BY_MODIFIED_TIME !== $mode) {
66
- $this->markTestSkipped('Sorting by atime or ctime is not supported on Windows');
67
- }
68
- $this->assertOrderedIteratorForGroups($expected, $iterator);
69
- } else {
70
- $this->assertOrderedIterator($expected, $iterator);
71
- }
72
- }
73
-
74
- public function getAcceptData()
75
- {
76
- $sortByName = array(
77
- '.bar',
78
- '.foo',
79
- '.foo/.bar',
80
- '.foo/bar',
81
- '.git',
82
- 'foo',
83
- 'foo bar',
84
- 'foo/bar.tmp',
85
- 'test.php',
86
- 'test.py',
87
- 'toto',
88
- 'toto/.git',
89
- );
90
-
91
- $sortByType = array(
92
- '.foo',
93
- '.git',
94
- 'foo',
95
- 'toto',
96
- 'toto/.git',
97
- '.bar',
98
- '.foo/.bar',
99
- '.foo/bar',
100
- 'foo bar',
101
- 'foo/bar.tmp',
102
- 'test.php',
103
- 'test.py',
104
- );
105
-
106
- $customComparison = array(
107
- '.bar',
108
- '.foo',
109
- '.foo/.bar',
110
- '.foo/bar',
111
- '.git',
112
- 'foo',
113
- 'foo bar',
114
- 'foo/bar.tmp',
115
- 'test.php',
116
- 'test.py',
117
- 'toto',
118
- 'toto/.git',
119
- );
120
-
121
- $sortByAccessedTime = array(
122
- // For these two files the access time was set to 2005-10-15
123
- array('foo/bar.tmp', 'test.php'),
124
- // These files were created more or less at the same time
125
- array(
126
- '.git',
127
- '.foo',
128
- '.foo/.bar',
129
- '.foo/bar',
130
- 'test.py',
131
- 'foo',
132
- 'toto',
133
- 'toto/.git',
134
- 'foo bar',
135
- ),
136
- // This file was accessed after sleeping for 1 sec
137
- array('.bar'),
138
- );
139
-
140
- $sortByChangedTime = array(
141
- array(
142
- '.git',
143
- '.foo',
144
- '.foo/.bar',
145
- '.foo/bar',
146
- '.bar',
147
- 'foo',
148
- 'foo/bar.tmp',
149
- 'toto',
150
- 'toto/.git',
151
- 'foo bar',
152
- ),
153
- array('test.php'),
154
- array('test.py'),
155
- );
156
-
157
- $sortByModifiedTime = array(
158
- array(
159
- '.git',
160
- '.foo',
161
- '.foo/.bar',
162
- '.foo/bar',
163
- '.bar',
164
- 'foo',
165
- 'foo/bar.tmp',
166
- 'toto',
167
- 'toto/.git',
168
- 'foo bar',
169
- ),
170
- array('test.php'),
171
- array('test.py'),
172
- );
173
-
174
- return array(
175
- array(SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)),
176
- array(SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)),
177
- array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)),
178
- array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)),
179
- array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)),
180
- array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)),
181
- );
182
- }
183
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/PhpFinderTest.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests;
13
-
14
- use Symfony\Component\Finder\Adapter\PhpAdapter;
15
- use Symfony\Component\Finder\Finder;
16
-
17
- /**
18
- * @group legacy
19
- */
20
- class PhpFinderTest extends FinderTest
21
- {
22
- public function testImplementationsAreSynchronized()
23
- {
24
- $adapterReflector = new \ReflectionMethod('Symfony\Component\Finder\Adapter\PhpAdapter', 'searchInDirectory');
25
- $finderReflector = new \ReflectionMethod('Symfony\Component\Finder\Finder', 'searchInDirectory');
26
-
27
- $adapterSource = array_slice(file($adapterReflector->getFileName()), $adapterReflector->getStartLine() + 1, $adapterReflector->getEndLine() - $adapterReflector->getStartLine() - 1);
28
- $adapterSource = implode('', $adapterSource);
29
- $adapterSource = str_replace(array('$this->minDepth', '$this->maxDepth'), array('$minDepth', '$maxDepth'), $adapterSource);
30
-
31
- $finderSource = array_slice(file($finderReflector->getFileName()), $finderReflector->getStartLine() + 1, $finderReflector->getEndLine() - $finderReflector->getStartLine() - 1);
32
- $finderSource = implode('', $finderSource);
33
-
34
- $this->assertStringEndsWith($adapterSource, $finderSource);
35
- }
36
-
37
- protected function buildFinder()
38
- {
39
- $adapter = new PhpAdapter();
40
-
41
- return Finder::create()
42
- ->removeAdapters()
43
- ->addAdapter($adapter);
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/finder/Tests/Shell/CommandTest.php DELETED
@@ -1,165 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Finder\Tests\Shell;
13
-
14
- use Symfony\Component\Finder\Shell\Command;
15
-
16
- /**
17
- * @group legacy
18
- */
19
- class CommandTest extends \PHPUnit_Framework_TestCase
20
- {
21
- public function testCreate()
22
- {
23
- $this->assertInstanceOf('Symfony\Component\Finder\Shell\Command', Command::create());
24
- }
25
-
26
- public function testAdd()
27
- {
28
- $cmd = Command::create()->add('--force');
29
- $this->assertSame('--force', $cmd->join());
30
- }
31
-
32
- public function testAddAsFirst()
33
- {
34
- $cmd = Command::create()->add('--force');
35
-
36
- $cmd->addAtIndex(Command::create()->add('-F'), 0);
37
- $this->assertSame('-F --force', $cmd->join());
38
- }
39
-
40
- public function testAddAsLast()
41
- {
42
- $cmd = Command::create()->add('--force');
43
-
44
- $cmd->addAtIndex(Command::create()->add('-F'), 1);
45
- $this->assertSame('--force -F', $cmd->join());
46
- }
47
-
48
- public function testAddInBetween()
49
- {
50
- $cmd = Command::create()->add('--force');
51
- $cmd->addAtIndex(Command::create()->add('-F'), 0);
52
-
53
- $cmd->addAtIndex(Command::create()->add('-X'), 1);
54
- $this->assertSame('-F -X --force', $cmd->join());
55
- }
56
-
57
- public function testCount()
58
- {
59
- $cmd = Command::create();
60
- $this->assertSame(0, $cmd->length());
61
-
62
- $cmd->add('--force');
63
- $this->assertSame(1, $cmd->length());
64
-
65
- $cmd->add('--run');
66
- $this->assertSame(2, $cmd->length());
67
- }
68
-
69
- public function testTop()
70
- {
71
- $cmd = Command::create()->add('--force');
72
-
73
- $cmd->top('--run');
74
- $this->assertSame('--run --force', $cmd->join());
75
- }
76
-
77
- public function testTopLabeled()
78
- {
79
- $cmd = Command::create()->add('--force');
80
-
81
- $cmd->top('--run');
82
- $cmd->ins('--something');
83
- $cmd->top('--something');
84
- $this->assertSame('--something --run --force ', $cmd->join());
85
- }
86
-
87
- public function testArg()
88
- {
89
- $cmd = Command::create()->add('--force');
90
-
91
- $cmd->arg('--run');
92
- $this->assertSame('--force '.escapeshellarg('--run'), $cmd->join());
93
- }
94
-
95
- public function testCmd()
96
- {
97
- $cmd = Command::create()->add('--force');
98
-
99
- $cmd->cmd('run');
100
- $this->assertSame('--force run', $cmd->join());
101
- }
102
-
103
- public function testInsDuplicateLabelException()
104
- {
105
- $cmd = Command::create()->add('--force');
106
-
107
- $cmd->ins('label');
108
- $this->setExpectedException('RuntimeException');
109
- $cmd->ins('label');
110
- }
111
-
112
- public function testEnd()
113
- {
114
- $parent = Command::create();
115
- $cmd = Command::create($parent);
116
-
117
- $this->assertSame($parent, $cmd->end());
118
- }
119
-
120
- public function testEndNoParentException()
121
- {
122
- $cmd = Command::create();
123
-
124
- $this->setExpectedException('RuntimeException');
125
- $cmd->end();
126
- }
127
-
128
- public function testGetMissingLabelException()
129
- {
130
- $cmd = Command::create();
131
-
132
- $this->setExpectedException('RuntimeException');
133
- $cmd->get('invalid');
134
- }
135
-
136
- public function testErrorHandler()
137
- {
138
- $cmd = Command::create();
139
- $handler = function () { return 'error-handler'; };
140
- $cmd->setErrorHandler($handler);
141
-
142
- $this->assertSame($handler, $cmd->getErrorHandler());
143
- }
144
-
145
- public function testExecute()
146
- {
147
- $cmd = Command::create();
148
- $cmd->add('php');
149
- $cmd->add('--version');
150
- $result = $cmd->execute();
151
-
152
- $this->assertInternalType('array', $result);
153
- $this->assertNotEmpty($result);
154
- $this->assertRegexp('/PHP|HipHop/', $result[0]);
155
- }
156
-
157
- public function testCastToString()
158
- {
159
- $cmd = Command::create();
160
- $cmd->add('--force');
161
- $cmd->add('--run');
162
-
163
- $this->assertSame('--force --run', (string) $cmd);
164
- }
165
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/process/ExecutableFinder.php CHANGED
@@ -60,7 +60,7 @@ class ExecutableFinder
60
  if (@is_dir($path)) {
61
  $dirs[] = $path;
62
  } else {
63
- if (basename($path) == $name && is_executable($path)) {
64
  return $path;
65
  }
66
  }
@@ -79,7 +79,7 @@ class ExecutableFinder
79
  }
80
  foreach ($suffixes as $suffix) {
81
  foreach ($dirs as $dir) {
82
- if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
83
  return $file;
84
  }
85
  }
60
  if (@is_dir($path)) {
61
  $dirs[] = $path;
62
  } else {
63
+ if (basename($path) == $name && @is_executable($path)) {
64
  return $path;
65
  }
66
  }
79
  }
80
  foreach ($suffixes as $suffix) {
81
  foreach ($dirs as $dir) {
82
+ if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
83
  return $file;
84
  }
85
  }
vendor/symfony/process/Pipes/AbstractPipes.php CHANGED
@@ -134,9 +134,7 @@ abstract class AbstractPipes implements PipesInterface
134
  if (null === $this->input && !isset($this->inputBuffer[0])) {
135
  fclose($this->pipes[0]);
136
  unset($this->pipes[0]);
137
- }
138
-
139
- if (!$w) {
140
  return array($this->pipes[0]);
141
  }
142
  }
134
  if (null === $this->input && !isset($this->inputBuffer[0])) {
135
  fclose($this->pipes[0]);
136
  unset($this->pipes[0]);
137
+ } elseif (!$w) {
 
 
138
  return array($this->pipes[0]);
139
  }
140
  }
vendor/symfony/process/Pipes/UnixPipes.php CHANGED
@@ -120,7 +120,7 @@ class UnixPipes extends AbstractPipes
120
  do {
121
  $data = fread($pipe, self::CHUNK_SIZE);
122
  $read[$type] .= $data;
123
- } while (isset($data[0]));
124
 
125
  if (!isset($read[$type][0])) {
126
  unset($read[$type]);
120
  do {
121
  $data = fread($pipe, self::CHUNK_SIZE);
122
  $read[$type] .= $data;
123
+ } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
124
 
125
  if (!isset($read[$type][0])) {
126
  unset($read[$type]);
vendor/symfony/process/Pipes/WindowsPipes.php CHANGED
@@ -51,9 +51,10 @@ class WindowsPipes extends AbstractPipes
51
  Process::STDOUT => Process::OUT,
52
  Process::STDERR => Process::ERR,
53
  );
 
54
  $tmpDir = sys_get_temp_dir();
55
- $error = 'unknown reason';
56
- set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
57
  for ($i = 0;; ++$i) {
58
  foreach ($pipes as $pipe => $name) {
59
  $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
@@ -61,7 +62,11 @@ class WindowsPipes extends AbstractPipes
61
  continue 2;
62
  }
63
  $h = fopen($file, 'xb');
64
- if (!$h && false === strpos($error, 'File exists')) {
 
 
 
 
65
  restore_error_handler();
66
  throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
67
  }
51
  Process::STDOUT => Process::OUT,
52
  Process::STDERR => Process::ERR,
53
  );
54
+ $tmpCheck = false;
55
  $tmpDir = sys_get_temp_dir();
56
+ $lastError = 'unknown reason';
57
+ set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
58
  for ($i = 0;; ++$i) {
59
  foreach ($pipes as $pipe => $name) {
60
  $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
62
  continue 2;
63
  }
64
  $h = fopen($file, 'xb');
65
+ if (!$h) {
66
+ $error = $lastError;
67
+ if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
68
+ continue;
69
+ }
70
  restore_error_handler();
71
  throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
72
  }
vendor/symfony/process/Tests/ProcessTest.php CHANGED
@@ -943,7 +943,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
943
 
944
  /**
945
  * @dataProvider provideMethodsThatNeedATerminatedProcess
946
- * @expectedException Symfony\Component\Process\Exception\LogicException
947
  * @expectedExceptionMessage Process must be terminated before calling
948
  */
949
  public function testMethodsThatNeedATerminatedProcess($method)
943
 
944
  /**
945
  * @dataProvider provideMethodsThatNeedATerminatedProcess
946
+ * @expectedException \Symfony\Component\Process\Exception\LogicException
947
  * @expectedExceptionMessage Process must be terminated before calling
948
  */
949
  public function testMethodsThatNeedATerminatedProcess($method)