diff options
| author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-07-13 22:47:41 -0700 |
|---|---|---|
| committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-07-13 22:47:41 -0700 |
| commit | 1e37d97909ccf52b08e2a809ea8a9365c824d8de (patch) | |
| tree | a260c846cb47713e72de11cfb9803d981ea6faaf /phpBB/includes/extension/base.php | |
| parent | 4186c05bb4b97374392031a10b796e77b857afaf (diff) | |
| parent | 7030578bbe9e11c18b5becaf8b06e670e3c2e3cd (diff) | |
| download | forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.tar forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.tar.gz forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.tar.bz2 forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.tar.xz forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.zip | |
Merge pull request #1559 from naderman/ticket/11698
[WIP][ticket/11698] Moving all autoloadable files to phpbb/
Diffstat (limited to 'phpBB/includes/extension/base.php')
| -rw-r--r-- | phpBB/includes/extension/base.php | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/phpBB/includes/extension/base.php b/phpBB/includes/extension/base.php deleted file mode 100644 index c4462b64d8..0000000000 --- a/phpBB/includes/extension/base.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php -/** -* -* @package extension -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** -* A base class for extensions without custom enable/disable/purge code. -* -* @package extension -*/ -class phpbb_extension_base implements phpbb_extension_interface -{ - /** @var ContainerInterface */ - protected $container; - - /** @var phpbb_extension_finder */ - protected $finder; - - /** @var phpbb_db_migrator */ - protected $migrator; - - /** @var string */ - protected $extension_name; - - /** @var string */ - protected $extension_path; - - /** - * Constructor - * - * @param ContainerInterface $container Container object - * @param phpbb_extension_finder $extension_finder - * @param string $extension_name Name of this extension (from ext.manager) - * @param string $extension_path Relative path to this extension - */ - public function __construct(ContainerInterface $container, phpbb_extension_finder $extension_finder, phpbb_db_migrator $migrator, $extension_name, $extension_path) - { - $this->container = $container; - $this->extension_finder = $extension_finder; - $this->migrator = $migrator; - - $this->extension_name = $extension_name; - $this->extension_path = $extension_path; - } - - /** - * Single enable step that installs any included migrations - * - * @param mixed $old_state State returned by previous call of this method - * @return false Indicates no further steps are required - */ - public function enable_step($old_state) - { - $migrations = $this->get_migration_file_list(); - - $this->migrator->set_migrations($migrations); - - $this->migrator->update(); - - return !$this->migrator->finished(); - } - - /** - * Single disable step that does nothing - * - * @param mixed $old_state State returned by previous call of this method - * @return false Indicates no further steps are required - */ - public function disable_step($old_state) - { - return false; - } - - /** - * Single purge step that reverts any included and installed migrations - * - * @param mixed $old_state State returned by previous call of this method - * @return false Indicates no further steps are required - */ - public function purge_step($old_state) - { - $migrations = $this->get_migration_file_list(); - - $this->migrator->set_migrations($migrations); - - foreach ($migrations as $migration) - { - while ($this->migrator->migration_state($migration) !== false) - { - $this->migrator->revert($migration); - - return true; - } - } - - return false; - } - - /** - * Get the list of migration files from this extension - * - * @return array - */ - protected function get_migration_file_list() - { - static $migrations = false; - - if ($migrations !== false) - { - return $migrations; - } - - // Only have the finder search in this extension path directory - $migrations = $this->extension_finder - ->extension_directory('/migrations') - ->find_from_extension($this->extension_name, $this->extension_path); - $migrations = $this->extension_finder->get_classes_from_files($migrations); - - return $migrations; - } -} |
