aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-12-13 19:21:29 -0600
committerNathan Guse <nathaniel.guse@gmail.com>2012-12-13 19:21:29 -0600
commitd64eb0e5756d54291ac33b6bbbd15a25cd7e35c4 (patch)
tree89750abd5dd769d887bf9f95a38cc05a51e47770 /phpBB/includes/functions.php
parent8e6f9b38fb14cc81ba428fd8a74d23077bb63863 (diff)
parentb5142296b182a4bf0d552aac565d90aa0befd07a (diff)
downloadforums-d64eb0e5756d54291ac33b6bbbd15a25cd7e35c4.tar
forums-d64eb0e5756d54291ac33b6bbbd15a25cd7e35c4.tar.gz
forums-d64eb0e5756d54291ac33b6bbbd15a25cd7e35c4.tar.bz2
forums-d64eb0e5756d54291ac33b6bbbd15a25cd7e35c4.tar.xz
forums-d64eb0e5756d54291ac33b6bbbd15a25cd7e35c4.zip
Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/11103
# By Oleg Pudeyev (21) and others # Via Andreas Fischer (7) and others * 'develop' of github.com:phpbb/phpbb3: (56 commits) [ticket/11015] Move comment in the right place. [ticket/11015] Correctly transform 'mysqli' etc. in phpbb_convert_30_dbms_to_31 [ticket/11015] Fix 3.0 to 3.1 dbms conversion for mysqli. [ticket/11015] Change permission adding in database updater to new style. [ticket/11015] Change more docblocks to phpbb_db_driver. [ticket/11015] Installer still needs 3.0-style dbms name. [ticket/11262] Add .lock in cache directory to .gitignore [ticket/11015] Include functions.php because it is not always included. [ticket/11265] Add assertions for board installation success. [ticket/11263] Fix PHP Notice: Undefined variable: extension_manager [ticket/11015] Convert database drivers to new spelling in post setup sync. [ticket/11015] Convert connect test to the new syntax. [ticket/11015] Restore whitespace to avoid conflict when merging develop. [ticket/10975] Add a test for viewing a profile. [ticket/10975] Test restricting by first character. [ticket/10975] Avoid rewriting global config twice. [ticket/10975] Test memberlist, not user creation. [ticket/10975] Some quick tests to check the memberlist behaviour [ticket/10491] Make recreate_database static. [ticket/11088] Pass required objects in as arguments ... Conflicts: phpBB/install/database_update.php
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 9b284c5ca9..ebfcf20523 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -5628,6 +5628,52 @@ function phpbb_to_numeric($input)
}
/**
+* Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name.
+*
+* If $dbms is a valid 3.1 db driver class name, returns it unchanged.
+* Otherwise prepends phpbb_db_driver_ to the dbms to convert a 3.0 dbms
+* to 3.1 db driver class name.
+*
+* @param string $dbms dbms parameter
+* @return db driver class
+*/
+function phpbb_convert_30_dbms_to_31($dbms)
+{
+ // Note: this check is done first because mysqli extension
+ // supplies a mysqli class, and class_exists($dbms) would return
+ // true for mysqli class.
+ // However, per the docblock any valid 3.1 driver name should be
+ // recognized by this function, and have priority over 3.0 dbms.
+ if (class_exists('phpbb_db_driver_' . $dbms))
+ {
+ return 'phpbb_db_driver_' . $dbms;
+ }
+
+ if (class_exists($dbms))
+ {
+ // Additionally we could check that $dbms extends phpbb_db_driver.
+ // http://php.net/manual/en/class.reflectionclass.php
+ // Beware of possible performance issues:
+ // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
+ // We could check for interface implementation in all paths or
+ // only when we do not prepend phpbb_db_driver_.
+
+ /*
+ $reflection = new \ReflectionClass($dbms);
+
+ if ($reflection->isSubclassOf('phpbb_db_driver'))
+ {
+ return $dbms;
+ }
+ */
+
+ return $dbms;
+ }
+
+ throw new \RuntimeException("You have specified an invalid dbms driver: $dbms");
+}
+
+/**
* Create a Symfony Request object from phpbb_request object
*
* @param phpbb_request $request Request object