* Automatically selects MySQL if SQLite is not available

* Improved packaging scripts
* Corrected magic_quotes_gpc in .htaccess; this is now handled by Flakes via PHP code
* BASEURI problems corrected
This commit is contained in:
Jérôme Schneider 2012-11-07 16:26:38 +01:00
parent 1c43e960c4
commit afb10b8ae3
7 changed files with 30 additions and 13 deletions

View file

@ -42,7 +42,7 @@ class Tools {
die('Baikal Fatal Error: PDO is unavailable. It\'s required by Baikal.');
}
# Asserting PDO::SQLite
# Asserting PDO::SQLite or PDO::MySQL
$aPDODrivers = \PDO::getAvailableDrivers();
if(!in_array('sqlite', $aPDODrivers) && !in_array('mysql', $aPDODrivers)) {
die('<strong>Baikal Fatal Error</strong>: Both <strong>PDO::sqlite</strong> and <strong>PDO::mysql</strong> are unavailable. One of them at least is required by Baikal.');
@ -62,7 +62,7 @@ class Tools {
# DB connexion has not been asserted earlier by Flake, to give us a chance to trigger the install tool
# We assert it right now
if(!\Flake\Framework::isDBInitialized()) {
if(!\Flake\Framework::isDBInitialized() && (!defined("BAIKAL_CONTEXT_INSTALL") || BAIKAL_CONTEXT_INSTALL === FALSE)) {
throw new \Exception("<strong>Fatal error</strong>: no connection to a database is available.");
}

View file

@ -15,6 +15,8 @@ TEMPDIRDEREFERENCE="/tmp/baikal-flat-$TEMPDATE"
# Export Project
# Requires the git-archive-all script by https://github.com/Kentzo (https://github.com/Kentzo/git-archive-all)
rm -rf /tmp/baikal-flat
mkdir $TEMPDIR && \
git-archive-all --force-submodules $TEMPARCHIVE && \
cd $TEMPDIR && tar -xzf $TEMPARCHIVE && rm $TEMPARCHIVE && \
@ -57,5 +59,11 @@ mv Core/Distrib2.php Core/Distrib.php && \
mkdir -p Specific/db && \
cp Core/Resources/Db/SQLite/db.sqlite Specific/db && \
# Zipping package
cd .. && \
mv $TEMPDIR baikal-flat && \
zip -r baikal-flat.zip baikal-flat && \
mv baikal-flat.zip ~/Desktop/ && \
# Displaying result
echo "# "$TEMPDIR
echo "# Success: ~/Desktop/baikal-flat.zip"

View file

@ -11,6 +11,8 @@ TEMPDATE="`date +%Y-%m-%d-%H-%M-%S`"
TEMPDIR="/tmp/baikal-regular-$TEMPDATE"
TEMPARCHIVE="$TEMPDIR/temparchive.tgz"
rm -rf /tmp/baikal-regular
# Export Project
# Requires the git-archive-all script by https://github.com/Kentzo (https://github.com/Kentzo/git-archive-all)
mkdir $TEMPDIR && \
@ -28,5 +30,11 @@ rm -Rf Core/Frameworks/Baikal/Scripts && \
mkdir -p Specific/db && \
cp Core/Resources/Db/SQLite/db.sqlite Specific/db && \
# GZipping package
cd .. && \
mv $TEMPDIR baikal-regular && \
tar -cvzf baikal-regular.tgz baikal-regular && \
mv baikal-regular.tgz ~/Desktop/ && \
# Displaying result
echo "# "$TEMPDIR
echo "# Success: ~/Desktop/baikal-regular.tgz"

View file

@ -54,6 +54,13 @@ class Initialize extends \Flake\Core\Controller {
# Creating system config, and initializing BAIKAL_ENCRYPTION_KEY
$oSystemConfig = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php");
$oSystemConfig->set("BAIKAL_ENCRYPTION_KEY", md5(microtime() . rand()));
# Default: PDO::SQLite or PDO::MySQL ?
$aPDODrivers = \PDO::getAvailableDrivers();
if(!in_array('sqlite', $aPDODrivers)) { # PDO::MySQL is already asserted in \Baikal\Core\Tools::assertEnvironmentIsOk()
$oSystemConfig->set("PROJECT_DB_MYSQL", TRUE);
}
$oSystemConfig->persist();
# Using default PROJECT_SQLITE_FILE

@ -1 +1 @@
Subproject commit 21656a372814b467903b67c8519c3dcc0ed220f3
Subproject commit dac4a4827cba85cdb53ad32cecb4b099da0524a4

View file

@ -13,7 +13,4 @@
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
# Disabling PHP Magic quotes, we handle this ourself
php_flag magic_quotes_gpc Off
</IfModule>

View file

@ -13,7 +13,4 @@
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
# Disabling PHP Magic quotes, we handle this ourself
php_flag magic_quotes_gpc Off
</IfModule>