1616use \phpbb \config \config ;
1717use \phpbb \db \driver \driver_interface ;
1818use \phpbb \event \dispatcher ;
19- use \phpbb \filesystem \ filesystem ;
19+ use \phpbb \storage \ storage ;
2020
2121/**
2222 * Attachment delete class
@@ -32,14 +32,11 @@ class delete
3232 /** @var dispatcher */
3333 protected $ dispatcher ;
3434
35- /** @var filesystem */
36- protected $ filesystem ;
37-
3835 /** @var resync */
3936 protected $ resync ;
4037
41- /** @var string phpBB root path */
42- protected $ phpbb_root_path ;
38+ /** @var storage */
39+ protected $ storage ;
4340
4441 /** @var array Attachement IDs */
4542 protected $ ids ;
@@ -71,18 +68,15 @@ class delete
7168 * @param config $config
7269 * @param driver_interface $db
7370 * @param dispatcher $dispatcher
74- * @param filesystem $filesystem
7571 * @param resync $resync
76- * @param string $phpbb_root_path
72+ * @param storage $storage
7773 */
78- public function __construct (config $ config , driver_interface $ db , dispatcher $ dispatcher , filesystem $ filesystem , resync $ resync , $ phpbb_root_path )
74+ public function __construct (config $ config , driver_interface $ db , dispatcher $ dispatcher , resync $ resync , $ storage )
7975 {
8076 $ this ->config = $ config ;
8177 $ this ->db = $ db ;
8278 $ this ->dispatcher = $ dispatcher ;
83- $ this ->filesystem = $ filesystem ;
84- $ this ->resync = $ resync ;
85- $ this ->phpbb_root_path = $ phpbb_root_path ;
79+ $ this ->storage = $ storage ;
8680 }
8781
8882 /**
@@ -161,8 +155,8 @@ public function delete($mode, $ids, $resync = true)
161155 return 0 ;
162156 }
163157
164- // Delete attachments from filesystem
165- $ this ->remove_from_filesystem ();
158+ // Delete attachments from storage
159+ $ this ->remove_from_storage ();
166160
167161 // If we do not resync, we do not need to adjust any message, post, topic or user entries
168162 if (!$ resync )
@@ -327,9 +321,9 @@ protected function delete_attachments_from_db()
327321 }
328322
329323 /**
330- * Delete attachments from filesystem
324+ * Delete attachments from storage
331325 */
332- protected function remove_from_filesystem ()
326+ protected function remove_from_storage ()
333327 {
334328 $ space_removed = $ files_removed = 0 ;
335329
@@ -388,7 +382,7 @@ protected function remove_from_filesystem()
388382 }
389383
390384 /**
391- * Delete attachment from filesystem
385+ * Delete attachment from storage
392386 *
393387 * @param string $filename Filename of attachment
394388 * @param string $mode Delete mode
@@ -412,17 +406,16 @@ public function unlink_attachment($filename, $mode = 'file', $entry_removed = fa
412406 }
413407
414408 $ filename = ($ mode == 'thumbnail ' ) ? 'thumb_ ' . utf8_basename ($ filename ) : utf8_basename ($ filename );
415- $ filepath = $ this ->phpbb_root_path . $ this ->config ['upload_path ' ] . '/ ' . $ filename ;
416409
417410 try
418411 {
419- if ($ this ->filesystem ->exists ($ filepath ))
412+ if ($ this ->storage ->exists ($ filename ))
420413 {
421- $ this ->filesystem ->remove ($ this -> phpbb_root_path . $ this -> config [ ' upload_path ' ] . ' / ' . $ filename );
414+ $ this ->storage ->remove ($ filename );
422415 return true ;
423416 }
424417 }
425- catch (\phpbb \filesystem \exception \filesystem_exception $ exception )
418+ catch (\phpbb \storage \exception \exception $ exception )
426419 {
427420 // Fail is covered by return statement below
428421 }
0 commit comments