From fd094050fcb4fbe1f4001b50ffc405e8813edceb Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 30 Mar 2012 18:03:55 +0100 Subject: [PATCH] move config file to data --- .gitignore | 1 - README.txt | 2 ++ contrib/update/main.php | 2 +- core/database.class.php | 2 +- core/default_config.inc.php | 2 +- core/userclass.class.php | 2 +- doxygen.conf | 4 ++-- index.php | 4 ++-- install.php | 15 ++++++++------- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index e88558e9..14b3ad2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .svn backup -config.php data images imgdump-*.zip diff --git a/README.txt b/README.txt index 6429f172..df6d7f26 100644 --- a/README.txt +++ b/README.txt @@ -42,6 +42,8 @@ Installation 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 PDO DSN format rather than ADODB URI: diff --git a/contrib/update/main.php b/contrib/update/main.php index 8e7b2133..90372e42 100644 --- a/contrib/update/main.php +++ b/contrib/update/main.php @@ -103,7 +103,7 @@ class Update extends Extension { reset($objects); $html .= "
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"); foreach($folders as $folder){ //TODO: Check MD5 of each file, don't rename if same. diff --git a/core/database.class.php b/core/database.class.php index 2f63ab1a..fc93269f 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -273,7 +273,7 @@ class Database { /** * 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() { # FIXME: detect ADODB URI, automatically translate PDO DSN diff --git a/core/default_config.inc.php b/core/default_config.inc.php index f2ddfcda..3f6b6e50 100644 --- a/core/default_config.inc.php +++ b/core/default_config.inc.php @@ -2,7 +2,7 @@ /** * 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! * diff --git a/core/userclass.class.php b/core/userclass.class.php index e342040b..5dcf1dd6 100644 --- a/core/userclass.class.php +++ b/core/userclass.class.php @@ -40,7 +40,7 @@ class UserClass { // object = image / user / tag / setting new UserClass("base", null, array( "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) "manage_extension_list" => False, diff --git a/doxygen.conf b/doxygen.conf index c934f615..085ca149 100644 --- a/doxygen.conf +++ b/doxygen.conf @@ -640,11 +640,11 @@ RECURSIVE = YES # 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. -EXCLUDE = config.php \ - install.php \ +EXCLUDE = install.php \ phpinfo.php \ contrib/simpletest/simpletest \ lib \ + data \ images \ thumbs \ .git \ diff --git a/index.php b/index.php index 9895d7c7..3ef60456 100644 --- a/index.php +++ b/index.php @@ -43,11 +43,11 @@ * 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"); exit; } -require_once "config.php"; +require_once "data/config/shimmie.conf.php"; require_once "core/default_config.inc.php"; require_once "core/util.inc.php"; require_once "lib/context.php"; diff --git a/install.php b/install.php index 142fa9f5..795bc5e5 100644 --- a/install.php +++ b/install.php @@ -64,13 +64,13 @@ require_once __SHIMMIE_ROOT__."core/database.class.php"; * This file lets anyone destroy the database -- disable it * 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(); echo '
'; echo '

Shimmie Repair Console

'; // 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. if( @@ -120,7 +120,7 @@ if(is_readable("config.php")) { else { echo "

Login

-

Enter the database DSN exactly as in config.php (ie, as originally installed) to access advanced recovery tools:

+

Enter the database DSN exactly as in shimmie.conf.php (ie, as originally installed) to access advanced recovery tools:

@@ -403,14 +403,15 @@ function write_config() { // {{{ "define('DATABASE_DSN', '".DATABASE_DSN."');\n" . '?' . '>'; - if(is_writable("./") && file_put_contents("config.php", $file_content)) { - assert(file_exists("config.php")); + if(!file_exists("data/config")) { + mkdir("data/config", 0755, true); } - else { + + if(!file_put_contents("data/config/shimmie.conf.php", $file_content)) { $h_file_content = htmlentities($file_content); print <<