mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 17:05:50 +02:00
6604109f31
- GitMarkdownUpdater - SVNMarkdonUpdater Add logging for errors to SS_Log Secure escaping of shell arguments and error detection
76 lines
2.3 KiB
PHP
76 lines
2.3 KiB
PHP
<?php
|
|
|
|
global $project;
|
|
$project = 'app';
|
|
|
|
global $database;
|
|
|
|
if(defined('SS_DATABASE_NAME') && SS_DATABASE_NAME) {
|
|
$database = SS_DATABASE_NAME;
|
|
} else {
|
|
$database = 'SS_ssdoc';
|
|
}
|
|
|
|
if(isset($_ENV['CLEARDB_DATABASE_URL'])) {
|
|
global $databaseConfig;
|
|
|
|
$parts = parse_url($_ENV['CLEARDB_DATABASE_URL']);
|
|
|
|
$databaseConfig['type'] = 'MySQLDatabase';
|
|
$databaseConfig['server'] = $parts['host'];
|
|
$databaseConfig['username'] = $parts['user'];
|
|
$databaseConfig['password'] = $parts['pass'];
|
|
$databaseConfig['database'] = trim($parts['path'], '/');
|
|
} else {
|
|
require_once('conf/ConfigureFromEnv.php');
|
|
}
|
|
|
|
MySQLDatabase::set_connection_charset('utf8');
|
|
|
|
SSViewer::set_theme('docs');
|
|
|
|
Config::inst()->update('DocumentationManifest', 'automatic_registration', false);
|
|
Config::inst()->update('DocumentationViewer', 'link_base', '');
|
|
Config::inst()->update('DocumentationViewer', 'check_permission', false);
|
|
|
|
DocumentationViewer::set_edit_link(
|
|
'framework',
|
|
'https://github.com/silverstripe/silverstripe-framework/edit/%version%/docs/%lang%/%path%',
|
|
array(
|
|
'rewritetrunktomaster' => true
|
|
)
|
|
);
|
|
|
|
if(Director::isLive()) {
|
|
Director::forceSSL();
|
|
ControllerExtension::$google_analytics_code = 'UA-84547-8';
|
|
}
|
|
|
|
DocumentationSearch::set_meta_data(array(
|
|
'ShortName' => 'SilverStripe Documentation',
|
|
'Description' => 'Documentation for SilverStripe CMS / Framework',
|
|
'Tags' => 'silverstripe sapphire php framework cms content management system'
|
|
));
|
|
|
|
// SS Platform logging
|
|
if(defined('AWS_SYSLOG_LEVEL')) {
|
|
$sysLogWriter = new SS_SysLogWriter('silverstripe', LOG_PID | LOG_CONS);
|
|
SS_Log::add_writer($sysLogWriter, (int)AWS_SYSLOG_LEVEL, '<=');
|
|
}
|
|
|
|
// Changelogs have heaps of phrases, but are rarely relevant for content searches
|
|
Config::inst()->update('DocumentationSearch', 'boost_by_path', array(
|
|
'/^changelog/' => 0.05
|
|
));
|
|
|
|
// Set shared index (avoid issues with different temp paths between CLI and web users)
|
|
Config::inst()->update('DocumentationSearch', 'index_location', BASE_PATH . '/assets/.lucene-index');
|
|
|
|
// Fix invalid character in iconv
|
|
// see http://stackoverflow.com/questions/4723135/invalid-characters-for-lucene-text-search
|
|
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
|
|
Zend_Search_Lucene_Analysis_Analyzer::setDefault(
|
|
new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive ()
|
|
);
|
|
|