2010-08-02 12:06:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
global $project;
|
|
|
|
$project = 'mysite';
|
|
|
|
|
|
|
|
global $database;
|
|
|
|
$database = 'SS_ssnewdocstest';
|
|
|
|
|
|
|
|
require_once('conf/ConfigureFromEnv.php');
|
|
|
|
|
|
|
|
MySQLDatabase::set_connection_charset('utf8');
|
|
|
|
|
|
|
|
// This line set's the current theme. More themes can be
|
|
|
|
// downloaded from http://www.silverstripe.org/themes/
|
|
|
|
SSViewer::set_theme('docs');
|
|
|
|
|
|
|
|
// enable nested URLs for this site (e.g. page/sub-page/)
|
|
|
|
SiteTree::enable_nested_urls();
|
|
|
|
|
|
|
|
// render the user documentation first
|
|
|
|
Director::addRules(20, array(
|
|
|
|
'Security//$Action/$ID/$OtherID' => 'Security',
|
|
|
|
));
|
|
|
|
DocumentationViewer::set_link_base('');
|
|
|
|
DocumentationViewer::$check_permission = false;
|
2010-09-03 01:26:13 +02:00
|
|
|
|
|
|
|
// Hacky, but does the job. Without checking for this,
|
|
|
|
// all tests relying on standard URL routing will fail (e.g. ContentControllerTest)
|
|
|
|
$isRunningTest = (
|
|
|
|
(isset($_SERVER['argv'][1]) && strpos($_SERVER['argv'][1], 'dev/tests') !== FALSE)
|
|
|
|
|| (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'dev/tests') !== FALSE)
|
|
|
|
);
|
|
|
|
if(!$isRunningTest) {
|
|
|
|
Director::addRules(10, array(
|
|
|
|
'$Action' => 'DocumentationViewer',
|
2011-01-14 02:10:30 +01:00
|
|
|
'' => '->sapphire/en/'
|
2010-09-03 01:26:13 +02:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2010-08-02 12:06:21 +02:00
|
|
|
DocumentationService::set_automatic_registration(false);
|
2010-12-23 02:09:31 +01:00
|
|
|
DocumentationSearch::enable();
|
|
|
|
|
2011-02-07 09:00:20 +01:00
|
|
|
try{
|
2011-02-24 05:57:53 +01:00
|
|
|
DocumentationService::register("sapphire", BASE_PATH ."/src/sapphire_master/docs/", 'trunk');
|
2011-03-21 00:04:20 +01:00
|
|
|
DocumentationService::register("sapphire", BASE_PATH ."/src/sapphire_2.4/docs/", '2.4');
|
|
|
|
//DocumentationService::register("sapphire", BASE_PATH ."/src/sapphire_2.3/docs/", '2.3');
|
2010-12-23 02:09:31 +01:00
|
|
|
} catch(InvalidArgumentException $e) {
|
|
|
|
} // Silence if path is not found (for CI environment)
|
2010-09-03 03:37:55 +02:00
|
|
|
|
2010-08-02 12:06:21 +02:00
|
|
|
|
|
|
|
// We want this to be reviewed by the whole community
|
|
|
|
BasicAuth::protect_entire_site(false);
|
2011-01-13 21:20:04 +01:00
|
|
|
|
|
|
|
Object::add_extension('DocumentationViewer', 'DocumentationViewerExtension');
|
|
|
|
if(Director::isLive()) {
|
|
|
|
DocumentationViewerExtension::$google_analytics_code = 'UA-84547-8';
|
2011-01-17 06:58:42 +01:00
|
|
|
}
|
|
|
|
|
2011-04-19 11:46:38 +02:00
|
|
|
Validator::set_javascript_validation_handler('none');
|
|
|
|
|
|
|
|
DocumentationSearch::set_meta_data(array(
|
|
|
|
'ShortName' => 'SilverStripe Documentation',
|
|
|
|
'Description' => 'Documentation for SilverStripe CMS and the Sapphire Framework',
|
2011-04-29 01:54:32 +02:00
|
|
|
'Tags' => 'silverstripe sapphire php framework cms content management system'
|
2011-04-19 11:46:38 +02:00
|
|
|
));
|
2011-04-10 22:52:09 +02:00
|
|
|
|
|
|
|
DocumentationSearch::$boost_by_path = array(
|
|
|
|
// Changelogs have heaps of phrases, but are rarely relevant for content searches
|
|
|
|
'/^changelog/' => 0.05
|
2011-04-19 11:46:38 +02:00
|
|
|
);
|