From d1719f334a03e88cddade61b24edfec9fb59bbfc Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 7 Oct 2010 17:47:23 -0400 Subject: [PATCH] Use Horde_Core_Factory_Vfs directly --- agora/lib/Agora.php | 2 +- ansel/faces/img.php | 2 +- ansel/img/download.php | 2 +- ansel/img/full.php | 2 +- ansel/img/index.php | 2 +- ansel/img/mini.php | 2 +- ansel/img/prettythumb.php | 2 +- ansel/img/screen.php | 2 +- ansel/img/thumb.php | 2 +- ansel/lib/Api.php | 2 +- ansel/lib/Application.php | 2 +- ansel/lib/Faces.php | 4 +-- ansel/lib/Faces/Base.php | 10 ++++---- ansel/lib/GalleryMode/Date.php | 2 +- ansel/lib/GalleryMode/Normal.php | 2 +- ansel/lib/Image.php | 30 +++++++++++----------- ansel/scripts/garbage_collection.php | 2 +- folks/lib/Driver.php | 4 +-- framework/Core/lib/Horde/Core/Binder/Vfs.php | 17 ------------ framework/Core/lib/Horde/Core/Factory/Vfs.php | 2 +- framework/Core/lib/Horde/Registry.php | 2 -- framework/Scheduler/lib/Horde/Scheduler.php | 4 +-- horde/services/images/view.php | 2 +- hylax/lib/Storage.php | 2 +- imp/attachment.php | 2 +- imp/lib/Compose.php | 12 ++++----- .../LoginTasks/SystemTask/GarbageCollection.php | 2 +- .../LoginTasks/Task/DeleteAttachmentsMonthly.php | 2 +- trean/lib/Trean.php | 2 +- turba/lib/Form/Contact.php | 2 +- turba/lib/Object.php | 2 +- turba/view.php | 2 +- whups/lib/Driver/sql.php | 4 +-- whups/lib/Ticket.php | 4 +-- whups/lib/Whups.php | 2 +- whups/view.php | 2 +- wicked/lib/Driver.php | 2 +- 37 files changed, 63 insertions(+), 82 deletions(-) delete mode 100644 framework/Core/lib/Horde/Core/Binder/Vfs.php diff --git a/agora/lib/Agora.php b/agora/lib/Agora.php index 23443d9d5..e05a55358 100644 --- a/agora/lib/Agora.php +++ b/agora/lib/Agora.php @@ -227,7 +227,7 @@ class Agora { } try { - return $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + return $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { return PEAR::raiseError($e); } diff --git a/ansel/faces/img.php b/ansel/faces/img.php index 025fd9b53..6bfbaa820 100644 --- a/ansel/faces/img.php +++ b/ansel/faces/img.php @@ -30,7 +30,7 @@ if ($conf['vfs']['src'] == 'sendfile') { // We definitely have an image for the face. try { - $filename = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->readFile( + $filename = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile( Ansel_Faces::getVFSPath($face['image_id']) . 'faces', $face_id . Ansel_Faces::getExtension()); } catch (VFS_Exception $e) { diff --git a/ansel/img/download.php b/ansel/img/download.php index 21333661d..620812d90 100644 --- a/ansel/img/download.php +++ b/ansel/img/download.php @@ -20,7 +20,7 @@ $image->downloadHeaders(); /* Sendfile support. Lighttpd < 1.5 only understands the X-LIGHTTPD-send-file header */ if ($conf['vfs']['src'] == 'sendfile') { - $filename = $injector->getInstance('Horde_Vfs')->getVfs('images')->readFile($image->getVFSPath('full'), $image->getVFSName('full')); + $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('full'), $image->getVFSName('full')); header('Content-Type: ' . $image->getType('full')); header('X-LIGHTTPD-send-file: ' . $filename); header('X-Sendfile: ' . $filename); diff --git a/ansel/img/full.php b/ansel/img/full.php index 1fa89c666..d6b801af2 100644 --- a/ansel/img/full.php +++ b/ansel/img/full.php @@ -19,7 +19,7 @@ if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ) || !$galle /* Sendfile support. Lighttpd < 1.5 only understands the X-LIGHTTPD-send-file header */ if ($conf['vfs']['src'] == 'sendfile') { - $filename = $injector->getInstance('Horde_Vfs')->getVfs('images')->readFile($image->getVFSPath('full'), $image->getVFSName('full')); + $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('full'), $image->getVFSName('full')); header('Content-Type: ' . $image->getType('full')); header('X-LIGHTTPD-send-file: ' . $filename); header('X-Sendfile: ' . $filename); diff --git a/ansel/img/index.php b/ansel/img/index.php index 937c9ee90..451529ce9 100644 --- a/ansel/img/index.php +++ b/ansel/img/index.php @@ -19,7 +19,7 @@ if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) { /* Sendfile support. Lighttpd < 1.5 only understands the X-LIGHTTPD-send-file header */ if ($conf['vfs']['src'] == 'sendfile') { - $filename = $injector->getInstance('Horde_Vfs')->getVfs('images')->readFile($image->getVFSPath('screen'), $image->getVFSName('screen')); + $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('screen'), $image->getVFSName('screen')); header('Content-Type: ' . $image->getType('screen')); header('X-LIGHTTPD-send-file: ' . $filename); header('X-Sendfile: ' . $filename); diff --git a/ansel/img/mini.php b/ansel/img/mini.php index a74a41b06..951579515 100644 --- a/ansel/img/mini.php +++ b/ansel/img/mini.php @@ -26,7 +26,7 @@ if ($conf['vfs']['src'] == 'sendfile') { Horde::logMessage($e, 'ERR'); exit; } - $filename = $injector->getInstance('Horde_Vfs')->getVfs('images')->readFile($image->getVFSPath('mini'), $image->getVFSName('mini')); + $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('mini'), $image->getVFSName('mini')); header('Content-Type: ' . $image->getType('mini')); header('X-LIGHTTPD-send-file: ' . $filename); header('X-Sendfile: ' . $filename); diff --git a/ansel/img/prettythumb.php b/ansel/img/prettythumb.php index d125a1033..55947e6ea 100644 --- a/ansel/img/prettythumb.php +++ b/ansel/img/prettythumb.php @@ -36,7 +36,7 @@ if ($conf['vfs']['src'] == 'sendfile') { Horde::logMessage($e, 'ERR'); exit; } - $filename = $injector->getInstance('Horde_Vfs')->getVfs('images')->readFile($image->getVFSPath('prettythumb', $style), $image->getVFSName('prettythumb')); + $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('prettythumb', $style), $image->getVFSName('prettythumb')); header('Content-Type: ' . $image->getType('prettythumb')); header('X-LIGHTTPD-send-file: ' . $filename); header('X-Sendfile: ' . $filename); diff --git a/ansel/img/screen.php b/ansel/img/screen.php index 68af698cb..06441ab77 100644 --- a/ansel/img/screen.php +++ b/ansel/img/screen.php @@ -26,7 +26,7 @@ if ($conf['vfs']['src'] == 'sendfile') { Horde::logMessage($result, 'ERR'); exit; } - $filename = $injector->getInstance('Horde_Vfs')->getVfs('images')->readFile($image->getVFSPath('screen'), $image->getVFSName('screen')); + $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('screen'), $image->getVFSName('screen')); header('Content-Type: ' . $image->getType('screen')); header('X-LIGHTTPD-send-file: ' . $filename); header('X-Sendfile: ' . $filename); diff --git a/ansel/img/thumb.php b/ansel/img/thumb.php index ef6c290c7..b18d17832 100644 --- a/ansel/img/thumb.php +++ b/ansel/img/thumb.php @@ -26,7 +26,7 @@ if ($conf['vfs']['src'] == 'sendfile') { Horde::logMessage($result, 'ERR'); exit; } - $filename = $injector->getInstance('Horde_Vfs')->getVfs('images')->readFile($image->getVFSPath('thumb'), $image->getVFSName('thumb')); + $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('thumb'), $image->getVFSName('thumb')); header('Content-Type: ' . $image->getType('thumb')); header('X-LIGHTTPD-send-file: ' . $filename); header('X-Sendfile: ' . $filename); diff --git a/ansel/lib/Api.php b/ansel/lib/Api.php index 985e10ec3..967f80add 100644 --- a/ansel/lib/Api.php +++ b/ansel/lib/Api.php @@ -635,7 +635,7 @@ class Ansel_Api extends Horde_Registry_Api /* Try reading the data */ try { - $data = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->read($image->getVFSPath('full'), $image->getVFSName('full')); + $data = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->read($image->getVFSPath('full'), $image->getVFSName('full')); } catch (VFS_Exception $e) { Horde::logMessage($e->getMessage(), 'ERR'); throw new Ansel_Exception($e->getMessage()); diff --git a/ansel/lib/Application.php b/ansel/lib/Application.php index cd2a30f6f..1ddb85abc 100644 --- a/ansel/lib/Application.php +++ b/ansel/lib/Application.php @@ -81,7 +81,7 @@ class Ansel_Application extends Horde_Registry_Application $GLOBALS['injector']->bindImplementation('Ansel_Config', 'Ansel_Config'); /* Set a logger for the Vfs */ - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->setLogger($GLOBALS['injector']->getInstance('Horde_Log_Logger')); + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->setLogger($GLOBALS['injector']->getInstance('Horde_Log_Logger')); } /** diff --git a/ansel/lib/Faces.php b/ansel/lib/Faces.php index 3f8e098bc..37af5287a 100644 --- a/ansel/lib/Faces.php +++ b/ansel/lib/Faces.php @@ -37,7 +37,7 @@ class Ansel_Faces } try { foreach ($face as $id) { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile($path, $id . $ext); + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->deleteFile($path, $id . $ext); } } catch (VFS_Exception $e) {} $GLOBALS['ansel_db']->exec('DELETE FROM ansel_faces WHERE image_id = ' . $image->id); @@ -45,7 +45,7 @@ class Ansel_Faces $GLOBALS['ansel_db']->exec('UPDATE ansel_shares SET attribute_faces = attribute_faces - ' . count($face) . ' WHERE gallery_id = ' . $image->gallery . ' AND attribute_faces > 0 '); } else { try { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile($path, (int)$face . $ext); + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->deleteFile($path, (int)$face . $ext); } catch (VFS_Exception $e) {} $GLOBALS['ansel_db']->exec('DELETE FROM ansel_faces WHERE face_id = ' . (int)$face); $GLOBALS['ansel_db']->exec('UPDATE ansel_images SET image_faces = image_faces - 1 WHERE image_id = ' . $image->id . ' AND image_faces > 0 '); diff --git a/ansel/lib/Faces/Base.php b/ansel/lib/Faces/Base.php index 5a9f679aa..f288ab22f 100644 --- a/ansel/lib/Faces/Base.php +++ b/ansel/lib/Faces/Base.php @@ -44,7 +44,7 @@ class Ansel_Faces_Base $image->load('screen'); // Make sure we have an on-disk copy of the file. - $file = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->readFile($image->getVFSPath('screen'), + $file = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('screen'), $image->getVFSName('screen')); } else { $file = $image; @@ -347,7 +347,7 @@ class Ansel_Faces_Base { $vfspath = Ansel_Faces::getVFSPath($image_id) . 'faces'; $vfsname = $face_id . Ansel_Faces::getExtension(); - if (!$GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->exists($vfspath, $vfsname)) { + if (!$GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->exists($vfspath, $vfsname)) { if (!$create) { return false; } @@ -389,7 +389,7 @@ class Ansel_Faces_Base $vfsname = $face_id . Ansel_Faces::getExtension(); $img = Ansel::getImageObject(); try { - $data = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->read($vfspath, $vfsname); + $data = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->read($vfspath, $vfsname); } catch (VFS_Exception $e) { throw new Horde_Exception_Prior($e); } @@ -624,7 +624,7 @@ class Ansel_Faces_Base $path = Ansel_Faces::getVFSPath($image->id); $image->getHordeImage()->resize(50, 50, false); try { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->writeData( + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->writeData( $path . 'faces', $face_id . $ext, $image->getHordeImage()->raw(), @@ -654,7 +654,7 @@ class Ansel_Faces_Base } // Ensure we have an on-disk file to read the signature from. - $path = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->readFile( + $path = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile( Ansel_Faces::getVFSPath($image_id) . '/faces', $face_id . Ansel_Faces::getExtension()); diff --git a/ansel/lib/GalleryMode/Date.php b/ansel/lib/GalleryMode/Date.php index 1c732d804..edd92d125 100644 --- a/ansel/lib/GalleryMode/Date.php +++ b/ansel/lib/GalleryMode/Date.php @@ -492,7 +492,7 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base /* Delete original image from VFS. */ try { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile($image->getVFSPath('full'), + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->deleteFile($image->getVFSPath('full'), $image->getVFSName('full')); } catch (VFS_Exception $e) {} diff --git a/ansel/lib/GalleryMode/Normal.php b/ansel/lib/GalleryMode/Normal.php index 6d414447d..4f1093901 100644 --- a/ansel/lib/GalleryMode/Normal.php +++ b/ansel/lib/GalleryMode/Normal.php @@ -211,7 +211,7 @@ class Ansel_GalleryMode_Normal extends Ansel_GalleryMode_Base /* Delete original image from VFS. */ try { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile($image->getVFSPath('full'), $image->getVFSName('full')); + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->deleteFile($image->getVFSPath('full'), $image->getVFSName('full')); } catch (VFS_Exception $e) {} /* Delete from storage */ diff --git a/ansel/lib/Image.php b/ansel/lib/Image.php index e85ac121e..b221c2236 100644 --- a/ansel/lib/Image.php +++ b/ansel/lib/Image.php @@ -299,7 +299,7 @@ class Ansel_Image Implements Iterator /* Read in the requested view. */ try { - $data = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->read($vfspath, $this->getVFSName($view)); + $data = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->read($vfspath, $this->getVFSName($view)); } catch (VFS_Exception $e) { Horde::logMessage($e, 'ERR'); throw new Ansel_Exception($e); @@ -345,7 +345,7 @@ class Ansel_Image Implements Iterator $vfsname .= 'png'; } - if ($GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->exists($vfspath, $vfsname)) { + if ($GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->exists($vfspath, $vfsname)) { return $view . '/' . $vfsname; } else { return false; @@ -370,11 +370,11 @@ class Ansel_Image Implements Iterator /* Get the VFS info. */ $vfspath = $this->getVFSPath($view, $style); - if ($GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->exists($vfspath, $this->getVFSName($view))) { + if ($GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->exists($vfspath, $this->getVFSName($view))) { return true; } try { - $data = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->read($this->getVFSPath('full'), $this->getVFSName('full')); + $data = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->read($this->getVFSPath('full'), $this->getVFSName('full')); } catch (VFS_Exception $e) { Horde::logMessage($e, 'ERR'); throw new Ansel_Exception($e); @@ -415,7 +415,7 @@ class Ansel_Image Implements Iterator /* ...and put it in Horde_Image obejct, then save */ $this->_image->loadString($this->_data[$vHash]); $this->_loaded[$vHash] = true; - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->writeData($vfspath, $this->getVFSName($vHash), $this->_data[$vHash], true); + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->writeData($vfspath, $this->getVFSName($vHash), $this->_data[$vHash], true); /* Autowatermark the screen view */ if ($view == 'screen' && @@ -423,7 +423,7 @@ class Ansel_Image Implements Iterator $GLOBALS['prefs']->getValue('watermark_text') != '') { $this->watermark('screen'); - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->writeData($vfspath, $this->getVFSName($view), $this->_image->_data); + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->writeData($vfspath, $this->getVFSName($view), $this->_image->_data); } return true; @@ -440,7 +440,7 @@ class Ansel_Image Implements Iterator $this->_dirty = false; try { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->writeData( + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->writeData( $this->getVFSPath('full'), $this->getVFSName('full'), $this->_data['full'], true); } catch (VFS_Exception $e) { throw new Ansel_Exception($e); @@ -468,7 +468,7 @@ class Ansel_Image Implements Iterator } try { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->writeData( + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->writeData( $this->getVFSPath($view), $this->getVFSName($view), $data, true); } catch (VFS_Exception $e) { throw new Ansel_Exception($e); @@ -611,7 +611,7 @@ class Ansel_Image Implements Iterator /* Get the data */ try { - $imageFile = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->readFile( + $imageFile = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile( $this->getVFSPath('full'), $this->getVFSName('full')); } catch (VFS_Exception $e) { throw new Ansel_Exception($e); @@ -736,19 +736,19 @@ class Ansel_Image Implements Iterator try { /* Delete cached screen image. (We don't care if the file is not found) */ if ($view == 'all' || $view == 'screen') { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile( + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->deleteFile( $this->getVFSPath('screen'), $this->getVFSName('screen')); } /* Delete cached thumbnail. */ if ($view == 'all' || $view == 'thumb') { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile( + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->deleteFile( $this->getVFSPath('thumb'), $this->getVFSName('thumb')); } /* Delete cached mini image. */ if ($view == 'all' || $view == 'mini') { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile( + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->deleteFile( $this->getVFSPath('mini'), $this->getVFSName('mini')); } @@ -757,8 +757,8 @@ class Ansel_Image Implements Iterator $hashes = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getHashes(); foreach ($hashes as $hash) { - $GLOBALS['injector']->getInstance('Horde_Vfs') - ->getVfs('images') + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs') + ->create('images') ->deleteFile($this->getVFSPath($hash), $this->getVFSName($hash)); } } @@ -825,7 +825,7 @@ class Ansel_Image Implements Iterator } try { - $data = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->read( + $data = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->read( $this->getVFSPath('full'), $this->getVFSName('full')); } catch (VFS_Exception $e) { throw new Ansel_Exception($e); diff --git a/ansel/scripts/garbage_collection.php b/ansel/scripts/garbage_collection.php index 75cea26f2..6c5e2a847 100755 --- a/ansel/scripts/garbage_collection.php +++ b/ansel/scripts/garbage_collection.php @@ -36,7 +36,7 @@ foreach ($opts as $opt) { } } -$vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); +$vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); $vfspath = '.horde/ansel/'; $garbagepath = $vfspath . 'garbage/'; diff --git a/folks/lib/Driver.php b/folks/lib/Driver.php index cb0abdc29..03399d7ee 100644 --- a/folks/lib/Driver.php +++ b/folks/lib/Driver.php @@ -70,7 +70,7 @@ class Folks_Driver { { global $conf; - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images'); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images'); $p = hash('md5', $user); $vfspath = Folks::VFS_PATH . '/' . substr(str_pad($p, 2, 0, STR_PAD_LEFT), -2) . '/'; $vfs_name = $p . '.' . $conf['images']['image_type']; @@ -118,7 +118,7 @@ class Folks_Driver { */ public function deleteImage($user) { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images'); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images'); $p = hash('md5', $user); $vfspath = Folks::VFS_PATH . '/' . substr(str_pad($p, 2, 0, STR_PAD_LEFT), -2) . '/'; $vfs_name = $p . '.' . $GLOBALS['conf']['images']['image_type']; diff --git a/framework/Core/lib/Horde/Core/Binder/Vfs.php b/framework/Core/lib/Horde/Core/Binder/Vfs.php deleted file mode 100644 index 0da26b74d..000000000 --- a/framework/Core/lib/Horde/Core/Binder/Vfs.php +++ /dev/null @@ -1,17 +0,0 @@ -_instances[$scope])) { $params = $this->getConfig($scope); diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 8de506a77..a61b6306e 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -252,8 +252,6 @@ class Horde_Registry $binders = array( 'Horde_Auth_Factory' => new Horde_Core_Binder_AuthFactory(), 'Horde_Core_Auth_Signup' => new Horde_Core_Binder_AuthSignup(), - 'Horde_Template' => new Horde_Core_Binder_Template(), - 'Horde_Vfs' => new Horde_Core_Binder_Vfs(), ); /* Define factories. */ diff --git a/framework/Scheduler/lib/Horde/Scheduler.php b/framework/Scheduler/lib/Horde/Scheduler.php index 57dc0d32c..06d42351c 100644 --- a/framework/Scheduler/lib/Horde/Scheduler.php +++ b/framework/Scheduler/lib/Horde/Scheduler.php @@ -82,7 +82,7 @@ class Horde_Scheduler public function serialize($id = '') { try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); $vfs->writeData('.horde/scheduler', Horde_String::lower(get_class($this)) . $id, serialize($this), true); return true; } catch (VFS_Exception $e) { @@ -111,7 +111,7 @@ class Horde_Scheduler $scheduler = new $class; try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs'); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); $data = $vfs->read('.horde/scheduler', $class . $id); if ($tmp = @unserialize($data)) { $scheduler = $tmp; diff --git a/horde/services/images/view.php b/horde/services/images/view.php index c0a9b04ce..8f61532aa 100644 --- a/horde/services/images/view.php +++ b/horde/services/images/view.php @@ -34,7 +34,7 @@ case 'vfs': /* Getting a file from Horde's VFS. */ $path = Horde_Util::getFormData('p'); try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); $file_data = $vfs->read($path, $file); } catch (VFS_Exception $e) { Horde::logMessage(sprintf('Error displaying image [%s]: %s', $path . '/' . $file, $e->getMessage()), 'ERR'); diff --git a/hylax/lib/Storage.php b/hylax/lib/Storage.php index cba6875e7..370d394da 100644 --- a/hylax/lib/Storage.php +++ b/hylax/lib/Storage.php @@ -33,7 +33,7 @@ class Hylax_Storage { function Hylax_Storage($params) { $this->_params = $params; - $this->_vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $this->_vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } function saveFaxData($data, $type = '.ps') diff --git a/imp/attachment.php b/imp/attachment.php index 791f7c501..c1f06b472 100644 --- a/imp/attachment.php +++ b/imp/attachment.php @@ -34,7 +34,7 @@ if (!$vars->mail_user || !$vars->$time_stamp || !$vars->file_name) { // Initialize the VFS. try { - $vfsroot = $injector->getInstance('Horde_Vfs')->getVfs(); + $vfsroot = $injector->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { throw new IMP_Exception(sprintf(_("Could not create the VFS backend: %s"), $e->getMessage())); } diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 5fb0ee03c..7791741d5 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -2016,7 +2016,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator /* Store in VFS. */ if ($GLOBALS['conf']['compose']['use_vfs']) { try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); $cacheID = strval(new Horde_Support_Randomid()); if ($vfs_file) { @@ -2082,7 +2082,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator switch ($atc['filetype']) { case 'vfs': try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); $atc['part']->setContents($vfs->readFile(self::VFS_ATTACH_PATH, $atc['filename'])); } catch (VFS_Exception $e) {} break; @@ -2361,7 +2361,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $baseurl = Horde::url('attachment.php', true)->setRaw(true); try { - $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { throw new IMP_Compose_Exception($e); } @@ -2666,7 +2666,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator } try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); $vfs->writeData(self::VFS_DRAFTS_PATH, hash('md5', $vars->user), $body, true); $GLOBALS['notification']->push(_("The message you were composing has been saved as a draft. The next time you login, you may resume composing your message.")); @@ -2685,7 +2685,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $filename = hash('md5', $GLOBALS['registry']->getAuth()); try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { return; } @@ -2852,7 +2852,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator case 'vfs': /* Delete from VFS. */ try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); $vfs->deleteFile(self::VFS_ATTACH_PATH, $atc['filename']); } catch (VFS_Exception $e) {} break; diff --git a/imp/lib/LoginTasks/SystemTask/GarbageCollection.php b/imp/lib/LoginTasks/SystemTask/GarbageCollection.php index 89d40f79e..be6868856 100644 --- a/imp/lib/LoginTasks/SystemTask/GarbageCollection.php +++ b/imp/lib/LoginTasks/SystemTask/GarbageCollection.php @@ -35,7 +35,7 @@ class IMP_LoginTasks_SystemTask_GarbageCollection extends Horde_LoginTasks_Syste /* Do garbage collection on compose VFS data. */ if ($GLOBALS['conf']['compose']['use_vfs']) { try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); VFS_GC::gc($vfs, IMP_Compose::VFS_ATTACH_PATH, 86400); } catch (VFS_Exception $e) {} } diff --git a/imp/lib/LoginTasks/Task/DeleteAttachmentsMonthly.php b/imp/lib/LoginTasks/Task/DeleteAttachmentsMonthly.php index 6f6d4ab1a..c4e9fc9d7 100644 --- a/imp/lib/LoginTasks/Task/DeleteAttachmentsMonthly.php +++ b/imp/lib/LoginTasks/Task/DeleteAttachmentsMonthly.php @@ -36,7 +36,7 @@ class IMP_LoginTasks_Task_DeleteAttachmentsMonthly extends Horde_LoginTasks_Task $del_time = gmmktime(0, 0, 0, date('n') - $GLOBALS['prefs']->getValue('delete_attachments_monthly_keep'), 1, date('Y')); try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { return false; } diff --git a/trean/lib/Trean.php b/trean/lib/Trean.php index 074a80726..0589b9282 100644 --- a/trean/lib/Trean.php +++ b/trean/lib/Trean.php @@ -210,7 +210,7 @@ class Trean // Initialize VFS. try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs'); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); if ($bookmark->favicon && $vfs->exists('.horde/trean/favicons/', $bookmark->favicon)) { return Horde_Util::addParameter(Horde::url('favicon.php'), diff --git a/turba/lib/Form/Contact.php b/turba/lib/Form/Contact.php index 18360230e..86418eca0 100644 --- a/turba/lib/Form/Contact.php +++ b/turba/lib/Form/Contact.php @@ -20,7 +20,7 @@ class Turba_Form_Contact extends Horde_Form $this->_addFields($contact, $tabs); /* List files. */ - $v_params = $GLOBALS['injector']->getInstance('Horde_Vfs')->getConfig('documents'); + $v_params = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->getConfig('documents'); if ($v_params['type'] != 'none') { try { $files = $contact->listFiles(); diff --git a/turba/lib/Object.php b/turba/lib/Object.php index 59c808f7b..1023475b6 100644 --- a/turba/lib/Object.php +++ b/turba/lib/Object.php @@ -467,7 +467,7 @@ class Turba_Object { { if (!isset($this->_vfs)) { try { - $this->_vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('documents'); + $this->_vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('documents'); } catch (Horde_Exception $e) { throw new Turba_Exception($e); } diff --git a/turba/view.php b/turba/view.php index 428aa763b..b4db0259e 100644 --- a/turba/view.php +++ b/turba/view.php @@ -37,7 +37,7 @@ if (!$object->hasPermission(Horde_Perms::READ)) { } try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('documents'); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('documents'); } catch (Horde_Exception $e) { throw new Turba_Exception($e); } diff --git a/whups/lib/Driver/sql.php b/whups/lib/Driver/sql.php index ca725d82a..2f0e951dd 100644 --- a/whups/lib/Driver/sql.php +++ b/whups/lib/Driver/sql.php @@ -500,7 +500,7 @@ class Whups_Driver_sql extends Whups_Driver { if (!empty($GLOBALS['conf']['vfs']['type'])) { try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { return PEAR::raiseError($e->getMessage()); } @@ -1219,7 +1219,7 @@ class Whups_Driver_sql extends Whups_Driver { return $attachments; } - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); while ($attachment = $attachments->fetchRow(DB_FETCHMODE_ASSOC)) { $dir = WHUPS_VFS_ATTACH_PATH . '/' . $attachment['ticket_id']; if ($vfs->exists($dir, $attachment['log_value'])) { diff --git a/whups/lib/Ticket.php b/whups/lib/Ticket.php index f0f5e4c00..5b2fd579a 100644 --- a/whups/lib/Ticket.php +++ b/whups/lib/Ticket.php @@ -432,7 +432,7 @@ class Whups_Ticket { } try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { return PEAR::raiseError($e->getMessage()); } @@ -482,7 +482,7 @@ class Whups_Ticket { } try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { return PEAR::raiseError($e->getMessage()); } diff --git a/whups/lib/Whups.php b/whups/lib/Whups.php index c3e8ade3b..568423c13 100644 --- a/whups/lib/Whups.php +++ b/whups/lib/Whups.php @@ -787,7 +787,7 @@ class Whups { } try { - $vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { return PEAR::raiseError($vfs->getMessage()); } diff --git a/whups/view.php b/whups/view.php index 909a9a747..a79d056f7 100644 --- a/whups/view.php +++ b/whups/view.php @@ -38,7 +38,7 @@ if (!count(Whups::permissionsFilter($whups_driver->getHistory($id), 'comment', H } try { - $vfs = $injector->getInstance('Horde_Vfs')->getVfs(); + $vfs = $injector->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (Horde_Exception $e) { throw new Horde_Exception(_("The VFS backend needs to be configured to enable attachment uploads.")); } diff --git a/wicked/lib/Driver.php b/wicked/lib/Driver.php index 67687f999..63bbe1ba3 100644 --- a/wicked/lib/Driver.php +++ b/wicked/lib/Driver.php @@ -60,7 +60,7 @@ class Wicked_Driver { { if (!$this->_vfs) { try { - $this->_vfs = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs(); + $this->_vfs = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create(); } catch (VFS_Exception $e) { return PEAR::raiseError($e->getMessage()); } -- 2.11.0