aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/routing
diff options
context:
space:
mode:
authorMate Bartus <mate.bartus@gmail.com>2015-07-24 09:20:50 +0200
committerMate Bartus <mate.bartus@gmail.com>2015-10-17 23:05:57 +0200
commit8f5a0ad6f73e7b7757b02c827436384c96069b5a (patch)
tree87a16ddaa2f645d62728f0b4543199e43995bfeb /phpBB/phpbb/routing
parentf1047ac854baba4d1015cd9a555a523b3860f2c9 (diff)
downloadforums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar
forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.gz
forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.bz2
forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.xz
forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.zip
[ticket/14039] Revamp updater
PHPBB3-14039
Diffstat (limited to 'phpBB/phpbb/routing')
-rw-r--r--phpBB/phpbb/routing/resources_locator/installer_resources_locator.php78
1 files changed, 78 insertions, 0 deletions
diff --git a/phpBB/phpbb/routing/resources_locator/installer_resources_locator.php b/phpBB/phpbb/routing/resources_locator/installer_resources_locator.php
new file mode 100644
index 0000000000..42cd0f11af
--- /dev/null
+++ b/phpBB/phpbb/routing/resources_locator/installer_resources_locator.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\routing\resources_locator;
+
+use phpbb\filesystem\filesystem_interface;
+
+/**
+ * Locates the yaml routing resources taking update directories into consideration
+ */
+class installer_resources_locator implements resources_locator_interface
+{
+ /**
+ * phpBB's filesystem handler
+ *
+ * @var filesystem_interface
+ */
+ protected $filesystem;
+
+ /**
+ * phpBB root path
+ *
+ * @var string
+ */
+ protected $phpbb_root_path;
+
+ /**
+ * Name of the current environment
+ *
+ * @var string
+ */
+ protected $environment;
+
+ /**
+ * Construct method
+ *
+ * @param filesystem_interface $filesystem phpBB's filesystem handler
+ * @param string $phpbb_root_path phpBB root path
+ * @param string $environment Name of the current environment
+ */
+ public function __construct(filesystem_interface $filesystem, $phpbb_root_path, $environment)
+ {
+ $this->filesystem = $filesystem;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->environment = $environment;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function locate_resources()
+ {
+ if ($this->filesystem->exists($this->phpbb_root_path . 'install/update/new/config'))
+ {
+ $resources = array(
+ array('install/update/new/config/' . $this->environment . '/routing/environment.yml', 'yaml')
+ );
+ }
+ else
+ {
+ $resources = array(
+ array('config/' . $this->environment . '/routing/environment.yml', 'yaml')
+ );
+ }
+
+ return $resources;
+ }
+}