move config file to data

This commit is contained in:
Shish 2012-03-30 18:03:55 +01:00
parent bf39c8f09f
commit fd094050fc
9 changed files with 18 additions and 16 deletions

1
.gitignore vendored
View file

@ -1,6 +1,5 @@
.svn .svn
backup backup
config.php
data data
images images
imgdump-*.zip imgdump-*.zip

View file

@ -42,6 +42,8 @@ Installation
Upgrade from 2.3.X Upgrade from 2.3.X
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
config.php has been moved from /config.php to /data/config/shimmie.conf.php
The database connection setting in config.php has changed; now using The database connection setting in config.php has changed; now using
PDO DSN format rather than ADODB URI: PDO DSN format rather than ADODB URI:

View file

@ -103,7 +103,7 @@ class Update extends Extension {
reset($objects); reset($objects);
$html .= "<br>data folder emptied!"; $html .= "<br>data folder emptied!";
} }
copy ("./config.php", "./backup/config.php");//Although this stays the same, will keep backup just incase. copy ("./data/config/shimmie.conf.php", "./backup/shimmie.conf.php");//Although this stays the same, will keep backup just incase.
$folders = array("./core", "./lib", "./themes", "./.htaccess", "./doxygen.conf", "./index.php", "./install.php", "./ext", "./contrib"); $folders = array("./core", "./lib", "./themes", "./.htaccess", "./doxygen.conf", "./index.php", "./install.php", "./ext", "./contrib");
foreach($folders as $folder){ foreach($folders as $folder){
//TODO: Check MD5 of each file, don't rename if same. //TODO: Check MD5 of each file, don't rename if same.

View file

@ -273,7 +273,7 @@ class Database {
/** /**
* Create a new database object using connection info * Create a new database object using connection info
* stored in config.php in the root shimmie folder * stored in the config file
*/ */
public function Database() { public function Database() {
# FIXME: detect ADODB URI, automatically translate PDO DSN # FIXME: detect ADODB URI, automatically translate PDO DSN

View file

@ -2,7 +2,7 @@
/** /**
* These are the default configuration options for Shimmie. * These are the default configuration options for Shimmie.
* *
* All of these can be over-ridden by placing a 'define' in config.php * All of these can be over-ridden by placing a 'define' in data/config/shimmie.conf.php
* *
* Do NOT change them in this file. These are the defaults only! * Do NOT change them in this file. These are the defaults only!
* *

View file

@ -40,7 +40,7 @@ class UserClass {
// object = image / user / tag / setting // object = image / user / tag / setting
new UserClass("base", null, array( new UserClass("base", null, array(
"change_setting" => False, # modify web-level settings, eg the config table "change_setting" => False, # modify web-level settings, eg the config table
"override_config" => False, # modify sys-level settings, eg config.php "override_config" => False, # modify sys-level settings, eg shimmie.conf.php
"big_search" => False, # search for more than 3 tags at once (speed mode only) "big_search" => False, # search for more than 3 tags at once (speed mode only)
"manage_extension_list" => False, "manage_extension_list" => False,

View file

@ -640,11 +640,11 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a # excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag. # subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = config.php \ EXCLUDE = install.php \
install.php \
phpinfo.php \ phpinfo.php \
contrib/simpletest/simpletest \ contrib/simpletest/simpletest \
lib \ lib \
data \
images \ images \
thumbs \ thumbs \
.git \ .git \

View file

@ -43,11 +43,11 @@
* Each of these can be imported at the start of a function with eg "global $page, $user;" * Each of these can be imported at the start of a function with eg "global $page, $user;"
*/ */
if(!file_exists("config.php")) { if(!file_exists("data/config/shimmie.conf.php")) {
header("Location: install.php"); header("Location: install.php");
exit; exit;
} }
require_once "config.php"; require_once "data/config/shimmie.conf.php";
require_once "core/default_config.inc.php"; require_once "core/default_config.inc.php";
require_once "core/util.inc.php"; require_once "core/util.inc.php";
require_once "lib/context.php"; require_once "lib/context.php";

View file

@ -64,13 +64,13 @@ require_once __SHIMMIE_ROOT__."core/database.class.php";
* This file lets anyone destroy the database -- disable it * This file lets anyone destroy the database -- disable it
* as soon as the admin is done installing for the first time * as soon as the admin is done installing for the first time
*/ */
if(is_readable("config.php")) { if(is_readable("data/config/shimmie.conf.php")) {
session_start(); session_start();
echo '<div id="iblock">'; echo '<div id="iblock">';
echo '<h1>Shimmie Repair Console</h1>'; echo '<h1>Shimmie Repair Console</h1>';
// Load the config // Load the config
require_once __SHIMMIE_ROOT__."config.php"; // Load user/site specifics First require_once __SHIMMIE_ROOT__."data/config/shimmie.conf.php"; // Load user/site specifics First
require_once __SHIMMIE_ROOT__."core/default_config.inc.php"; // Defaults for the rest. require_once __SHIMMIE_ROOT__."core/default_config.inc.php"; // Defaults for the rest.
if( if(
@ -120,7 +120,7 @@ if(is_readable("config.php")) {
else { else {
echo " echo "
<h3>Login</h3> <h3>Login</h3>
<p>Enter the database DSN exactly as in config.php (ie, as originally installed) to access advanced recovery tools:</p> <p>Enter the database DSN exactly as in shimmie.conf.php (ie, as originally installed) to access advanced recovery tools:</p>
<form action='install.php' method='POST'> <form action='install.php' method='POST'>
<center> <center>
@ -403,14 +403,15 @@ function write_config() { // {{{
"define('DATABASE_DSN', '".DATABASE_DSN."');\n" . "define('DATABASE_DSN', '".DATABASE_DSN."');\n" .
'?' . '>'; '?' . '>';
if(is_writable("./") && file_put_contents("config.php", $file_content)) { if(!file_exists("data/config")) {
assert(file_exists("config.php")); mkdir("data/config", 0755, true);
} }
else {
if(!file_put_contents("data/config/shimmie.conf.php", $file_content)) {
$h_file_content = htmlentities($file_content); $h_file_content = htmlentities($file_content);
print <<<EOD print <<<EOD
The web server isn't allowed to write to the config file; please copy The web server isn't allowed to write to the config file; please copy
the text below, save it as 'config.php', and upload it into the shimmie the text below, save it as 'data/config/shimmie.conf.php', and upload it into the shimmie
folder manually. Make sure that when you save it, there is no whitespace folder manually. Make sure that when you save it, there is no whitespace
before the "&lt;?php" or after the "?&gt;" before the "&lt;?php" or after the "?&gt;"