From aab89e65f810c0fc3123224d6cded390133a76b3 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 2 Aug 2010 10:06:21 +0000 Subject: [PATCH] MINOR Moved project git-svn-id: http://svn.silverstripe.com/projects/ss2doc/branches/v2@108782 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- .gitignore | 4 + .htaccess | 19 + .mergesources.yml | 8 + COPYING | 17 + ChangeLog | 1 + INSTALL | 19 + Makefile | 19 + UPGRADING | 20 + assets/.htaccess | 2 + assets/Uploads/SilverStripeLogo.png | Bin 0 -> 12162 bytes favicon.ico | Bin 0 -> 318 bytes index.php | 63 + install.php | 1250 +++++++++++++++++ mysite/_config.php | 34 + mysite/code/Page.php | 41 + scripts/pull-from-git | 60 + themes/docs/css/DocumentationViewer.css | 130 ++ themes/docs/templates/Includes/Sidebar.ss | 36 + themes/docs/templates/Layout/Page.ss | 11 + themes/docs/templates/Layout/Page_results.ss | 46 + themes/docs/templates/Layout/Security.ss | 6 + themes/docs/templates/Page.ss | 53 + themes/tutorial/css/editor.css | 14 + themes/tutorial/css/form.css | 64 + themes/tutorial/css/layout.css | 287 ++++ themes/tutorial/css/typography.css | 113 ++ themes/tutorial/images/blueback.gif | Bin 0 -> 285 bytes themes/tutorial/images/body_bg.gif | Bin 0 -> 51 bytes themes/tutorial/images/menu1_left.gif | Bin 0 -> 312 bytes themes/tutorial/images/menu1_left_on.gif | Bin 0 -> 446 bytes themes/tutorial/images/menu1_right.gif | Bin 0 -> 1341 bytes themes/tutorial/images/menu1_right_on.gif | Bin 0 -> 1854 bytes themes/tutorial/images/menu2_arrow.gif | Bin 0 -> 117 bytes themes/tutorial/images/ss_logo.gif | Bin 0 -> 556 bytes themes/tutorial/images/ss_watermark.gif | Bin 0 -> 4227 bytes .../tutorial/images/treeicons/home-file.gif | Bin 0 -> 173 bytes .../tutorial/images/treeicons/news-file.gif | Bin 0 -> 176 bytes themes/tutorial/images/welcome.png | Bin 0 -> 19020 bytes themes/tutorial/templates/Page.ss | 27 + web.config | 5 + 40 files changed, 2349 insertions(+) create mode 100644 .gitignore create mode 100644 .htaccess create mode 100644 .mergesources.yml create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile create mode 100644 UPGRADING create mode 100644 assets/.htaccess create mode 100644 assets/Uploads/SilverStripeLogo.png create mode 100644 favicon.ico create mode 100644 index.php create mode 100644 install.php create mode 100644 mysite/_config.php create mode 100755 mysite/code/Page.php create mode 100755 scripts/pull-from-git create mode 100644 themes/docs/css/DocumentationViewer.css create mode 100644 themes/docs/templates/Includes/Sidebar.ss create mode 100644 themes/docs/templates/Layout/Page.ss create mode 100644 themes/docs/templates/Layout/Page_results.ss create mode 100644 themes/docs/templates/Layout/Security.ss create mode 100644 themes/docs/templates/Page.ss create mode 100644 themes/tutorial/css/editor.css create mode 100644 themes/tutorial/css/form.css create mode 100644 themes/tutorial/css/layout.css create mode 100644 themes/tutorial/css/typography.css create mode 100644 themes/tutorial/images/blueback.gif create mode 100644 themes/tutorial/images/body_bg.gif create mode 100644 themes/tutorial/images/menu1_left.gif create mode 100644 themes/tutorial/images/menu1_left_on.gif create mode 100644 themes/tutorial/images/menu1_right.gif create mode 100644 themes/tutorial/images/menu1_right_on.gif create mode 100644 themes/tutorial/images/menu2_arrow.gif create mode 100644 themes/tutorial/images/ss_logo.gif create mode 100644 themes/tutorial/images/ss_watermark.gif create mode 100644 themes/tutorial/images/treeicons/home-file.gif create mode 100644 themes/tutorial/images/treeicons/news-file.gif create mode 100644 themes/tutorial/images/welcome.png create mode 100644 themes/tutorial/templates/Page.ss create mode 100644 web.config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e794c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +sapphire/ +cms/ +src/ +sapphiredocs/ \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..177f473 --- /dev/null +++ b/.htaccess @@ -0,0 +1,19 @@ +### SILVERSTRIPE START ### + + Order deny,allow + Deny from all + Allow from 127.0.0.1 + + + + Order deny,allow + Deny from all + + + + RewriteEngine On + RewriteCond %{REQUEST_URI} ^(.*)$ + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L] + +### SILVERSTRIPE END ### \ No newline at end of file diff --git a/.mergesources.yml b/.mergesources.yml new file mode 100644 index 0000000..bc71aae --- /dev/null +++ b/.mergesources.yml @@ -0,0 +1,8 @@ +# Data source for the "arb" svn merge tool (see http://github.com/sminnee/arborist). +# Keeps track of all opensource branches of submodules +# that could be merged back to the current submodule paths. +trunk: + .: /open/phpinstaller/trunk + sapphire: /open/modules/sapphire/trunk + cms: /open/modules/cms/trunk + jsparty: /open/modules/jsparty/trunk \ No newline at end of file diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..3da0e20 --- /dev/null +++ b/COPYING @@ -0,0 +1,17 @@ +Copyright (c) 2007-2008, SilverStripe Limited - www.silverstripe.com +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of SilverStripe nor the names of its contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +OF SUCH DAMAGE. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..ce15d67 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +For a full change log, please visit http://open.silverstripe.org/wiki/ChangeLog. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..a1db54f --- /dev/null +++ b/INSTALL @@ -0,0 +1,19 @@ +Thanks for downloading SilverStripe CMS. + +Simply extract the archive to a folder in a web-accessible location and visit the folder +in your web browser (which in turn runs index.php). + +This will lead you through a web-based installation process. + +Server Requirements + * PHP 5.0.4+ (5.2+ is recommended) + * MySQL 4.1+ (other databases are supported - details here: http://doc.silverstripe.com/doku.php?id=server-requirements) + * Apache or IIS 7.x + * More information on server requirements here: http://doc.silverstripe.com/doku.php?id=server-requirements + +General documentation, tutorials: + * Wiki: http://doc.silverstripe.com/ + * Tutorials: http://doc.silverstripe.org/doku.php?id=tutorials + +Forum + * http://www.silverstripe.com/silverstripe-forum/ \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c4e3c30 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +# +# This makefile is a secondary way of installing SilverStripe. +# It is used for things like continuous integration +# +# Most users should simply visit the site root in your web browser. +# + +test: + $(MAKE) QUERYSTRING="$(QUERYSTRING)" -C sapphire test + +getallmodules: + if [ -d auth_openid ]; then svn update auth_openid; else svn co http://svn.silverstripe.com/open/modules/auth_openid/trunk auth_openid; fi + if [ -d blog ]; then svn update blog; else svn co http://svn.silverstripe.com/open/modules/blog/trunk blog; fi + if [ -d cmsworkflow ]; then svn update cmsworkflow; else svn co http://svn.silverstripe.com/open/modules/cmsworkflow/trunk cmsworkflow; fi + if [ -d forum ]; then svn update forum; else svn co http://svn.silverstripe.com/open/modules/forum/trunk forum; fi + if [ -d genericdataadmin ]; then svn update genericdataadmin; else svn co http://svn.silverstripe.com/open/modules/genericdataadmin/trunk genericdataadmin; fi + if [ -d multiform ]; then svn update multiform; else svn co http://svn.silverstripe.com/open/modules/multiform/trunk multiform; fi + if [ -d subsites ]; then svn update subsites; else svn co http://svn.silverstripe.com/open/modules/subsites/trunk subsites; fi + if [ -d userforms ]; then svn update userforms; else svn co http://svn.silverstripe.com/open/modules/userforms/trunk userforms; fi \ No newline at end of file diff --git a/UPGRADING b/UPGRADING new file mode 100644 index 0000000..e6984f4 --- /dev/null +++ b/UPGRADING @@ -0,0 +1,20 @@ +Usually upgrading your SilverStripe installation just means overwriting files +and updating your database-schema. + + - Backup your database + - Backup your webroot + - Download the new release and uncompress it to a temporary folder + - With these folders: cms, sapphire, googlesitemaps + - Delete your existing folders + - Extract and replace folders from your download (leave modules + and your custom directories alone) + - Moving your current folders (rather than installing on top) means + you can undo the installation, and ensures if the new release has no + longer contains some files, these files won't be left behind, which otherwise + could cause bugs. + - Visit http://your.silverstripe.site/dev/build (This adds new + fields/tables to the database, and empties your template cache) + - Check if any modules (e.g. blog or forum) in your installation are compatible + and need to be upgraded as well + - Check if you need to adapt your code to changed APIs, see + http://doc.silverstripe.com/doku.php?id=upgrading diff --git a/assets/.htaccess b/assets/.htaccess new file mode 100644 index 0000000..ac6412a --- /dev/null +++ b/assets/.htaccess @@ -0,0 +1,2 @@ +RemoveHandler .php .phtml .php3 .php4 .php5 .inc +RemoveType .php .phtml .php3 .php4 .php5 .inc diff --git a/assets/Uploads/SilverStripeLogo.png b/assets/Uploads/SilverStripeLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..29a02e2b574a7b50ae359760dbb295fc9e68a1e3 GIT binary patch literal 12162 zcmZu%cQ~A1uofkVL@yE1TM$G^M6gPf=p|~fqSsh0%I=Ct)M!bRjV>g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w^$_cHIk6u<_ufoC>-cZyE5+# z5u_)6Oxsi+IV}ZWKeaHsXZ-~X^j&c`lKbb$!l)MB=7bcNgz&kO`tNO{nL_(VfgY{* z&g~rvKLvf>9&)WX1bBU_Uv*W5s5uz}!R9_ggEE}f_xDC**2&>5iuioAB`qhZ?&ntP zwJQS+u1zaGPgn3taM~CZ&_wWf$+L{&B<*!e5}*rA6vzm>R~w~d8*;ho4%YpIQ5;b; zc6zJd-nJfXUj5{`d)W;D_aq(&&;$DF>il-x#DSOT=EYe?BU_g$VOLr{oLlKU<50{s z`}8Hy`xP-&A5jOn1YgrzU%fe!<+wx?5WTyiCV&-q^gMJ4hU-fm#%FF`c9GSmpE>QY zKb^Xq?3r{BV`-P(!DX}AOgR;_lH!pB>o|E9EUCa@gn>eFN@ZJCYy5~M9 zIS4h08Pk&WA_s=$EtzfGU0SMc4oh=%-2r?YB?>g!0I9d_9(wxzp3!RYkE*M{wBL3( zJ0}8|CX2Fy9MCGzvZsT$chCqoW#(TT11$VAI^i>V+9XIgPyv|Sf<6CFjb?Ppf{a~(Yr3quP+aaa<*btBlp`}v8y4#W|B>7;hfid|oWS&&KRn|X+~+Ib+=B7{ zvmV8+rd`p><9}0ZE^6jty7U#WLA04m&VVXNTp17{ft5rt0i`czPnLh4tm4a?Iyjzp zSBcr@zH}LvqOcM7@)sWm2(U*xQh;R)2+D=iuK%a?%ExC+PPcE-6JyH6wf>pXASb8d zU)iVa-F}0BVC$}VuGQ6ZBAl|p_Z)G7yOvCJr9D06o1*^=N-PR6xZZrf?gw{Z%52_0 z8T=D?4jAFunQpNM zT`sN_b}97!wQ^WD$n2i4;f9%#sB~S literal 0 HcmV?d00001 diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..e73f5bec360ddc302cb7cb5b590c8573529b8d75 GIT binary patch literal 318 zcmZQzU<5(|0RbS%!l1#(z#zuJz@P!d0zj+)#2|58;NIFGhVPFLFx*<|#PIxB55u)N zh78}|Ut@T_H5{?@c;jRhI#8kItCqI7xKu56;acNiuHwDwiff4PS{0X5OB_YKR=YS!U2$FFyvoES&4p{3 z%dUkgE>2M(JuA;xty;C%WfsIVp(K7&s&t Z7$ks!&;tyUHXuF>lz#|R{}H4IiUFjycS`^O literal 0 HcmV?d00001 diff --git a/index.php b/index.php new file mode 100644 index 0000000..052827b --- /dev/null +++ b/index.php @@ -0,0 +1,63 @@ + $snLen && substr($_SERVER['REQUEST_URI'],0,$snLen+1) == ($_SERVER['SCRIPT_NAME'] . '/')) { + $url = substr($_SERVER['REQUEST_URI'],$snLen+1); + $url = strtok($url, '?'); + } else { + $url = $_SERVER['REQUEST_URI']; + if($url[0] == '/') $url = substr($url,1); + $url = strtok($url, '?'); + } + +// Apache will populate the server variables this way +} else { + if($ruLen > $snLen && substr($_SERVER['REQUEST_URI'],0,$snLen+1) == ($_SERVER['SCRIPT_NAME'] . '/')) { + $url = substr($_SERVER['REQUEST_URI'],$snLen+1); + $url = strtok($url, '?'); + } else { + $url = ""; + } +} + +$_GET['url'] = $_REQUEST['url'] = $url; + +$fileName = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $url; + +/** + * This code is a very simple wrapper for sending files + * Very quickly pass through references to files + */ +if($url && file_exists($fileName)) { + $fileURL = (dirname($_SERVER['SCRIPT_NAME'])=='/'?'':dirname($_SERVER['SCRIPT_NAME'])) . '/' . $url; + header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently'); + header("Location: $fileURL"); + die(); +} + +require_once('sapphire/main.php'); diff --git a/install.php b/install.php new file mode 100644 index 0000000..15e4d98 --- /dev/null +++ b/install.php @@ -0,0 +1,1250 @@ + $details) { + $bits = explode('_', $code); + if(preg_match("/{$bits[0]}.{$bits[1]}/", $_SERVER['HTTP_USER_AGENT'])) { + $defaultLocale = $code; + break; + } + } +} + +// Discover which databases are available +DatabaseAdapterRegistry::autodiscover(); + +// Determine which external database modules are USABLE +foreach(DatabaseAdapterRegistry::get_adapters() as $class => $details) { + $databaseClasses[$class] = $details; + if(file_exists($details['helperPath'])) { + $databaseClasses[$class]['hasModule'] = true; + include_once($details['helperPath']); + } else { + $databaseClasses[$class]['hasModule'] = false; + } +} + +// Load database config +if(isset($_REQUEST['db'])) { + if(isset($_REQUEST['db']['type'])) $type = $_REQUEST['db']['type']; + else $type = $_REQUEST['db']['type'] = defined('SS_DATABASE_CLASS') ? SS_DATABASE_CLASS : 'MySQLDatabase'; + + // Disabled inputs don't submit anything - we need to use the environment (except the database name) + if($usingEnv) { + $_REQUEST['db'][$type] = $databaseConfig = array( + "type" => defined('SS_DATABASE_CLASS') ? SS_DATABASE_CLASS : $type, + "server" => defined('SS_DATABASE_SERVER') ? SS_DATABASE_SERVER : "localhost", + "username" => defined('SS_DATABASE_USERNAME') ? SS_DATABASE_USERNAME : "root", + "password" => defined('SS_DATABASE_PASSWORD') ? SS_DATABASE_PASSWORD : "", + "database" => $_REQUEST['db'][$type]['database'], + ); + + } else { + // Normal behaviour without the environment + $databaseConfig = $_REQUEST['db'][$type]; + $databaseConfig['type'] = $type; + } +} else { + $_REQUEST['db'][$type] = $databaseConfig = array( + "type" => defined('SS_DATABASE_CLASS') ? SS_DATABASE_CLASS : "MySQLDatabase", + "server" => defined('SS_DATABASE_SERVER') ? SS_DATABASE_SERVER : "localhost", + "username" => defined('SS_DATABASE_USERNAME') ? SS_DATABASE_USERNAME : "root", + "password" => defined('SS_DATABASE_PASSWORD') ? SS_DATABASE_PASSWORD : "", + "database" => isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : "SS_mysite", + ); +} + +if(isset($_REQUEST['admin'])) { + // Disabled inputs don't submit anything - we need to use the environment (except the database name) + if($usingEnv) { + $_REQUEST['admin'] = $adminConfig = array( + 'username' => defined('SS_DEFAULT_ADMIN_USERNAME') ? SS_DEFAULT_ADMIN_USERNAME : 'admin', + 'password' => defined('SS_DEFAULT_ADMIN_PASSWORD') ? SS_DEFAULT_ADMIN_PASSWORD : '', + ); + } else { + $adminConfig = $_REQUEST['admin']; + } +} else { + $_REQUEST['admin'] = $adminConfig = array( + 'username' => defined('SS_DEFAULT_ADMIN_USERNAME') ? SS_DEFAULT_ADMIN_USERNAME : 'admin', + 'password' => defined('SS_DEFAULT_ADMIN_PASSWORD') ? SS_DEFAULT_ADMIN_PASSWORD : '', + ); +} + +$alreadyInstalled = false; +if(file_exists('mysite/_config.php')) { + // Find the $database variable in the relevant config file without having to execute the config file + if(preg_match("/\\\$database\s*=\s*[^\n\r]+[\n\r]/", file_get_contents("mysite/_config.php"), $parts)) { + eval($parts[0]); + if($database) $alreadyInstalled = true; + // Assume that if $databaseConfig is defined in mysite/_config.php, then a non-environment-based installation has + // already gone ahead + } else if(preg_match("/\\\$databaseConfig\s*=\s*[^\n\r]+[\n\r]/", file_get_contents("mysite/_config.php"), $parts)) { + $alreadyInstalled = true; + } +} + +if(file_exists('sapphire/silverstripe_version')) { + $sapphireVersionFile = file_get_contents('sapphire/silverstripe_version'); + if(strstr($sapphireVersionFile, "/sapphire/trunk")) { + $silverstripe_version = "trunk"; + } else { + preg_match("/sapphire\/(?:(?:branches)|(?:tags))(?:\/rc)?\/([A-Za-z0-9._-]+)\/silverstripe_version/", $sapphireVersionFile, $matches); + $silverstripe_version = $matches[1]; + } +} else { + $silverstripe_version = "unknown"; +} + +// Check requirements +$req = new InstallRequirements(); +$req->check(); + +$webserverConfigFile = ''; +if($req->isIIS()) { + $webserverConfigFile = 'web.config'; +} else { + $webserverConfigFile = '.htaccess'; +} + +if($req->hasErrors()) { + $hasErrorOtherThanDatabase = true; +} + +if($databaseConfig) { + $dbReq = new InstallRequirements(); + $dbReq->checkDatabase($databaseConfig); +} + +if($adminConfig) { + $adminReq = new InstallRequirements(); + $adminReq->checkAdminConfig($adminConfig); +} + +// Actual processor +$installFromCli = (isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'install'); + +// CLI-install error message. exit(1) will halt any makefile. +if($installFromCli && ($req->hasErrors() || $dbReq->hasErrors())) { + echo "Cannot install due to errors:\n"; + $req->listErrors(); + $dbReq->listErrors(); + exit(1); +} + +if((isset($_REQUEST['go']) || $installFromCli) && !$req->hasErrors() && !$dbReq->hasErrors() && $adminConfig['username'] && $adminConfig['password']) { + // Confirm before reinstalling + if(!isset($_REQUEST['force_reinstall']) && !$installFromCli && $alreadyInstalled) { + include('sapphire/dev/install/config-form.html'); + + } else { + $inst = new Installer(); + if($_REQUEST) $inst->install($_REQUEST); + else $inst->install(array( + 'db' => $databaseConfig, + 'admin' => $adminConfig, + )); + } + +// Show the config form +} else { + include('sapphire/dev/install/config-form.html'); +} + +/** + * This class checks requirements + * Each of the requireXXX functions takes an argument which gives a user description of the test. + * It's an array of 3 parts: + * $description[0] - The test catetgory + * $description[1] - The test title + * $description[2] - The test error to show, if it goes wrong + */ +class InstallRequirements { + var $errors, $warnings, $tests; + + /** + * Check the database configuration. These are done one after another + * starting with checking the database function exists in PHP, and + * continuing onto more difficult checks like database permissions. + */ + function checkDatabase($databaseConfig) { + if($this->requireDatabaseFunctions( + $databaseConfig, + array( + "Database Configuration", + "Database support", + "Database support not included in PHP.") + ) + ) { + if($this->requireDatabaseServer( + $databaseConfig, + array( + "Database Configuration", + "Database server exists", + "I couldn't find a database server on '$databaseConfig[server]'", + $databaseConfig['server'] + ) + )) { + if($this->requireDatabaseConnection( + $databaseConfig, + array( + "Database Configuration", + "Database access credentials correct", + "That username/password doesn't work" + ) + )) { + if($this->requireDatabaseVersion( + $databaseConfig, + array( + "Database Configuration", + "Database server meets required version", + "" + ) + )) { + $this->requireDatabaseOrCreatePermissions( + $databaseConfig, + array( + "Database Configuration", + "Can I access/create the database", + "I can't create new databases and the database '$databaseConfig[database]' doesn't exist" + ) + ); + } + } + } + } + } + + function checkAdminConfig($adminConfig) { + if(!$adminConfig['username']) { + $this->error(array('', 'Please enter a username!')); + } + if(!$adminConfig['password']) { + $this->error(array('', 'Please enter a password!')); + } + } + + /** + * Check if the web server is IIS. + * @return boolean + */ + function isIIS() { + if(isset($_SERVER['SERVER_SOFTWARE'])) { + if(strpos($_SERVER['SERVER_SOFTWARE'], 'IIS/7') !== false) { + return true; + } + } + return false; + } + + function isApache() { + $signature = !empty($_SERVER['SERVER_SIGNATURE']) + ? $_SERVER['SERVER_SIGNATURE'] + : @$_SERVER['SERVER_SOFTWARE']; + + $signature = strip_tags(trim($signature)); + if($signature && strpos($signature, 'Apache') !== false) { + return true; + } else { + return false; + } + } + + function findWebserver() { + $webserver = strip_tags(trim(@$_SERVER['SERVER_SIGNATURE'])); + if(!$webserver) { + if(isset($_SERVER['SERVER_SOFTWARE'])) { + if(strpos($_SERVER['SERVER_SOFTWARE'], 'IIS/7') !== false || + strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) { + $webserver = $_SERVER['SERVER_SOFTWARE']; + } + } else { + $webserver = "I can't tell what webserver you are running"; + } + } + return $webserver; + } + + /** + * Check everything except the database + */ + function check() { + $this->errors = null; + $isApache = $this->isApache(); + $isIIS = $this->isIIS(); + $webserver = $this->findWebserver(); + + $this->requirePHPVersion('5.2.0', '5.1.0', array("PHP Configuration", "PHP5 installed", null, "PHP version " . phpversion())); + + // Check that we can identify the root folder successfully + $this->requireFile('sapphire/dev/install/config-form.html', array("File permissions", + "Does the webserver know where files are stored?", + "The webserver isn't letting me identify where files are stored.", + $this->getBaseDir() + )); + + $this->requireFile('mysite', array("File permissions", "mysite/ folder exists", "There's no mysite folder.")); + $this->requireFile('sapphire', array("File permissions", "sapphire/ folder exists", "There's no sapphire folder.")); + $this->requireFile('cms', array("File permissions", "cms/ folder exists", "There's no cms folder.")); + + if($isApache) { + $this->requireWriteable('.htaccess', array("File permissions", "Is the .htaccess file writeable?", null)); + } elseif($isIIS) { + $this->requireWriteable('web.config', array("File permissions", "Is the web.config file writeable?", null)); + } + + $this->requireWriteable('mysite/_config.php', array("File permissions", "Is the mysite/_config.php file writeable?", null)); + $this->requireWriteable('assets', array("File permissions", "Is the assets/ folder writeable?", null)); + + $this->requireTempFolder(array('File permissions', 'Is the temporary folder writeable?', null)); + + // Check for web server, unless we're calling the installer from the command-line + if(!isset($_SERVER['argv']) || !$_SERVER['argv']) { + $this->isRunningWebServer(array("Webserver Configuration", "Server software", "Unknown web server", $webserver)); + + if($isApache) { + $this->requireApacheRewriteModule('mod_rewrite', array("Webserver Configuration", "URL rewriting support", "You need mod_rewrite to use friendly URLs with SilverStripe, but it is not enabled.")); + } elseif($isIIS) { + $this->requireIISRewriteModule('IIS_UrlRewriteModule', array("Webserver Configuration", "URL rewriting support", "You need to enable the IIS URL Rewrite Module to use friendly URLs with SilverStripe, but it is not installed or enabled. Download it for IIS 7 from http://www.iis.net/expand/URLRewrite")); + } else { + $this->warning(array("Webserver Configuration", "URL rewriting support", "I can't tell whether any rewriting module is running. You may need to configure a rewriting rule yourself.")); + } + + $this->requireServerVariables(array('SCRIPT_NAME','HTTP_HOST','SCRIPT_FILENAME'), array("Webserver config", "Recognised webserver", "You seem to be using an unsupported webserver. The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set.")); + } + + // Check for GD support + if(!$this->requireFunction("imagecreatetruecolor", array("PHP Configuration", "GD2 support", "PHP must have GD version 2."))) { + $this->requireFunction("imagecreate", array("PHP Configuration", "GD2 support", "GD support for PHP not included.")); + } + + // Check for XML support + $this->requireFunction('xml_set_object', array("PHP Configuration", "XML support", "XML support not included in PHP.")); + $this->requireClass('DOMDocument', array("PHP Configuration", "DOM/XML support", "DOM/XML support not included in PHP.")); + + // Check for token_get_all + $this->requireFunction('token_get_all', array("PHP Configuration", "PHP Tokenizer", "PHP tokenizer support not included in PHP.")); + + + // Check memory allocation + $this->requireMemory(32*1024*1024, 64*1024*1024, array("PHP Configuration", "Memory allocated (PHP config option 'memory_limit')", "SilverStripe needs a minimum of 32M allocated to PHP, but recommends 64M.", ini_get("memory_limit"))); + + return $this->errors; + } + + function suggestPHPSetting($settingName, $settingValues, $testDetails) { + $this->testing($testDetails); + + $val = ini_get($settingName); + if(!in_array($val, $settingValues) && $val != $settingValues) { + $testDetails[2] = "$settingName is set to '$val' in php.ini. $testDetails[2]"; + $this->warning($testDetails); + } + } + + function requireMemory($min, $recommended, $testDetails) { + $_SESSION['forcemem'] = false; + + $mem = $this->getPHPMemory(); + if($mem < (64 * 1024 * 1024)) { + ini_set('memory_limit', '64M'); + $mem = $this->getPHPMemory(); + $testDetails[3] = ini_get("memory_limit"); + } + + $this->testing($testDetails); + + if($mem < $min && $mem > 0) { + $testDetails[2] .= " You only have " . ini_get("memory_limit") . " allocated"; + $this->error($testDetails); + } else if($mem < $recommended && $mem > 0) { + $testDetails[2] .= " You only have " . ini_get("memory_limit") . " allocated"; + $this->warning($testDetails); + } elseif($mem == 0) { + $testDetails[2] .= " We can't determine how much memory you have allocated. Install only if you're sure you've allocated at least 20 MB."; + $this->warning($testDetails); + } + } + + function getPHPMemory() { + $memString = ini_get("memory_limit"); + + switch(strtolower(substr($memString,-1))) { + case "k": + return round(substr($memString,0,-1)*1024); + + case "m": + return round(substr($memString,0,-1)*1024*1024); + + case "g": + return round(substr($memString,0,-1)*1024*1024*1024); + + default: + return round($memString); + } + } + + function listErrors() { + if($this->errors) { + echo "

The following problems are preventing me from installing SilverStripe CMS:

\n\n"; + foreach($this->errors as $error) { + echo "
  • " . htmlentities(implode(", ", $error)) . "
  • \n"; + } + } + } + + function showTable($section = null) { + if($section) { + $tests = $this->tests[$section]; + $id = strtolower(str_replace(' ', '_', $section)); + echo ""; + foreach($tests as $test => $result) { + echo ""; + } + echo "
    $test" . nl2br(htmlentities($result[1])) . "
    "; + + } else { + foreach($this->tests as $section => $tests) { + $failedRequirements = 0; + $warningRequirements = 0; + + $output = ""; + + foreach($tests as $test => $result) { + if(isset($result['0'])) { + switch($result['0']) { + case 'error': + $failedRequirements++; + break; + case 'warning': + $warningRequirements++; + break; + } + } + $output .= "$test" . nl2br(htmlentities($result[1])) . ""; + } + $className = "good"; + $text = "All Requirements Pass"; + $pluralWarnings = ($warningRequirements == 1) ? 'Warning' : 'Warnings'; + + if($failedRequirements > 0) { + $className = "error"; + $pluralWarnings = ($warningRequirements == 1) ? 'Warning' : 'Warnings'; + + $text = $failedRequirements . ' Failed and '. $warningRequirements . ' '. $pluralWarnings; + } + else if($warningRequirements > 0) { + $className = "warning"; + $text = "All Requirements Pass but ". $warningRequirements . ' '. $pluralWarnings; + } + + echo "
    $section See All Requirements $text
    "; + echo ""; + echo $output; + echo "
    "; + } + } + } + + function requireFunction($funcName, $testDetails) { + $this->testing($testDetails); + if(!function_exists($funcName)) $this->error($testDetails); + else return true; + } + + function requireClass($className, $testDetails) { + $this->testing($testDetails); + if(!class_exists($className)) $this->error($testDetails); + else return false; + } + + /** + * Require that the given class doesn't exist + */ + function requireNoClasses($classNames, $testDetails) { + $this->testing($testDetails); + $badClasses = array(); + foreach($classNames as $className) { + if(class_exists($className)) $badClasses[] = $className; + } + if($badClasses) { + $testDetails[2] .= ". The following classes are at fault: " . implode(', ', $badClasses); + $this->error($testDetails); + } + else return true; + } + + function requirePHPVersion($recommendedVersion, $requiredVersion, $testDetails) { + $this->testing($testDetails); + + $installedVersion = phpversion(); + + if(version_compare($installedVersion, $requiredVersion, '<')) { + $testDetails[2] = "SilverStripe requires PHP version $requiredVersion or later.\n + PHP version $installedVersion is currently installed.\n + While SilverStripe requires at least PHP version $requiredVersion, upgrading to $recommendedVersion or later is recommended.\n + If you are installing SilverStripe on a shared web server, please ask your web hosting provider to upgrade PHP for you."; + $this->error($testDetails); + return; + } + + if(version_compare($installedVersion, $recommendedVersion, '<')) { + $testDetails[2] = "PHP version $installedVersion is currently installed.\n + Upgrading to at least PHP version $recommendedVersion is recommended.\n + SilverStripe should run, but you may run into issues. Future releases may require a later version of PHP.\n"; + $this->warning($testDetails); + return; + } + + return true; + } + + function requireFile($filename, $testDetails) { + $this->testing($testDetails); + $filename = $this->getBaseDir() . $filename; + if(!file_exists($filename)) { + $testDetails[2] .= " (file '$filename' not found)"; + $this->error($testDetails); + } + } + + function requireWriteable($filename, $testDetails) { + $this->testing($testDetails); + $filename = $this->getBaseDir() . str_replace("/", DIRECTORY_SEPARATOR,$filename); + + if(!is_writeable($filename)) { + if(function_exists('posix_getgroups')) { + $userID = posix_geteuid(); + $user = posix_getpwuid($userID); + + $currentOwnerID = fileowner($filename); + $currentOwner = posix_getpwuid($currentOwnerID); + + $testDetails[2] .= "User '$user[name]' needs to be able to write to this file:\n$filename\n\nThe file is currently owned by '$currentOwner[name]'. "; + + if($user['name'] == $currentOwner['name']) { + $testDetails[2] .= "We recommend that you make the file writeable."; + } else { + + $groups = posix_getgroups(); + foreach($groups as $group) { + $groupInfo = posix_getgrgid($group); + if(in_array($currentOwner['name'], $groupInfo['members'])) $groupList[] = $groupInfo['name']; + } + if($groupList) { + $testDetails[2] .= " We recommend that you make the file group-writeable and change the group to one of these groups:\n - ". implode("\n - ", $groupList) + . "\n\nFor example:\nchmod g+w $filename\nchgrp " . $groupList[0] . " $filename"; + } else { + $testDetails[2] .= " There is no user-group that contains both the web-server user and the owner of this file. Change the ownership of the file, create a new group, or temporarily make the file writeable by everyone during the install process."; + } + } + + } else { + $testDetails[2] .= "The webserver user needs to be able to write to this file:\n$filename"; + } + + $this->error($testDetails); + } + } + + function requireTempFolder($testDetails) { + $this->testing($testDetails); + + if(function_exists('sys_get_temp_dir')) { + $sysTmp = sys_get_temp_dir(); + } elseif(isset($_ENV['TMP'])) { + $sysTmp = $_ENV['TMP']; + } else { + @$tmpFile = tempnam('adfadsfdas',''); + @unlink($tmpFile); + $sysTmp = dirname($tmpFile); + } + + $worked = true; + $ssTmp = "$sysTmp/silverstripe-cache"; + + if(!@file_exists($ssTmp)) { + @$worked = mkdir($ssTmp); + + if(!$worked) { + $ssTmp = dirname($_SERVER['SCRIPT_FILENAME']) . "/silverstripe-cache"; + $worked = true; + if(!@file_exists($ssTmp)) { + @$worked = mkdir($ssTmp); + } + if(!$worked) { + $testDetails[2] = "Permission problem gaining access to a temp folder. " . + "Please create a folder named silverstripe-cache in the base folder " . + "of the installation and ensure it has the adequate permissions"; + $this->error($testDetails); + } + } + } + } + + function requireApacheModule($moduleName, $testDetails) { + $this->testing($testDetails); + if(!in_array($moduleName, apache_get_modules())) { + $this->error($testDetails); + return false; + } else { + return true; + } + } + + function testApacheRewriteExists($moduleName = 'mod_rewrite') { + if(function_exists('apache_get_modules') && in_array($moduleName, apache_get_modules())) { + return true; + } else { + return false; + } + } + + function testIISRewriteModuleExists($moduleName = 'IIS_UrlRewriteModule') { + if(isset($_SERVER[$moduleName]) && $_SERVER[$moduleName]) { + return true; + } else { + return false; + } + } + + function requireApacheRewriteModule($moduleName, $testDetails) { + $this->testing($testDetails); + if($this->testApacheRewriteExists()) { + return true; + } else { + $this->warning($testDetails); + return false; + } + } + + /** + * Determines if the web server has any rewriting capability. + * @return boolean + */ + function hasRewritingCapability() { + return ($this->testApacheRewriteExists() || $this->testIISRewriteModuleExists()); + } + + function requireIISRewriteModule($moduleName, $testDetails) { + $this->testing($testDetails); + if($this->testIISRewriteModuleExists()) { + return true; + } else { + $this->warning($testDetails); + return false; + } + } + + /** + * Get an instance of a helper class for the specific database. + * @param string $databaseClass e.g. MySQLDatabase or MSSQLDatabase + */ + function getDatabaseConfigurationHelper($databaseClass) { + $adapters = DatabaseAdapterRegistry::get_adapters(); + if(isset($adapters[$databaseClass])) { + $helperPath = $adapters[$databaseClass]['helperPath']; + $class = str_replace('.php', '', basename($helperPath)); + } + return (class_exists($class)) ? new $class() : new MySQLDatabaseConfigurationHelper(); + } + + function requireDatabaseFunctions($databaseConfig, $testDetails) { + $this->testing($testDetails); + $helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']); + $result = $helper->requireDatabaseFunctions($databaseConfig); + if($result) { + return true; + } else { + $this->error($testDetails); + return false; + } + } + + function requireDatabaseConnection($databaseConfig, $testDetails) { + $this->testing($testDetails); + $helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']); + $result = $helper->requireDatabaseConnection($databaseConfig); + if($result['success']) { + return true; + } else { + $testDetails[2] .= ": " . $result['error']; + $this->error($testDetails); + return false; + } + } + + function requireDatabaseVersion($databaseConfig, $testDetails) { + $this->testing($testDetails); + $helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']); + if(method_exists($helper, 'requireDatabaseVersion')) { + $result = $helper->requireDatabaseVersion($databaseConfig); + if($result['success']) { + return true; + } else { + $testDetails[2] .= $result['error']; + $this->warning($testDetails); + return false; + } + } + // Skipped test because this database has no required version + return true; + } + + function requireDatabaseServer($databaseConfig, $testDetails) { + $this->testing($testDetails); + $helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']); + $result = $helper->requireDatabaseServer($databaseConfig); + if($result['success']) { + return true; + } else { + $testDetails[2] .= ": " . $result['error']; + $this->error($testDetails); + return false; + } + } + + function requireDatabaseOrCreatePermissions($databaseConfig, $testDetails) { + $this->testing($testDetails); + $helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']); + $result = $helper->requireDatabaseOrCreatePermissions($databaseConfig); + if($result['success']) { + if($result['alreadyExists']) $testDetails[3] = "Database $databaseConfig[database] exists"; + else $testDetails[3] = "Able to create a new database"; + $this->testing($testDetails); + return true; + } else { + if(!@$result['cannotCreate']) { + $testDetails[2] .= ". Please create the database manually."; + } else { + $testDetails[2] .= " (user '$databaseConfig[username]' doesn't have CREATE DATABASE permissions.)"; + } + + $this->error($testDetails); + return false; + } + } + + function requireServerVariables($varNames, $errorMessage) { + //$this->testing($testDetails); + foreach($varNames as $varName) { + if(!$_SERVER[$varName]) $missing[] = '$_SERVER[' . $varName . ']'; + } + if(!isset($missing)) { + return true; + } else { + $testDetails[2] .= " (the following PHP variables are missing: " . implode(", ", $missing) . ")"; + $this->error($testDetails); + } + } + + function isRunningWebServer($testDetails) { + $this->testing($testDetails); + if(function_exists('apache_get_modules') || stristr(@$_SERVER['SERVER_SIGNATURE'], 'Apache')) { + return true; + } elseif(strpos($_SERVER['SERVER_SOFTWARE'], 'IIS/7') !== false) { + return true; + } else { + $this->warning($testDetails); + return false; + } + } + + + // Must be PHP4 compatible + var $baseDir; + function getBaseDir() { + // Cache the value so that when the installer mucks with SCRIPT_FILENAME half way through, this method + // still returns the correct value. + if(!$this->baseDir) $this->baseDir = realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . DIRECTORY_SEPARATOR; + return $this->baseDir; + } + + function testing($testDetails) { + if(!$testDetails) return; + + $section = $testDetails[0]; + $test = $testDetails[1]; + + $message = "OK"; + if(isset($testDetails[3])) $message .= " ($testDetails[3])"; + + $this->tests[$section][$test] = array("good", $message); + } + + function error($testDetails) { + $section = $testDetails[0]; + $test = $testDetails[1]; + + $this->tests[$section][$test] = array("error", $testDetails[2]); + $this->errors[] = $testDetails; + } + + function warning($testDetails) { + $section = $testDetails[0]; + $test = $testDetails[1]; + + $this->tests[$section][$test] = array("warning", $testDetails[2]); + $this->warnings[] = $testDetails; + } + + function hasErrors() { + return sizeof($this->errors); + } + + function hasWarnings() { + return sizeof($this->warnings); + } + +} + +class Installer extends InstallRequirements { + function __construct() { + // Cache the baseDir value + $this->getBaseDir(); + } + + function install($config) { + if(isset($_SERVER['HTTP_HOST'])) { + ?> + + + Installing SilverStripe... + + + + + + + +
    +
    + + + +
    + +
    +
    +

    Installing SilverStripe...

    +

    I am now running through the installation steps (this should take about 30 seconds)

    +

    If you receive a fatal error, refresh this page to continue the installation

    +